312-50 ยท Cryptography
Cryptanalysis and attack countermeasures
Brute force, known-plaintext, chosen-plaintext, birthday, side-channel, man-in-the-middle, padding oracle, downgrade attacks, and defenses.
Key points
- Attack (defence):
- Brute force: every key (long keys, key stretching).
- Known- and chosen-plaintext: plaintext-ciphertext pairs.
- Birthday: hash collisions in about 2^(n/2) work (longer digests).
- Side-channel: timing, power or cache leaks.
- Man-in-the-middle (certificate validation, pinning).
- Padding oracle: distinguishable decryption errors (authenticated encryption).
- Downgrade: weaker protocol versions (disable legacy protocols).
Practice questions
What does a padding oracle attack exploit?
- Distinguishable error responses about padding during decryption
- Weak physical locks on the server room
- Short passwords chosen by users
- Expired root certificates
Show answer
Answer: A. Distinguishable error responses about padding during decryption
A padding oracle attack learns plaintext from whether the server reports a padding error versus another error. Authenticated encryption and uniform errors remove the oracle.
Which measures make brute-force attacks on password-derived keys harder?
- Long, high-entropy passphrases
- Key stretching such as PBKDF2 with many iterations
- Shortening the key to speed up encryption
- Using the same salt for every user and hiding nothing
- Disabling any limit on login attempts
Show answer
Answer: A. Long, high-entropy passphrases, B. Key stretching such as PBKDF2 with many iterations
Longer, high-entropy passwords and slow key derivation with many iterations (PBKDF2) raise the cost per guess. Publishing the salt does no harm but is not a defence, and shorter keys make things easier for the attacker.
True or false: finding a collision in an n-bit hash by a birthday attack takes about 2^n operations.
Show answer
Answer: False
The birthday paradox reduces the effort to roughly 2^(n/2), which is why a 128-bit hash offers only about 64 bits of collision resistance.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
