Skip to content
Unit 4 Syllabus Note· Introduction to Cyber Security

Introduction to Cyber Security

Comprehensive exam revision notes for BCA-431E Unit 4 (Security Countermeasures, Firewalls & Cryptography). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.

Introduction to Cyber Security

Security Countermeasures, Firewalls & Cryptography

Core Definitions & Key Concepts

What is Cryptography and what are its two primary branches

Cryptography is the science of securing communication through mathematical encryption techniques. The two branches are Symmetric Key Cryptography (single shared secret key) and Asymmetric Key Cryptography (public-private key pair).

Symmetric and Asymmetric Encryption

FeatureSymmetric Encryption (AES, DES)Asymmetric Encryption (RSA, ECC)
Key CountSingle shared secret keyTwo mathematically linked keys (Public & Private)
Execution SpeedExtremely fast (hardware accelerated)Slower (complex modular exponentiation)
Key DistributionHigh risk (must share secret key safely)Easy (public key is openly distributed)
Primary UseBulk data-at-rest & payload encryptionKey exchange, digital signatures, authentication

What is a Cryptographic Hash Function? Name three properties

A mathematical algorithm that maps arbitrary-length data to a fixed-size bit string (digest). Properties: 1. Pre-image resistance (one-way), 2. Second pre-image resistance (weak collision), 3. Collision resistance (hard to find two distinct inputs with identical hash).

The working of a Digital Signature

The sender hashes the message to produce a digest and encrypts the digest with their Private Key. The recipient decrypts the signature using the sender's Public Key and compares it with their computed hash. Ensures authenticity, integrity, and non-repudiation.

What is a Firewall and where is it deployed

A network security device/software that monitors and controls incoming and outgoing network traffic based on predetermined security rules, positioned at the perimeter boundary between trusted internal LAN and untrusted public internet.

Compare Packet-Filtering Firewalls and Stateful Inspection Firewalls

  • Packet-Filtering (Stateless): Inspects individual packets in isolation based on static rules (source/dest IP, port, protocol) without tracking connection state.
  • Stateful Inspection: Tracks active TCP/UDP connection states in a state table, verifying whether incoming packets belong to established, legitimate flows.

What is an Application-Level Gateway (Proxy Firewall)

A firewall operating at the Application Layer (Layer 7) that acts as an intermediary, inspecting full payload contents, HTTP headers, and URL paths before forwarding requests.

An IDS and an IPS

  • IDS (Intrusion Detection System): Passive monitoring sensor that detects suspicious activity and raises security alerts without stopping traffic.
  • IPS (Intrusion Prevention System): Active in-line device that detects attacks and immediately blocks/drops malicious packets in real-time.

What is Signature-Based Detection vs Anomaly-Based Detection in IDS

  • Signature-Based: Compares traffic against a database of known attack byte patterns (fast, high accuracy, but blind to zero-days).
  • Anomaly-Based: Establishes a baseline of normal network behavior and flags statistical deviations (detects zero-days, but higher false-positive rate).

What is a Demilitarized Zone (DMZ) in network architecture

A physical or logical subnetwork that contains and exposes an organization's external-facing services (web, mail, DNS) to an untrusted network, while isolating the private internal corporate network behind an interior firewall.

Conceptual & Architectural Analysis

The RSA Public Key Algorithm Mathematical Steps

RSA Algorithm Formulation (Rivest, Shamir, Adleman 1977)

  1. Select two large distinct prime numbers p and q.
  2. Compute modulus n = p \cdot q.
  3. Compute Euler's totient: \phi(n) = (p - 1)(q - 1).
  4. Choose public exponent e such that 1 < e < \phi(n) and \gcd(e, \phi(n)) = 1.
  5. Compute private exponent d such that d \cdot e \equiv 1 \pmod{\phi(n)} (modular multiplicative inverse).
  6. Public Key: (e, n), Private Key: (d, n).
  • Encryption: C = M^e \pmod n
  • Decryption: M = C^d \pmod n

The Advanced Encryption Standard (AES) Architecture

AES is an iterative symmetric block cipher operating on 128-bit blocks with key sizes 128, 192, or 256 bits:

  • Rounds: 10 rounds (128-bit), 12 rounds (192-bit), 14 rounds (256-bit).
  • 4 Core Transformations per Round:
  1. SubBytes: Non-linear byte substitution using Rijndael S-Box.
  2. ShiftRows: Cyclically shifting rows of the state array.
  3. MixColumns: Matrix multiplication over Galois Field GF(2^8).
  4. AddRoundKey: Bitwise XOR with round subkey.

Network Perimeter Architecture with DMZ and Dual Firewalls

System Architecture / Concept DiagramHorizontal Scroll Enabled
[ INTERNET ]
     |
     v
[ External Firewall ]
     |
     +---> [ DMZ Subnet: Public Web Server, DNS Server, Mail Proxy ]
     |
     v
[ Internal Firewall ]
     |
     +---> [ Internal LAN: Active Directory, Database, Core Enterprise ]
  • If an external attacker compromises the Web Server in the DMZ, the interior firewall prevents direct traversal into confidential backend databases.

Compare Network IDS (NIDS) vs Host IDS (HIDS)

AttributeNetwork IDS (NIDS)Host IDS (HIDS)
DeploymentPromiscuous tap on core network switchesInstalled directly on individual servers/endpoints
VisibilityAnalyzes full network packet streamsInspects local system logs, file integrity, API calls
Encrypted TrafficCannot inspect encrypted TLS/HTTPS packetsCan inspect decrypted data in system memory
PerformanceZero impact on host CPU/RAMConsumes host system resources

Diffie-Hellman Key Exchange and the Man-in-the-Middle Vulnerability

Diffie-Hellman enables two parties to negotiate a shared secret over an insecure channel without transmitting the secret:

  • Based on the discrete logarithm problem in modular arithmetic: A = g^a \pmod p, B = g^b \pmod p.
  • Shared Secret: K = B^a \pmod p = A^b \pmod p.
  • Vulnerability: Unauthenticated! An active attacker can intercept A and B, establishing separate DH sessions with both parties (solved via digital certificates in TLS).

In-Depth Analysis & Implementation

Trace the Complete RSA Public Key Encryption and Decryption with a Full Numerical Problem

Step-by-Step RSA Numerical Proof

Step 1: Prime Selection

Let prime p = 7, and prime q = 11.

Step 2: Compute Modulus n

$n = p × q = 7 × 11 = \mathbf{77}$

Step 3: Compute Euler's Totient \phi(n)

$\phi(n) = (p - 1)(q - 1) = (7 - 1)(11 - 1) = 6 × 10 = \mathbf{60}$

Step 4: Choose Public Encryption Exponent e

Find e coprime to 60 (\gcd(e, 60) = 1): Choose \mathbf{e = 7} (since \gcd(7, 60) = 1).

Step 5: Compute Private Decryption Exponent d

Find d such that d × e \equiv 1 \pmod{\phi(n)} \implies 7d \equiv 1 \pmod{60}: $7d = 60k + 1$

  • For k = 1: 61 / 7 (not integer)
  • For k = 2: 121 / 7 (not integer)
  • For k = 3: 181 / 7 (not integer)
  • For k = 4: 241 / 7 (not integer)
  • For k = 5: 301 / 7 = \mathbf{43}!

$\mathbf{d = 43}$

  • Public Key: (e=7, n=77)
  • Private Key: (d=43, n=77)

Step 6: Encryption Operation

Let plaintext message M = 9: $C = M^e \pmod n = 9^7 \pmod{77}$ Using modular exponentiation:

  • 9^1 = 9
  • 9^2 = 81 \equiv 4 \pmod{77}
  • 9^4 = 4^2 = 16 \pmod{77}
  • 9^7 = 9^4 × 9^2 × 9^1 = 16 × 4 × 9 = 64 × 9 = 576 \pmod{77}
  • 576 = 77 × 7 + 37 \implies \mathbf{C = 37}

Ciphertext transmitted across network is 37.

Step 7: Decryption Operation

$M = C^d \pmod n = 37^{43} \pmod{77} Decompose 43 = 32 + 8 + 2 + 1$:

  • 37^1 \equiv 37 \pmod{77}
  • 37^2 = 1369 \equiv 60 \pmod{77}
  • 37^4 = 60^2 = 3600 \equiv 58 \pmod{77}
  • 37^8 = 58^2 = 3364 \equiv 53 \pmod{77}
  • 37^{16} = 53^2 = 2809 \equiv 37 \pmod{77}
  • 37^{32} = 37^2 = 1369 \equiv 60 \pmod{77}

Multiply components: $M = 37^{32} × 37^8 × 37^2 × 37^1 \pmod{77} M = (60 × 53 × 60 × 37) \pmod{77}$

  • 60 × 53 = 3180 \equiv 23 \pmod{77}
  • 60 × 37 = 2220 \equiv 64 \pmod{77}
  • 23 × 64 = 1472 = 77 × 19 + 9 \implies \mathbf{M = 9}!

Decryption successfully restored the original message $M = 9$!

Firewall Generations and Deep Packet Inspection (DPI) with Packet Filtering iptables Architecture

Firewall Architectural Evolution

CODE
1Generation 1: Packet Filtering (L3/L4 - IP/Port Header only)
2Generation 2: Stateful Inspection (L4 - State Connection Tracking)
3Generation 3: Application Proxy (L7 - Protocol Compliance)
4Generation 4: Next-Gen Firewall (NGFW) with Deep Packet Inspection (DPI, SSL Decryption, IPS)

Linux Netfilter / iptables Architecture:

Traffic flows through sequential tables (raw, mangle, nat, filter) and chains (PREROUTING, INPUT, FORWARD, OUTPUT, POSTROUTING):

System Architecture / Concept DiagramHorizontal Scroll Enabled
# 1. Set default drop policy
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

# 2. Allow established and related connections (Stateful tracking)
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# 3. Allow loopback interface
iptables -A INPUT -i lo -j ACCEPT

# 4. Allow SSH (Port 22) and HTTPS (Port 443)
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT

Implement a Python Cryptographic Hashing and Digital Signature Simulation

System Architecture / Concept DiagramHorizontal Scroll Enabled
import hashlib

def simple_hash(message):
    return hashlib.sha256(message.encode('utf-8')).hexdigest()

# Toy RSA Digital Signature Simulation
def toy_rsa_sign(message_digest_int, d, n):
    # Signature = (Hash)^d mod n
    return pow(message_digest_int, d, n)

def toy_rsa_verify(signature, e, n):
    # Recovered Hash = (Signature)^e mod n
    return pow(signature, e, n)

# Using previous parameters: e=7, d=43, n=77
e, d, n = 7, 43, 77

# Document hash truncated for toy math: 15
document_digest = 15
signature = toy_rsa_sign(document_digest, d, n)
print(f"Original Digest: {document_digest} | Generated Digital Signature: {signature}")

# Recipient Verification
recovered_digest = toy_rsa_verify(signature, e, n)
print(f"Verified Digest from Public Key: {recovered_digest}")
assert recovered_digest == document_digest, "Signature Verification Failed!"
print("[SUCCESS] Digital Signature verified: Authenticity and Non-Repudiation guaranteed.")

Important Exam Points & Quick Revision

Examiners frequently ask: RSA algorithm derivation with numerical example (guaranteed 10/15 marks Section C), Firewall types comparison, and Symmetric vs Asymmetric encryption.

Your reading progress
0%

100% left on this page — finishing it closes the gap for Security Countermeasures, Firewalls & Cryptography.

Weak topic hint

Security Countermeasures, Firewalls & Cryptography still counts as a weak topic until you finish this note and answer its questions.

Practise this unit
What Should You Do Next?

Test Your Understanding

Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.