My CTF Methodology
Step 1: Nmap
Running an nmap
scan to understand the following:
What is running on the target, what server names, what versions?
Service version scan
OS detection
Default script scan
What client software would we need to connect and assess the target?
Nmap scripts: not the default ones
There are additional enum
and brute
scripts that often don't get run as a default scan. Take note of everything u got such as:
FTP file enumeration
NFS share names
HTTP robots.txt and redirects
DNS names
Emails
Computer names
OS versions
Step 2.0 Service Enum: Active Directory
A typical port signature for an Active Directory domain controller, especially apparent due to DNS, SMB, Kerberos, and LDAP being open on the box:
Identify the Local Domain
we should check the nmap
output for the RootDSE and any potential hostname (e.g. DC01.domain.tld
). Once, established, we should add the domain and hostname to our /etc/hosts
file.
If you've only run a basic nmap
scan and need to enumerate the RootDSE
DNS
If we've established the local domain for the Active Directory environment, we should attempt to enumerate any DNS records for use when assessing other protocols
Attempt for a zone transfer from the DNS server on the target. ==Note that: If the service configured correctly, the zone transfer should be refused:==
If the zone transfer fails, you can try and manually enumerate records in the target domain
LDAP
A quick win would be the ability to enumerate LDAP records anonymously, as this would allow us to gather great information about users, groups, and other domain records.
==Note that: If configured correctly, you should see an error saying that a successful bind must be completed, meaning you need a credential== However, if you are able to anonymously query LDAP, this is an example command to pull everything from LDAP:
SMB
If we can connect to SMB anonymously
Checking the shares for any useful info
it's worth checking to see if we can enumerate object RIDs anonymously as well. RID cycling would allow us to enumerate a list of users and groups on the computer for further use during testing.
Connect to SMB with a null session (and maybe even list shares), we can try and enumerate more and potentially map shares
Connect to a SMB share via null session
==Note that: If configured correctly, you should see a permissions error, indicating the tests have failed==
Kerberos
If u haven't got any usernames from the previous approaches try the Pre-Auth username Enum
If we've found some usernames, we can then see if any of them are configured with
UF_DONT_REQUIRE_PREAUTH
, pull some AS-REP hashes, and attempt to crack them offline.
Pre-Auth Username Enumeration
Kerberos is an authentication protocol used in networks.
Pre-Auth Username Enumeration is a technique to find valid usernames by checking how the Kerberos server (KDC) responds to requests without pre-authentication.
How it Works:
Send a request for a Ticket Granting Ticket (TGT) to the KDC without providing a pre-authentication hash.
If the username is valid:
The KDC will either ask for pre-authentication or return a TGT (if pre-authentication is not required).
If the username is invalid:
The KDC responds with
PRINCIPAL UNKNOWN
.
Steps to Enumerate Usernames:
Prepare a Username List:
Clean and deduplicate a list of usernames.
Use Kerbrute to Enumerate Valid Usernames:
Test the usernames against the KDC.
Extract Valid Usernames:
Extract valid usernames from the Kerbrute log.
Find AS-REP Hashes (for Users Without Pre-Auth):
Use Impacket's
GetNPUsers
to extract AS-REP hashes for users who don’t require pre-authentication.
Using Nmap for Enumeration:
Nmap can also enumerate usernames but is slower and less efficient for large lists.
Example command:
Step 2.1 Service Enum: General
File servers — FTP/SMB
May allow anonymous access or may be configured with default credentials
This is an excellent opportunity to gather more information from files
Additional information may include usernames, passwords, config files, etc.
This information maybe useful when assessing other services
Web — HTTP/HTTPS
Web is just as simple as opening your web browser
Navigate to the target IP or domain name and just start clicking around
Make a note of potential input points that could be abused
Web pages may contain usernames, passwords, interesting source code, etc.
other things
Start probing other ports, try to understand how they behave
Lots of Googling, probably something on HackTricks about it
Try other
nmap
scans to see if additional ports are revealed; UDP or X-Mas scans, for example.
FTP — TCP/21
Check for anonymous FTP access on the target
When prompted for a password, simply press the Enter
key and see if it will allow you to login. If it does, try the following:
ls
to list files on the serverget
to retrieve files on the serverless
ormore
to read files from the FTP shellcd
to change into any potential directoriesput
to test write permissions as a way to perhaps chain an exploit with another service We're trying to uncover (Usernames Passwords Configuration files Source code Backups Anything interesting)
SMB — TCP/139 & TCP/445
Last updated
Was this helpful?