Hashes, MACs & KDFs
Tip
Apprenez et pratiquez le hacking AWS :
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP :HackTricks Training GCP Red Team Expert (GRTE)
Apprenez et pratiquez le hacking Azure :
HackTricks Training Azure Red Team Expert (AzRTE)
Soutenir HackTricks
- Vérifiez les plans d’abonnement !
- Rejoignez le 💬 groupe Discord ou le groupe telegram ou suivez-nous sur Twitter 🐦 @hacktricks_live.
- Partagez des astuces de hacking en soumettant des PR au HackTricks et HackTricks Cloud dépôts github.
Common CTF patterns
- “Signature” est en fait
hash(secret || message)→ length extension. - Unsalted password hashes → trivial cracking / lookup.
- Confusing hash with MAC (hash != authentication).
Hash length extension attack
Technique
Vous pouvez souvent exploiter cela si un serveur calcule une “signature” comme :
sig = HASH(secret || message)
et utilise un hash de type Merkle–Damgård (exemples classiques : MD5, SHA-1, SHA-256).
Si vous connaissez :
messagesig- hash function
- (or can brute-force)
len(secret)
Alors vous pouvez calculer une signature valide pour :
message || padding || appended_data
sans connaître le secret.
Limite importante : HMAC n’est pas affecté
Les length extension attacks s’appliquent aux constructions comme HASH(secret || message) pour les Merkle–Damgård hashes. Elles ne s’appliquent pas à HMAC (e.g., HMAC-SHA256), qui est spécifiquement conçu pour éviter cette classe de problèmes.
Outils
- hash_extender: GitHub - iagox86/hash_extender
- hashpump: https://github.com/bwall/HashPump
Bonne explication
https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks
Password hashing and cracking
Premières questions
- Is it salted? (look for
salt$hashformats) - Is it a fast hash (MD5/SHA1/SHA256) or a slow KDF (bcrypt/scrypt/argon2/PBKDF2)?
- Do you have a format hint (hashcat mode / John format)?
Workflow pratique
- Identifier le hash :
hashid <hash>hashcat --example-hashes | rg -n "<pattern>"
- If unsalted and common: try online DBs and identification tooling from the crypto workflow section.
- Otherwise crack:
hashcat -m <mode> -a 0 hashes.txt wordlist.txtjohn --wordlist=wordlist.txt --format=<fmt> hashes.txt
Erreurs courantes exploitables
- Same password reused across users → crack one, pivot.
- Truncated hashes / custom transforms → normalize and retry.
- Weak KDF parameters (e.g., low PBKDF2 iterations) → still crackable.
Tip
Apprenez et pratiquez le hacking AWS :
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP :HackTricks Training GCP Red Team Expert (GRTE)
Apprenez et pratiquez le hacking Azure :
HackTricks Training Azure Red Team Expert (AzRTE)
Soutenir HackTricks
- Vérifiez les plans d’abonnement !
- Rejoignez le 💬 groupe Discord ou le groupe telegram ou suivez-nous sur Twitter 🐦 @hacktricks_live.
- Partagez des astuces de hacking en soumettant des PR au HackTricks et HackTricks Cloud dépôts github.
HackTricks

