🧪 Labs › Cryptography
Hash Misuse
Severity: MediumHashes used the wrong way — for integrity, for passwords, for tokens — break in predictable ways.
What it is
Hash functions are often misused: a raw hash used as a message authentication code can be length-extended; a fast hash used for passwords is cheap to crack; a truncated or non-constant-time comparison leaks; and 'hash of secret + data' is not a safe signature.
Each misuse has a known break that needs no weakness in the hash itself.
The lesson is that a hash is a building block, not a security control on its own.
How to approach it
- Identify what the hash is standing in for — integrity, authentication, a password store, a token.
- Match the usage to its known failure: length extension for naive MACs, offline cracking for fast password hashing, timing for comparisons.
- Test the specific weakness the usage invites.
- Reason about what forging or recovering the value achieves.
Your task
Exploit the way the application uses a hash to forge or recover a value it relies on.
▶ Access the labOpens your hosted RatCTF instance. Work on it directly — there's nothing to submit here; you'll know when you've solved it.
How to prevent it
- Use HMAC for authentication, a slow memory-hard function (argon2/bcrypt/scrypt) for passwords.
- Compare secrets in constant time; never truncate security-critical hashes.
- Pick the construction that matches the goal — don't improvise with a bare hash.
More Cryptography labs
- Padding Oracle — An app that tells you whether a decryption 'looked right' leaks the plaintext, one byte at a time.
- Weak Keys & Predictable Randomness — A secret that's short, guessable, or generated predictably isn't a secret.
- RSA & Signature Verification Flaws — A signature check that's lenient in the wrong place lets forged data through.