Today we're doing Shibuya, a VulnLab Hard Machine meant will teach you Kerberos Password Spraying, LDAP Enumeration, SMB Shares enumeration, cracking images & extracting crucial windows database files, Hash spraying over kerberos, hijacking FTP authorized keys, port forwarding, Cross-Session DCOM Relay in order to exploit an active session on the DC, and finallyexploiting ADCs (ESC1)
Reconnaissance
Let's start by checking what TCP Ports are accessible
Only by seeing the open TCP Ports we can already tell we're facing the DC (Domain Controller), we also see a non-regular port when talking about Domain Controllers: TCP 22 (SSH) let's try to enumerate the domain using netexec
This will generate automatically our /etc/hosts configuration as shown:
Now let's run a user enumeration attack in the background on the TCP Port 88 (Kerberos) to fuzz and validate domain users, we'll use the xat-net-10-million-usernames.txt wordlist from SecLists repository
And quickly, some users appear
Let's export these users into a users.txt file, don't forget to add a blank line on the file so in further fuzzing it also tries with NULL passwords and usernames
Now let's try to recon the TCP 445 (SMB) port using netexec with the use of a NULL Session in order to list more shares, users, groups, etc...
But it seems that the service is not accepting NULL sessions as an option
So let's try to use their names as their password as this is the first natural step when finding valid domain users, we'll use netexec for this
Password Spraying
We seem to get two hits when using the -k parameter, now we can try and enumerate shares, users, groups and so on with these users
We get a unusual comment on the svc_autojoin account with a string that is likely a password: K5&A6Dw9d8jrKWhV
We validate it and see that it's correct so let's move on to getting all users written down
We will get a massive amount of users (around 500), so we need to export all these users into a list, we'll use our knowledge on regex to export these into our users.txt file
And here we see that we're facing with exactly 507 users which is definitely a lot
Now let's enumerate shares using the credentials that we found when enumerating users previously
we have access to two non-regular shares: users and images$ but we will enumerate all of them with the use of the spider_plus module inside of netexec what this module does is that it Spiders Shares enumerating all files and content on it on a more fast and automatic way
And the crawl was successfully exported to the spider_plus folder
Here we see a total of 4 interesting files on the images$ share:
I'll be downloading these using netexec again on a new folder called images
We'll use the Thunar file manager to inspect what's inside these compressed files
Dumping hashes locally
The file that stands out most is AWSJPWK0222-02.wim as it contains the SAM file as well as the SYSTEM file, we can dump existent hashes on this using impacket-secretsdump , you need to also do the labour to inspect all of these files in order to see if there's something more important, but in this case I'll tell you beforehand that no
So let's decompress that file and dump these hashes!
We see a total of 5 hashes that we may try
Also there's the Administrator hash, but, this time it wont work (Yeah, I've tried it)
Hash Spraying
We can try to perform a Hash Spraying Attack with these hashes, starting off with the non-default account: operator's hash
After many tries we get a hit as Simon.Watson with the operator's hash 5d8c3d1a20bd63f60f469f6763ca0d50
However the credentials don't seem valid on winrm and neither on ldap
Let's try to access to the SMB service using smbclient.py
Crawling a bit throughout the shares, we see that we can already retrieve the user flag from the simon.watson directory, as we now have access to it
Hijacking SSH authorized_keys
Remember we had access to SSH on the DC? we can hijack this user's authorized_keys in order to access on the system using SSH
On our attacker linux system
On the victim's SMB access
And now if everything went correct we can SSH using the key we generated
BloodHound enumeration
We're in! (finally) now let's try to recollect information onto our bloodhound using the SharpHound.exe collector, but first let's settle up our Bloodhound-Ce
you can download SharpHound it right here:
To make this easier let's use a framework like metasploit in order to transfer files from our host to the target DC first let's craft our payload using msfvenom
Then from our attacker linux machine with a python server let's upload it to the target
Then on the target machine let's download it using curl as it's already pre-installed
Now set up our listener in msf and configure it
Now we can transfer files with no effort on the target
Let's now finally upload our SharpHound.exe using upload and extract all the available information using the command
And then download the generated zip
And in BloodHound we can just ingest it comfortably
But in Simon Watson's outbound object control we don't see anything special
We can try looking for vulnerable certificates using certipy but I'll tell you beforehand it doesn't work
After a lot of enumeration, we see something interesting, in the sessions part we see two active sessions, one being ourselves and the other one being another user: Nigel.Mills
We can also see he's part of a group called T1_ADMINS
Why is this important? Because there's a vulnerability called Cross-Session DCOM Relay Attack which we will see now
Cross-Session DCOM Relay Attack
The presence of Nigel.Mills in the T1_ADMINS group creates a prime exploitation scenario. As a Tier 1 administrator, this user possesses elevated domain privileges, making their session an ideal target for credential theft.
:::note
DCOM, or Distributed Component Object Model, is a Microsoft technology that allows software components to communicate across a network
:::
Attack Execution
We leverage the Cross-Session DCOM Relay technique using RemotePotato0, specifying Nigel's session to precisely target their authentication traffic. The attack workflow proceeds as follows:
Deployment: Execute RemotePotato0 with parameters targeting session 2 (Nigel's session)
Trigger: Force DCOM authentication from Nigel's context to our rogue OXID resolver
Capture: Intercept the NTLMv2 authentication handshake
Relay: Forward captured credentials to gain elevated access
On the attacker's machine we're going to execute the following command which creates a local port forwarder and listens on TCP 135 and forwards all traffic to TCP 8888
And in the victim machine we'll use the exploit pointing to our tun0IP on port 8888
Cracking Nigel's hash
And there we have our stolen NTLMv2 hash, let's crack it using john
And the cracked password it's Sail2Boat3
Exploiting Vulnerable ADCs
Now we see Nigel's outbound objects on BloodHound
We see a new cert called SHIBUYAWEB which is accessible by the T1_ADMINS group, let's try to find vulnerable templates now with the credentials we just managed: nigel.mills:Sail2Boat3 using certipy
But as we can see if we try to execute this command it will lend us an error since there's a firewall blocking our connection, let's use proxychains in order to do this from inside of the network
First, set up our SSHlistener on port 1080
Now let's verify if our proxychains.conf has this port configured also
And we confirm that it is, so now we can repeat our command but pointing at localhost since we're technically inside the network when using proxychains
We see that the ShibuyaWeb template that we saw earlier is vulnerable to 3 ESCs
Let's try to exploit ESC1 as it's the most straight-forward one, so let's request the _admin's UPN specifying his SID
Now we can request it's NT hash using the _admin.pfx we just obtained
And we successfully got the NT hash!!!
Now let's authenticate through Evil-Winrm using this hash and using proxychains to evade the firewall
And with this, the machine is completed, hope you liked it and thank you a lot for reading this writeup!
ESC1 : Enrollee supplies subject and template allows client authentication.
ESC2 : Template can be used for any purpose.
ESC3 : Template has Certificate Request Agent EKU set.