OSCP Last Minute Tips
Introduction
If you're looking for a more detailed methodology for navigating OSCP boxes, check this out. The tips here are some quick tricks to try when you are running out of ideas.

General Tips (Applicable to all OS)
Initial Foothold
Initial Scans & Enum:
Scans can sometimes return false positives or missing ports due to different reasons.
Revert all the machines at the start of the exam.
Revert & rescan the machines midway through your exam, especially when you cannot find a way through.
Shells & Connections:
Always prioritize using open ports on the target machine for listening to reverse shells (i.e., the listening port on our Kali when running netcat
listener.)
Open ports on the target machine are more likely to have exceptions for inbound & outbound connections.
Alternatively, try common ports: 21, 22, 139, 445, 80, 443, 3389, etc.
Port 4444 is usually blocked for security reasons.
File Shares:
When there is a file share (e.g., SMB / FTP) and a web server running together on the machine, always check if the web server hosted under the file share's directory. If that's the case, check if we can:
Upload a web shell to the file share, and trigger it via the web page.
Read sensitive config files and look for credentials to access the web page.
Web Services:
Here are all my directory busting tips and tricks:
Try 2 or more different directory busting tools, as well as wordlists. Personally I use
FeroxBuster
andDirSearch
, with/usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt
,directory-list-2.3-medium.txt
anddirectory-list-2.3-big.txt
.Always do recursive directory busting.
FeroxBuster
does this by default, but it can be slow sometimes.
Try add file extensions (e.g.,
.pdf
,.php
, etc.) if the initial busting returns nothing.For example,
/index
may returns 404, but/index.php
may returns 200.
Try add box name / service name / username as the first directory.
For example, if you suspect WordPress is running on the web server, but you can't find anything, try do directory busting with this base URL instead:
example.com/wordpress/
.
For Directory-like results that do not show as "Open Directory Listing " (e.g.,
example.com/test/
), always try visit the URL anyway, as some pages are configured with hidden index pages.
Don't just spam 'OR 1=1 -- //
for potential SQL injections, as SQLi is not always about authentication bypass. Here are a few SQL injections tips & tricks:
Using
'
is the most common way to test for error-based SQL injections. However, don't miss out on Blind SQLi (with sleep /delay functions).If SQL injection is possible, try the following items:
Authentication Bypass
Remote Code Execution
Dumping Database Info
System File Read / File Write
Pay attention to the SQL service in use, as different SQL services have different syntaxes.
For example, commenting out is
-- -
in MSSQL, but-- //
in MySQL.
Try switching between different HTTP request methods (e.g., GET
/ POST
) to see if the server responds differently. Detailed error messages may return, etc.
Try changing a
GET
request to aPOST
request, and vice versa.Supply some random parameter values (e.g.,
GET /index.php?test=123
) to check if the server responds with hints on the correct parameters.
Databases:
Always check if the SQL service allows file read / write. Follow the same tips on exploiting file read & write in the Web Service section.
For MSSQL:
SELECT * FROM OPENROWSET(BULK N'C:/Windows/System32/drivers/etc/hosts', SINGLE_CLOB) AS Contents
sp_configure 'show advanced options', 1; RECONFIGURE; sp_configure 'Ole Automation Procedures', 1; RECONFIGURE
Requires Admin Privilege.
For MySQL:
SELECT LOAD_FILE("/etc/passwd");
SELECT "<?php echo shell_exec($_GET['cmd']);?>" INTO OUTFILE '/var/www/html/webshell.php';
Login & Password Attacks:
Always try default or weak credentials - admin / admin
, admin / password
, you name it. These are easy quick wins and should always be tried first before doing any hard work.
Google the service name & version + default credentials.
Try
admin:admin
and all those similar stuff.
Public Exploits:
When in doubt, revert the machine.
Sometimes our previous exploitation attempts may have caused unexpected behaviours in the target machine.
I once tried to set up some port-forwarding rules on the machine to run an exploit, but I was using the wrong exploit, so the attack did not work. I later found and ran the correct exploit, but it was not working as intended, likely due to the previous port-forwarding attempts. Reverting the machine solved the issue.
For some vulnerabilities, there may be multiple available exploits online. I always recommend to try out the simpler ones first, as the more complex ones can be much more difficult to debug.
Even when the simpler ones do not work for the first time, I would go through the exploit codes to make sure I am not making mistakes in supplying the arguments, haven't clean up the exploit codes, etc.
There may also be multiple exploits on the same attack vector. For example, a particular version of a CMS can have both a File Read vulnerability and an Authentication Bypass vulnerability. It will never be a bad idea to try both, but it is better to try understanding what exactly are we looking for in the attack.
Privilege Escalation
Initial Scans & Enum:
Always run multiple different enumeration scripts when stuck.
For example, I always run
WinPEAS
,PowerUp.ps1
, andjaws-enum.ps1
on a Windows target, as each of them has a different way of presenting their output, and they sometimes use different methods in checking the same vulnerabilities.This also helps to filter out potential false positives.
Services:
Don't sleep on the service version when performing privilege escalations. The attack path could be to exploit an outdated and vulnerable internal application with publicly available exploits.
You can check them either by interacting with the binary in CLI (e.g., adding
-h
), or running the application in GUI and check the about section.
Login & Password Attacks:
SSH keys can be sprayed both externally and internally.
Some SSH keys may be configured to only work in the internal network, or even in the local machine (127.0.0.1). If spraying them externally does not return anything, try to spray them again internally. For example, run this command on the target machine:
ssh root@127.0.0.1 -i id_rsa
Sensitive Information:
Always enumerate config files for more credentials, even after you obtained an initial shell.
Say if you uploaded a web shell and has successfully obtained a shell as
www-root
. We should always go back to the web server directory and go through all the readable config files to look for hard-coded credentials. In many cases, we may find database connection credentials that were previously unknown to us.As password reuse is very common, we can try to use the obtained credentials as is, or we can also spray the password to other usernames to see if different users share the same password.
Pivoting:
Quite often the attack path can involve lateral movements between multiple users, before reaching the final root account. So if you see more than one users in under the /home
or c:\users
directory, there is a high likelihood that several lateral movements are needed.
Let's say you obtained a shell as
www-data
. It is possible that you cannot escalate to root directly fromwww-data
, but instead have to find a password in the web config file, spray that password on a local userjohn
, then you exploit an internal service asjohn
to gain access to another userpeter
, and finally escalate to root bysudo
withpeter
.
Linux-specific Tips
Privilege Escalation
Services & Processes:
Run strings
& strace
on suspicious binaries.
This may reveal plaintext passwords, commands, other executables being called, potential Shared Objection injection, etc.
Sensitive Information:
Don't forget to run the alias
command to check what command alias were set.
In realistic scenarios, system administrators may have created command alias for commonly used commands, and some of these commands may contain user credentials.
Group Membership:
Group Membership can be a privilege escalation vector if our user belongs to some of the privileged groups. Also check if other users are in these interesting groups, as they may be the target for lateral movements.
Common privileged groups on Linux:
LXC / LXD (Abusing Container Privileges)
Docker (Abusing Container Privileges)
Disk (Full File Read & Write Privileges)
ADM (Privileges to Read Logs)
Scheduled Tasks / Cron Jobs:
Pspy is the best tool to monitor all processes and potential cronjobs on a Linux machine.
We can monitor all live running processes without needing root privileges. This is extremely useful for detecting cronjobs that runs in a fixed interval (e.g., 1 minute),
This is especially useful when we do not have access to crontab, or crontab is not showing anything but we suspect there are cronjobs.
Windows-specific Tips
Initial Foothold
Client-side Attack:
Suppose this is the intended attack path, there should be hints on locations and areas that users may visit and interact with.
For example, there may be a feedback form with a note saying that the administrator will go through all of the comments.
Alternatively, it is also possible that we can force an NTLM theft without needing the user to react to our payloads. Try to look for user input areas where we can direct the connection towards our controlled SMB server, for examples:
xp_dirtree
in MSSQL.File Inclusion that allows visiting an SMB share.
A function that will visit any URLs (including SMB URIs).
Shells & Connections:
When running a Windows reverse Shells, always use the PowerShell Base64 payload, as it has the highest success rate.
Since the payload is Base64 encoded, it has the lowest risk of being corrupted midway during transmission.
Privilege Escalation
Kernel Exploits:
If we are certain that the kernel is vulnerable, we should always try to run a few different applicable exploits, since not all of them may work due to multiple reasons.
Group Memberships:
Sometimes we may have compromised a LOCAL SERVICE
or NETWORK SERVICE
account, but its privileges were missing. This is because the account may be configured to be running with a restricted sets of privileges.
It is possible to recover its permissions by creating a scheduled task. The new process created by the
Task Scheduler Service
will have all the default privileges of the associated user account.
Last updated