T1110.002

Crackeo de contraseñas

Subtécnica de T1110 Fuerza bruta ↗

Recuperar la contraseña de un hash probando diccionarios y reglas offline.

Cómo aparece en Hack The Box

rockyou.txt basta en casi todo HTB. Identifica bien el modo de hashcat y, para ficheros (zip, SSH, KeePass), conviértelos antes con la herramienta *2john.

Técnicas de nuestro catálogo que corresponden a esta (el número son sus máquinas):

Máquinas para practicarla

Ordenadas de más fácil a más difícil. El enlace ▶ te lleva al minuto del vídeo de IppSec donde se usa.

Se muestran 48 de 101. Entra en cada técnica del catálogo de arriba para verlas todas.

Guías

Comandos

Sacados de nuestras chuletas y fichas de herramientas. Escribe tus datos y se rellenan en todos los comandos.

Tus datos Se guardan en este navegador y se aplican a todas las chuletas.

Analizador de JWT › Ataques

hashcat
hashcat -m 16500 jwt.txt /usr/share/wordlists/rockyou.txt
John the Ripper
john --format=HMAC-SHA256 --wordlist=/usr/share/wordlists/rockyou.txt jwt.txt

Escalada en Windows y Active Directory › Active Directory

AS-REP roasting
impacket-GetNPUsers box.htb/ -usersfile usuarios.txt -no-pass -dc-ip 10.10.11.20 -format hashcat

Crackea con hashcat -m 18200.

Active Directory a fondo › Impacket

AS-REP roasting Atacante
impacket-GetNPUsers box.htb/usuario:'Password123!' -dc-ip 10.10.11.20 -request -format hashcat -outputfile asrep.txt

hashcat -m 18200

Identificador de hashes › Crackeo

Diccionario
hashcat -m 0 hash.txt /usr/share/wordlists/rockyou.txt
Diccionario con reglas
hashcat -m 0 hash.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule
Ver la contraseña ya crackeada
hashcat -m 0 hash.txt --show
Que hashcat adivine el tipo
hashcat hash.txt --identify
Diccionario
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
Ver resultados
john --show hash.txt
Unir passwd y shadow
unshadow passwd shadow > hashes.txt
Extraer hashes de ficheros
zip2john backup.zip > hash.txt
ssh2john id_rsa > hash.txt
keepass2john Database.kdbx > hash.txt
office2john informe.docx > hash.txt
pdf2john documento.pdf > hash.txt

Hashcat › Modos más usados

NTLM (hash NT de Windows)
hashcat -m 1000 hash.txt /usr/share/wordlists/rockyou.txt
NetNTLMv2 (Responder)
hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt
Kerberoasting (TGS-REP RC4)
hashcat -m 13100 kerberoast.txt /usr/share/wordlists/rockyou.txt
AS-REP roasting
hashcat -m 18200 asrep.txt /usr/share/wordlists/rockyou.txt
sha512crypt ($6$, /etc/shadow)
hashcat -m 1800 hash.txt /usr/share/wordlists/rockyou.txt
bcrypt ($2y$, webs en PHP)
hashcat -m 3200 hash.txt /usr/share/wordlists/rockyou.txt

Hashcat › Ataques

Máscara (Mayúscula, minúsculas y 4 cifras)
hashcat -m 0 hash.txt -a 3 '?u?l?l?l?l?d?d?d?d'
Hashes con usuario delante (usuario:hash)
hashcat -m 1000 --username hashes.txt /usr/share/wordlists/rockyou.txt

John the Ripper › Más formatos

Forzar el formato
john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
Buscar el nombre de un formato
john --list=formats | tr "," "\n" | grep -i krb
Certificado .pfx, PDF, Office y GPG
pfx2john cert.pfx > hash.txt
pdf2john doc.pdf > hash.txt
office2john doc.docx > hash.txt
gpg2john clave.asc > hash.txt

Responder › Capturar hashes

Crackear el NetNTLMv2 capturado
hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt

Rubeus › Roasting

AS-REP roasting Víctima
.\Rubeus.exe asreproast /format:hashcat /outfile:asrep.txt

Herramientas

Chuletas relacionadas