Cryptography · Topic 3 of 3
Cryptography Tools, Cryptanalysis and Countermeasures
Learn common cryptography tools, cryptanalysis methods such as known plaintext, brute force and side channel, famous crypto flaws, and the countermeasures.
- 5 min
- Brute force is defeated by long keys, rainbow tables by salting.
- Known plaintext, chosen plaintext and ciphertext only describe what the attacker holds.
- Linear and differential cryptanalysis are mathematical attacks on block ciphers.
What it is
Cryptography tools apply hashing and encryption: calculators, file and message encryptors, and general toolkits. Cryptanalysis is the study of breaking cryptography without knowing the key, or finding weaknesses in how it is used. Countermeasures are the choices that keep a system safe from such attacks.
The exam asks you to match a tool to its use, name an attack from its description, and select the control that stops it.
How it works
Cryptography tools
| Tool | Purpose |
|---|---|
| OpenSSL | Toolkit for TLS, certificates, hashing and encryption |
| GnuPG | Encrypts and signs files and email with OpenPGP |
| VeraCrypt | Encrypted volumes and disks |
| HashCalc and MD5 Calculator | Calculate hashes to check file integrity |
| CryptoForge and Advanced Encryption Package | File and folder encryption |
| BCTextEncoder | Encrypts text snippets |
| CrypTool | Educational tool to learn and test classical and modern ciphers |
| Hashcat and John the Ripper | Recover passwords from hashes |
| Ophcrack and RainbowCrack | Use precomputed rainbow tables |
Cryptanalysis methods
By what the attacker has:
| Attack | Attacker has |
|---|---|
| Ciphertext only | Only encrypted data |
| Known plaintext | Some matching plaintext and ciphertext pairs |
| Chosen plaintext | Can have chosen plaintext encrypted |
| Chosen ciphertext | Can have chosen ciphertext decrypted |
| Adaptive chosen plaintext | Chooses plaintext in rounds, using earlier results |
By technique:
| Technique | Idea |
|---|---|
| Brute force | Try every possible key. Defeated by long keys. |
| Dictionary attack | Try likely passwords from a list |
| Rainbow table | Precomputed hash lookups. Defeated by salting. |
| Birthday attack | Exploits the chance of two inputs sharing a hash (a collision). Shows why hashes need enough output bits. |
| Meet in the middle | Attacks a double encryption by working from both ends, which is why 2DES gave little gain |
| Differential cryptanalysis | Studies how differences in input affect differences in output |
| Linear cryptanalysis | Uses linear approximations of the cipher with known plaintext |
| Integral cryptanalysis | Studies sets of inputs and how the sum of outputs behaves |
| Side channel attack | Measures timing, power use, sound or electromagnetic output to learn the key |
| Fault injection | Induces errors in hardware to leak secrets |
| Related key attack | Uses ciphers run with keys that have a known relationship |
| Rubber hose and social engineering | Obtains the key from people instead of from the math |
Known flaws in practice
| Name | Weakness |
|---|---|
| Heartbleed | A bug in an OpenSSL extension let attackers read server memory, which could expose keys and data |
| POODLE | A padding weakness in SSL 3.0 that allowed decryption of data after a forced downgrade |
| DROWN | Used servers that still supported SSLv2 to attack TLS sessions |
| FREAK and Logjam | Forced use of weak export grade cryptography |
| BEAST | Attack on TLS 1.0 CBC mode |
| Padding oracle | Error messages about padding reveal plaintext, in CBC mode designs |
| Hash collision (MD5, SHA-1) | Two different inputs give the same hash, which breaks signatures and integrity checks |
Countermeasures
- Use current, public algorithms: AES with 128 or 256 bit keys, SHA-2 or SHA-3, RSA with at least 2048 bits, or ECC.
- Retire DES, 3DES, RC4, MD5 and SHA-1 for security uses.
- Disable SSL 2.0, SSL 3.0, TLS 1.0 and TLS 1.1, and use TLS 1.2 or 1.3 only.
- Prefer cipher suites with forward secrecy (ephemeral key exchange), so that one stolen key cannot decrypt past traffic.
- Salt and hash passwords with a slow, purpose built function such as bcrypt, scrypt or PBKDF2 instead of a fast hash.
- Protect keys with a hardware security module (HSM) or key management service, rotate them and never hard code them.
- Use a trusted random number generator.
- Write code that runs in constant time, and shield hardware against side channels.
- Patch crypto libraries promptly, and test them with configuration scanners.
- Use HTTP Strict Transport Security (HSTS) and valid certificates.
A worked example
A site stores user passwords as unsalted MD5 hashes. After a breach, the attacker looks up the hashes in a rainbow table and recovers many passwords within minutes.
The fix has three parts: replace MD5 with a slow hash such as bcrypt, add a unique salt to each password, and require users to reset. Longer passphrases and multi-factor authentication limit further damage.
How the exam asks about this
- "Which attack uses precomputed hash tables, and what defeats it?" → Rainbow table attack, defeated by salting.
- "Which attack measures power use or timing to find a key?" → A side channel attack.
- "In which attack does the attacker have both the plaintext and the ciphertext?" → Known plaintext.
What to remember for the exam
- Brute force is defeated by long keys, rainbow tables by salting.
- Known plaintext, chosen plaintext and ciphertext only describe what the attacker holds.
- Linear and differential cryptanalysis are mathematical attacks on block ciphers.
- Heartbleed leaked server memory, and POODLE hit SSL 3.0.
- Forward secrecy, strong keys, modern TLS and key protection are the core fixes.
A strong algorithm does not save a weak implementation. Many named attacks are about poor configuration, bad padding handling or leaking side channels.
Common mistakes
Mixing a dictionary attack with a rainbow table. A dictionary attack hashes guesses live, and a rainbow table looks up precomputed results.
Assuming longer keys fix every flaw. They defeat brute force but not implementation bugs.
Using a fast hash for passwords. Speed helps the attacker, so use a deliberately slow function.
Check yourself
What makes a rainbow table attack fail?
Unique salts per password, because precomputed tables no longer match.
What is forward secrecy?
A property where session keys are not derived from a long term key, so stealing it later cannot decrypt past sessions.
What was Heartbleed?
An OpenSSL bug that let attackers read memory from a server, potentially exposing keys and data.
Topic 3 of 3 in Cryptography
Test yourself on Cryptography
The full EC-Council 312-50 question bank has 1,000 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by EC-Council. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.