🔐Cryptography
Types of Cryptographic Attacks
Study smarter with Fiveable
Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.
Why This Matters
When you're studying cryptography, understanding attacks isn't just about memorizing a list of threats—it's about grasping why cryptographic systems fail and how attackers exploit weaknesses in design, implementation, and human behavior. You're being tested on your ability to identify vulnerabilities, recommend appropriate countermeasures, and explain the relationship between attack vectors and defensive mechanisms. These concepts appear repeatedly in questions about protocol security, algorithm selection, and system hardening.
The attacks covered here demonstrate fundamental principles: computational complexity limits, information leakage through unintended channels, mathematical properties of cryptographic primitives, and the gap between theoretical security and real-world implementation. Don't just memorize attack names—know what category each belongs to, what it exploits, and what defenses apply. That's what separates surface-level recall from the deeper understanding exam questions demand.
Exhaustive Search Attacks
These attacks work by systematically trying possibilities until finding the right answer. The security of these defenses relies entirely on making the search space too large to explore in practical time.
Brute Force Attack
- Tries every possible key or password until finding the correct one—the most straightforward attack conceptually
- Time complexity grows exponentially with key length; adding one bit doubles the search space
- Mitigated by sufficient key length (128+ bits for symmetric encryption) and account lockout policies for password systems
Dictionary Attack
- Uses pre-compiled lists of common passwords rather than exhaustive enumeration—trades completeness for speed
- Exploits predictable human behavior since users frequently choose words, names, and simple patterns
- Defeated by password salting and policies requiring complexity beyond dictionary terms
Compare: Brute Force vs. Dictionary Attack—both guess credentials, but brute force is exhaustive while dictionary attacks are targeted. On exam questions about password security, dictionary attacks explain why complexity requirements exist, while brute force explains why length matters.
Mathematical and Analytical Attacks
These attacks exploit the mathematical structure of cryptographic algorithms themselves. Success depends on finding patterns or weaknesses in how the algorithm transforms data.
Differential Cryptanalysis
- Analyzes how input differences propagate through encryption rounds to reveal key information
- Particularly effective against block ciphers that lack sufficient diffusion properties
- Modern ciphers like AES are designed with explicit resistance to differential analysis built into their structure
Birthday Attack
- Exploits collision probability in hash functions—finding two inputs with the same output becomes feasible at attempts for an -bit hash
- Named after the birthday paradox where only 23 people give a 50% chance of shared birthdays
- Drives minimum hash length requirements—a 128-bit hash offers only 64 bits of collision resistance
Compare: Differential Cryptanalysis vs. Birthday Attack—both are mathematical attacks, but differential cryptanalysis targets encryption algorithms while birthday attacks target hash functions. Know which primitive each threatens.
Chosen-Input Attacks
These attacks assume the adversary can influence what gets encrypted or decrypted. They model realistic scenarios where attackers interact with cryptographic systems rather than just observing them.
Chosen-Plaintext Attack
- Attacker selects plaintexts and obtains corresponding ciphertexts—models scenarios like encrypted email where you control what gets encrypted
- Reveals patterns in the encryption function that can lead to key recovery or message forgery
- All modern ciphers must resist this; it's considered the baseline threat model for encryption security
Chosen-Ciphertext Attack
- Attacker submits ciphertexts and observes decryption results—even error messages can leak information
- Exploits weaknesses in padding or decryption validation to gradually reveal plaintext or keys
- Padding oracle attacks are a famous real-world example that broke SSL implementations
Compare: Chosen-Plaintext vs. Chosen-Ciphertext—both give attackers control over cryptographic operations, but they target opposite directions. CPA tests encryption security; CCA tests decryption robustness. Secure systems must resist both.
Implementation and Side-Channel Attacks
These attacks target how cryptography is implemented rather than the algorithm itself. Even mathematically perfect algorithms can leak secrets through physical characteristics.
Side-Channel Attack
- Extracts secrets from physical emissions—power consumption, electromagnetic radiation, or acoustic signals during computation
- Bypasses algorithmic security entirely by observing the hardware executing the algorithm
- Requires countermeasures like constant-time code and power analysis resistance in hardware
Timing Attack
- Measures execution time variations to infer information about secret values being processed
- Exploits conditional branches and early exits that create timing differences based on key bits
- Prevented by constant-time implementations where all operations take identical time regardless of input
Compare: Side-Channel vs. Timing Attack—timing attacks are actually a subset of side-channel attacks. Side-channel is the broad category; timing specifically exploits duration. Exam questions may test whether you recognize this relationship.
Protocol and Communication Attacks
These attacks exploit weaknesses in how cryptographic protocols operate over networks. They target the communication process rather than the cryptographic primitives themselves.
Man-in-the-Middle Attack
- Attacker positions between two parties intercepting, reading, and potentially modifying all communications
- Defeats encryption if key exchange is compromised—the attacker establishes separate keys with each party
- Prevented by authenticated key exchange using certificates and protocols like TLS with proper validation
Replay Attack
- Captures and retransmits valid messages to gain unauthorized access or repeat transactions
- Exploits lack of freshness guarantees in protocols that don't verify message uniqueness
- Mitigated by nonces, timestamps, and sequence numbers that make each message unrepeatable
Compare: Man-in-the-Middle vs. Replay Attack—MITM requires active, real-time interception while replay attacks use previously captured data. Both target protocols rather than algorithms, and both are defeated by proper authentication and freshness mechanisms.
Quick Reference Table
| Concept | Best Examples |
|---|---|
| Exhaustive Search | Brute Force, Dictionary Attack |
| Mathematical Analysis | Differential Cryptanalysis, Birthday Attack |
| Chosen-Input Models | Chosen-Plaintext Attack, Chosen-Ciphertext Attack |
| Implementation Flaws | Side-Channel Attack, Timing Attack |
| Protocol Weaknesses | Man-in-the-Middle, Replay Attack |
| Targets Hash Functions | Birthday Attack |
| Targets Block Ciphers | Differential Cryptanalysis, Brute Force |
| Requires Physical Access | Side-Channel Attack |
Self-Check Questions
-
Which two attacks both exploit predictable human behavior in password selection, and how do their search strategies differ?
-
A system uses AES-256 encryption but leaks information through variable processing times. Which attack category does this vulnerability fall under, and why doesn't the strong algorithm prevent it?
-
Compare and contrast Chosen-Plaintext and Chosen-Ciphertext attacks: what capability does each assume the attacker has, and what aspect of the cryptosystem does each primarily threaten?
-
If an exam question describes an attacker capturing authentication tokens and using them hours later to gain access, which attack is being described, and what three countermeasures would prevent it?
-
Why does a 128-bit hash function provide only 64 bits of security against collision attacks? Which attack explains this, and what mathematical principle underlies it?