Introduction
The OSCP is an practical hacking exam with a strict 24-hour time constraint. Therefore, time management is the most important aspect of the exam. The ability to identify potentially vulnerable attack vectors within the time constraint is key — you can always research and learn the exploitation process on the fly. Note that this guide expects you to have basic understanding on hacking and the OSCP exam itself. To begin with, let’s filter out what we should not spend time on. Here is what you will likely not expect in the OSCP exam:
- OSINT (E.g., Google Dorking & DNS enumeration).
- Network Poisoning and Spoofing (LLMNR / NBT-NS Attacks)
- Client-side Attacks (E.g., Phishing, XSS, CSRF, etc - highly unlikely)
- Some practice boxes on PGs and HTBs do simulate client interactions.
- In the case that this is the intended path, there should also be hints (e.g., “An admin will review your comment”)
1
Vulnerable Versions & Public Exploits
2
Secure Versions but Misconfigurations
3
Hunting Sensitive Information
- Vulnerable Apache Web Server (Vulnerable Version) -> Path Traversal into reading SSH Private Key (Misconfiguration & Sensitive Information).
- Anonymous SMB Share (Misconfiguration) -> Discovered user credentials (Sensitive Information).
- Username used as Password (Misconfiguration) -> Run an authenticated RCE exploit (Vulnerable Version).
1
Enumerate the three vectors
2
Escalate privileges (Could be lateral / vertical)
3
Re-enumerate the three vectors with new privileges.
4
Repeat until root / admin
Vulnerable Versions
Vulnerable versions of services and applications are usually quick wins when there are Proof-of-Concepts (PoCs) and Public Exploits available out there.
Key strategies
1
Enumerating versions
Use automated scanning tools like
nmap, netcat, wpscan, etc., to perform banner grabbing or service scanning. Manually walk through each running services and look for service & version information.2
Look for public exploits
Utilize
searchsploit, GitHub repos, Exploit-DB, etc., for existing public exploits.3
Fixing and using exploits
Make sure the exploit is applicable to the service version. Some exploits have a range of vulnerable versions, and older versions may not be vulnerable. Also some public exploits require fixing and modifying before using.
Enumerating Versions
- Web Pages
- Service on Open Ports
- Internal Services (For PrivEsc)
This is the most common attacker vector of outdated version attacks. It could be in the form of an outdated CMS, a web portal for vulnerable systems, a page running on outdated web servers, etc.
Finding Exploits
- Exploit Databases
- GitHub Repos
- Metasploit
Most of the time, you will be able to find the exploit PoC on these databases
- Searchsploit on Kali command line.
- Exploit-DB, Packet Storm,
- CVE databases (like MITRE) are usually not too helpful as they do not directly provide PoCs.
- Although some may link to the blogs & articles that contain PoCs.
Using Exploits
- Fixing Exploits
- Compiling Exploits
- Matching Versions
While the exploits are publicly available, not all of them are ready-to-use without some cleaning and fixing.
- The most common way of “fixing” an exploit is simply to change the source & target IP addresses, modify the exploit URI paths, provide the correct user credentials, etc.
-
Older Python exploits are written in Python2 and should be run with
python2.7instead ofpython3. -
Always remember to with add run permission with
chmod +x <script file>. -
Note that many exploits from Exploit-DB are not polished. On the another hand, GitHub usually have better quality PoCs.
- There can be all sorts of errors, such as incorrect indentations, extra spaces, incorrect spellings, etc. This would require you to have basic knowledge on the programming language to effective debug the exploits.
Misconfigurations
If there are no vulnerable versions, we can then look into misconfigurations in different services. The service itself may not be not vulnerable, but it can be set up incorrectly and unsafely. The definition of misconfiguration here is pretty broad, since it basically covers anything else that are NOT public exploits that can be plugged and played. You can expect all the “hacking techniques” being categorized here.
Key strategies
1
Enumerate Services
Understand what services are running, and their common attack vectors. For example, FTP Server -> Anonymous login? MySQL Service -> UDF code execution? Webpage with File Upload -> Uploading web shell? etc.
2
Finding Misconfigurations
This part requires mostly pattern recognition and experiences gained from grinding boxes and studying existing materials. Not many shortcuts here, but try to look for walkthroughs of boxes with similar services if you are stuck during the exam.
3
Exploiting Misconfigurations
The last step is much easier once you identified the vulnerable service. Some harder boxes may require you to chain multiple misconfigurations and other vulnerabilities, so make sure to take good notes for mapping the final attack path.
Enumerating Services
- Web
- Databases
- Remote Access
Make sure to thoroughly enumerate the web server. Few points to note here:
- Directory Busting:
- Hidden admin panels / Sensitive pages.
- Config files /
.gitDirectory. - Open directory listing.
- Subdomain Enumeration:
- Hidden admin panels / Sensitive pages.
- API Endpoints.
- Webpage & Source code Review:
- Look for potential usernames / emails / credentials on page contents.
- Check HTML source codes (Hard-coded credentials / Developer comments / Hidden endpoints, etc.).
- Understand all functionalities, such as user login, file upload, etc, so that you can focus or skip relevant attack vectors based on the existing functions. Remember to perform directory busting on all the endpoints, including different web ports and subdomains.
- Always use more than 2 directory busting tools and wordlists to avoid missing important endpoints.
- Personally I run FeroxBuster with its default wordlist & DirSearch with
directory-list-2.3-small.txtseparately on the same domain.
- Mail Services
- UDP Ports
- Other External Services
This refers to services such as POP, IMAP and SMTP.
- Check for default & weak credentials like “
admin:admin”.- If that does not work, we will likely get the login credentials from elsewhere, such as web pages, file shares, email servers, etc.
- Even if un-authenticated, try to enumerate usernames from mail services.
- It is also possible that they are designed for client-side attacks such as sending and received phishing emails.
- Active Directory
- Internal Services (For PrivEsc)
For AD environments in OSCP, 90% of the time it is about moving around different services and users by abusing misconfigured user ACL or using discovered credentials. To do so, we must map out all available services, as well as the relationships between the AD objects.
- Bloodhound is the go-to tool for identifying misconfigured user & system ACL.
- Always remember to conduct full port scan on internal targets that are previously unreachable. There can be a MSSQL service running on an uncommon port, and your controlled user may have admin access to the service.
- Password Reuse is extremely common in Active Directory environments. Always try to spray passwords on different services.
Finding & Exploiting Misconfigurations
- Web
- Databases
- Remote Access
This refers to all the basic web hacking stuff, with heavy focus on either getting sensitive information (LFI, File Read, etc), or directly getting system access (Web shell, RCE, etc). Here is a list of common attack vectors:
- Authentication Attacks: Default credentials / Anonymous Login / Weak Passwords
-
Exposed Sensitive Files: Open Directory Listing /
.git/ Hidden admin panels, etc. - SQL injection: Authentication Bypass / File Read & Write / RCE
- File Upload & Write: Web shell RCE / Overwrite Login & Config Files / Client side attacks
- File Read: Credential Files / Config Files / Process & Logs for sensitive information
- Path Traversal / File Inclusion: File Read / RCE
- Mass Assignment: Authentication Bypass
- etc.
- File Upload: Malicious Files for Reverse Shell
- XSS: Hijacking Session Token / Extracting Webpage Information
- CSRF: Sending URL for one-click attack
- etc.
- Mail Services
- UDP Ports
- Other External Services
This refers to services such as POP, IMAP and SMTP.
- Even if un-authenticated, try to enumerate usernames from mail services.
-
Upon successful login, go through all the email records.
- Mainly looking for credentials in emails, such as employee onboarding emails, service reminders, credential updates, etc.
- If client-side attacks are intended, there will be hints in the emails or other places such as the web pages.
- System Misconfigurations
- Active Directory
- Internal Services (For PrivEsc)
This refers to system-level misconfigurations that are not associated with any particular services.
-
Readable / Writable Sensitive Files.
/etc/passwd,/etc/shadow, ExtractableSAM&SYSTEMhives, SSH key files, Readable root / admin directories, etc.
-
Misconfigured / Elevated Privileges.
-
Anything that can elevate privileges, for example:
-
On Linux:
sudo -l, Kernel Exploits, Privileged Group Memberships, etc. -
On Windows,
cmdkey /list,whoami /priv, Kernel Exploits, Registry Exploits, Service Path Misconfigurations, etc.
-
On Linux:
- Note that there are numerous priv-esc techniques that cannot be fully listed here.
-
Anything that can elevate privileges, for example:
Sensitive Information
If none of the above vulnerabilities can be identified after thorough enumeration, it is likely that the weakness lies not on the services nor misconfigurations, but on human errors such as leaked credentials, exposed internal directories, or any type of disclosed sensitive information. This particular attack vector is usually a by-product of enumerating the running services. Sensitive information can be revealed in all sorts of formats, such as error messages when poking around, hidden directories discovered with directory busting, credential files found in file shares, etc. The key here is to always take good notes on all discovery, and to always make sure you have not missed a single detail during enumeration. Remember, enumerate, enumerate, enumerate!
Key strategies
1
Gathering Information
Collect and record whatever you can during the enumeration process. Pay extra attention to things that related to authentication functions, user credentials (names, emails & passwords), error messages, hidden directories and files, and more.
2
Using Information
With the gathered information, we can now put the pieces together. Do we have credentials that we can brute-force or spray? Do the hidden directories and files contain credentials or configurations? The possibilities are endless and would require case-by-case analysis.
Gathering Information
- Web
- Databases
- Remote Access
Make sure to thoroughly enumerate the web server. This will look a lot similar to the previous sections:
-
Directory Busting:
-
Hidden admin panels / Sensitive pages (e.g.,
phpinfo). -
Config files (e.g.,
.htaccess) /.gitDirectory. -
.gitis a gold mine for information. You can get your hands on the application’s source code to identify potential attack vectors (e.g., SQL injections), or there can be hardcoded credentials and session tokens within the source codes. - Open directory listing.
-
Hidden admin panels / Sensitive pages (e.g.,
-
Subdomain Enumeration:
- Sometimes the good stuffs are hidden behind another Vhost. Always run subdomain enumeration and directory busting on the newly discovered subdomains.
-
Webpage & Source code Review:
-
Look for potential usernames / emails / credentials on page contents.
- The About Us & Contacts sections usually contain emails & domain name information.
- For blog-like applications, the blog articles often come with author names and comments with commenter names.
- Some may also put down passwords under the blog posts or comments.
- Check HTML source codes (Hard-coded credentials / Developer comments / Hidden endpoints, etc.).
-
Look for potential usernames / emails / credentials on page contents.
- Mail Services
- UDP Ports
- Other External Services
Emails are often designed to be a realistic scenario of where sensitive information lies:
- Upon successful login, go through all the emails to check if they have mentioned anything about credentials, development site, configurations, etc.
- Even if un-authenticated, try to enumerate usernames from mail services such as POP3 and SMTP (See the example here at HackTricks). The identified usernames can then be passed to other services for brute-forcing / password spraying attacks.
- Active Directory
- Internal Enumeration (For PrivEsc)
For AD environments, we can enumerate sensitive information in many ways, for example:
- Extract valid usernames via anonymous LDAP dumping, SMB RID cycling and running username brute-forcing (with Kerbrute).
- Go through all the readable file shares and databases.
-
Dump domain-level credentials with local administrator privileges.
- Once you escalated your privilege on a domain machine as the local administrator, you will mostly discover new credentials of other domain users, either via dumping them with tools like mimikatz & impacket-secretsdump, or finding them in registry, config files, or any other locations that are previously inaccessible.
Using Information
- Brute-forcing
- Password Spraying
- Other Usages
- Active Directory
Suppose you only found potential usernames. We can always run a quick brute-force login attack to check if this is the intended path.
- Always start out with default & common credentials. It also doesn’t hurt to try username, service name, or box name as passwords
-
As for the password wordlist,
rockyou.txtwill do the job within 10-20 minutes if brute-forcing is the intended attack path.
- For example, some mail services like POP3 and SMTP may be misconfigured to allow username enumeration (See the example here at HackTricks)
-
Some web applications may also be vulnerable to username enumeration due to improper error messages (e.g.,
Username does not exist!) - As mentioned above, we can also brute-force domain usernames from Kerberos running on Port 88 with Kerbrute.
-
I usually use
/usr/share/seclists/Usernames/xato-net-10-million-usernames.txtfrom SecLists. You can runsudo apt install secliststo install SecLists on Kali.
Conclusion
If you read till the end, I sincerely thank you for having the patience to go through my two cents on how to approach the OSCP exam. This is definitely not an exhaustive list, and it may also come across as a bit too exam-oriented. While I understand that real-life hacking involves way more techniques and depths, I truly hope this guide can be a good start to build one’s methodology from scratch. Hopefully what I have learnt along the way had provide some value to your journey, and I am always open to constructive feedbacks for improvements.

