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

TypeExplanationExample
Passive AttackAttacker only observes dataEavesdropping
Active AttackAttacker alters dataMessage modification

Passive Attacks

  • Eavesdropping
  • Traffic analysis

Difficult to detect

Active Attacks

  • Masquerade
  • Replay attack
  • Data modification

Easy to detect but harmful

Security Services

Security services are measures provided to protect data and communication.

ServicePurpose
ConfidentialityPrevent unauthorized access
IntegrityPrevent data modification
AuthenticationVerify user identity
Non-RepudiationSender cannot deny
AvailabilityEnsure system access

Example: Online banking uses all security services together.

Security Mechanisms

Security mechanisms are tools and techniques used to provide security services.

MechanismDescription
EncryptionConverts data into secret form
Digital SignatureVerifies sender
Access ControlRestricts access
Hash FunctionEnsures integrity
Authentication ProtocolsVerifies 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

TypeExplanation
Caesar CipherFixed shift of letters
MonoalphabeticOne-to-one replacement
PolyalphabeticMultiple 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

BasisSubstitutionTransposition
ChangeLetters replacedLetters rearranged
Letter identityChangesSame
ExampleCaesarRail Fence

Cryptanalysis

Cryptanalysis is the process of breaking encryption to get original data without knowing the key.

Types of Cryptanalysis Attacks

AttackDescription
Brute ForceTry all keys
Cipher Text OnlyOnly encrypted data
Known Plain TextSome original text known
Chosen Plain TextAttacker 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

FeatureCryptographySteganography
Data visibilityEncrypted visibleMessage hidden
PurposeSecure contentHide 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)

FeatureStream CipherBlock Cipher
Data sizeBit/ByteFixed blocks
SpeedFastSlower
SecurityModerateHigh
ExampleRC4AES

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)

BasisConfusionDiffusion
FocusHide key relationshipSpread data
MethodSubstitutionPermutation
GoalKey secrecyPattern 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

FeatureValue
Block size64 bits
Key size56 bits
Rounds16
StructureFeistel

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?

ReasonExplanation
Small key size56-bit key can be cracked
Brute force attackAll keys can be tried
Advanced computersFaster 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

ModeDescription
ECBEach block encrypted separately
CBCEach block depends on previous
CFBConverts block cipher to stream
OFBOutput feedback mode
CTRCounter mode

ECB vs CBC (Very Important)

FeatureECBCBC
SecurityWeakStrong
Pattern hidingNoYes
DependencyIndependentDependent

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

FeatureValue
Key size112 / 168 bits
SecurityHigh
SpeedSlow
UsageBanking, legacy systems

Real-Life Example: Locking a door three times with three locks.

DES vs Triple DES

FeatureDESTriple DES
Key length56 bits112 / 168 bits
SecurityWeakStrong
SpeedFastSlower

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