Introduction to security attacks
Introduction to Security Attacks, Services and Mechanisms
A security attack is any attempt to gain unauthorized access, modify, destroy, or steal information.
Real-Life Example: Stealing someone’s ATM PIN by watching them enter it.
Types of Security Attacks
| Type | Explanation | Example |
|---|---|---|
| Passive Attack | Attacker only observes data | Eavesdropping |
| Active Attack | Attacker alters data | Message modification |
Passive Attacks
- Eavesdropping
- Traffic analysis
Active Attacks
- Masquerade
- Replay attack
- Data modification
Security Services
Security services are measures provided to protect data and communication.
| Service | Purpose |
|---|---|
| Confidentiality | Prevent unauthorized access |
| Integrity | Prevent data modification |
| Authentication | Verify user identity |
| Non-Repudiation | Sender cannot deny |
| Availability | Ensure system access |
Example: Online banking uses all security services together.
Security Mechanisms
Security mechanisms are tools and techniques used to provide security services.
| Mechanism | Description |
|---|---|
| Encryption | Converts data into secret form |
| Digital Signature | Verifies sender |
| Access Control | Restricts access |
| Hash Function | Ensures integrity |
| Authentication Protocols | Verifies identity |
Classical Encryption Techniques
Substitution Ciphers
In substitution cipher, each letter of plaintext is replaced by another letter.
Example
Plain Text: HELLO
Cipher Text: KHOOR (Caesar Cipher)
Types of Substitution Cipher
| Type | Explanation |
|---|---|
| Caesar Cipher | Fixed shift of letters |
| Monoalphabetic | One-to-one replacement |
| Polyalphabetic | Multiple alphabets |
Real-Life Example: Replacing real names with code names.
Transposition Ciphers
In transposition cipher, letters are rearranged, not replaced.
Example
Plain Text: HELLO
Cipher Text: ELHOL
Characteristics
- Letters remain same
- Order changes
Real-Life Example: Rearranging letters in a word puzzle.
Difference Between Substitution and Transposition
| Basis | Substitution | Transposition |
|---|---|---|
| Change | Letters replaced | Letters rearranged |
| Letter identity | Changes | Same |
| Example | Caesar | Rail Fence |
Cryptanalysis
Cryptanalysis is the process of breaking encryption to get original data without knowing the key.
Types of Cryptanalysis Attacks
| Attack | Description |
|---|---|
| Brute Force | Try all keys |
| Cipher Text Only | Only encrypted data |
| Known Plain Text | Some original text known |
| Chosen Plain Text | Attacker chooses text |
Real-Life Example: Trying every lock combination until it opens.
Steganography
Steganography hides the existence of a message, unlike cryptography which hides content.
Example: Hiding text inside an image or audio file.
Cryptography vs Steganography
| Feature | Cryptography | Steganography |
|---|---|---|
| Data visibility | Encrypted visible | Message hidden |
| Purpose | Secure content | Hide existence |
Stream and Block Ciphers
Stream Ciphers
Encrypt data bit-by-bit or byte-by-byte.
Example: RC4
Real-Life Example: Typing messages live in WhatsApp.
Features
- Fast
- Low memory usage
- Less error propagation
Block Ciphers
Encrypt data in fixed-size blocks (e.g., 64 or 128 bits).
Example
- AES
- DES
Real-Life Example: Packing items in boxes before shipping.
Features
- More secure
- Slower than stream cipher
Stream Cipher vs Block Cipher (Very Important)
| Feature | Stream Cipher | Block Cipher |
|---|---|---|
| Data size | Bit/Byte | Fixed blocks |
| Speed | Fast | Slower |
| Security | Moderate | High |
| Example | RC4 | AES |
Exam-Ready Summary
- Security attacks threaten data confidentiality and integrity
- Security services protect information
- Classical ciphers include substitution and transposition
- Cryptanalysis breaks encryption
- Steganography hides messages
- Stream ciphers encrypt continuously
- Block ciphers encrypt in blocks
Important Exam Questions
- Explain types of security attacks
- Define substitution and transposition cipher
- What is cryptanalysis?
- Differentiate cryptography and steganography
- Stream cipher vs block cipher
Modern Block Ciphers
A block cipher is an encryption technique that:
- Encrypts data in fixed-size blocks (e.g., 64 or 128 bits)
- Uses the same secret key for encryption and decryption
Real-Life Example: Sending goods in sealed boxes of fixed size instead of loose items.
Principles of Block Ciphers
Block ciphers work using two main principles:
- Substitution
- Permutation
These principles make encryption strong and secure.
Shannon’s Theory of Confusion and Diffusion
Claude Shannon proposed two important concepts for secure encryption.
Confusion
Confusion hides the relationship between plaintext and ciphertext.
How it is achieved?
- Using substitution
- Complex key usage
Real-Life Example: Replacing names with nicknames so outsiders cannot identify people.
Diffusion
Diffusion spreads the influence of one plaintext bit over many ciphertext bits.
How it is achieved?
- Using permutations
- Repeated rounds
Real-Life Example: Mixing sugar in water so it spreads everywhere.
Confusion vs Diffusion (Important)
| Basis | Confusion | Diffusion |
|---|---|---|
| Focus | Hide key relationship | Spread data |
| Method | Substitution | Permutation |
| Goal | Key secrecy | Pattern removal |
Feistel Structure
A Feistel structure is a design model used to build block ciphers like DES.
Working Steps
- Divide data into Left (L) and Right (R) halves
- Apply function on one half
- Combine results
- Swap halves
- Repeat for multiple rounds
Advantages
- Same structure for encryption & decryption
- Efficient and secure
Data Encryption Standard (DES)
DES is a symmetric block cipher developed by IBM.
Key Features of DES
| Feature | Value |
|---|---|
| Block size | 64 bits |
| Key size | 56 bits |
| Rounds | 16 |
| Structure | Feistel |
DES Working (Simple Steps)
- Initial permutation
- 16 Feistel rounds
- Final permutation
Real-Life Example: Locking a suitcase with a numeric combination.
Strength of DES
Why DES Became Weak?
| Reason | Explanation |
|---|---|
| Small key size | 56-bit key can be cracked |
| Brute force attack | All keys can be tried |
| Advanced computers | Faster cracking |
DES is not secure today for sensitive data.
Differential Cryptanalysis
What is Differential Cryptanalysis?
It is a powerful attack technique that:
- Studies differences in plaintext
- Observes changes in ciphertext
- Finds the secret key
Key Point: DES was designed to resist differential cryptanalysis.
Real-Life Example: Observing changes in output when you slightly change input in a machine.
Block Cipher Modes of Operation
Why Modes of Operation?
Block ciphers encrypt only fixed-size blocks, so modes help encrypt large data.
Common Block Cipher Modes
| Mode | Description |
|---|---|
| ECB | Each block encrypted separately |
| CBC | Each block depends on previous |
| CFB | Converts block cipher to stream |
| OFB | Output feedback mode |
| CTR | Counter mode |
ECB vs CBC (Very Important)
| Feature | ECB | CBC |
|---|---|---|
| Security | Weak | Strong |
| Pattern hiding | No | Yes |
| Dependency | Independent | Dependent |
Triple DES (3DES)
What is Triple DES?
Triple DES improves DES security by applying DES three times.
Encryption Formula: E(K1) → D(K2) → E(K3)
Features of Triple DES
| Feature | Value |
|---|---|
| Key size | 112 / 168 bits |
| Security | High |
| Speed | Slow |
| Usage | Banking, legacy systems |
Real-Life Example: Locking a door three times with three locks.
DES vs Triple DES
| Feature | DES | Triple DES |
|---|---|---|
| Key length | 56 bits | 112 / 168 bits |
| Security | Weak | Strong |
| Speed | Fast | Slower |
Exam-Ready Summary
- Block ciphers encrypt data in fixed blocks
- Confusion hides key relation
- Diffusion spreads plaintext influence
- Feistel structure forms DES
- DES uses 56-bit key and 16 rounds
- Differential cryptanalysis breaks weak designs
- Modes of operation secure large data
- Triple DES improves DES security
Important Exam Questions
- Explain confusion and diffusion
- Describe Feistel structure
- Explain DES with diagram
- What is differential cryptanalysis?
- Explain block cipher modes
- Compare DES and Triple DES