Theme
Cryptography & Network Security (CNS): Complete MCQ Revision Notes
Legend: ⭐ = asked very often · ⚠️ = trap · All numerical examples were checked by running code.
Contents
- Security basics (CIA, services, attacks)
- Cryptography basics (symmetric vs asymmetric)
- Classical ciphers
- Symmetric ciphers (DES, 3DES, AES, modes)
- Number theory for public-key crypto
- Public-key algorithms (RSA, Diffie–Hellman, ECC)
- Hashes, MACs, digital signatures, certificates, Kerberos
- Security protocols (TLS, IPsec, PGP, SSH, VPN, Wi-Fi)
- Network defense, malware, attacks, authentication, access control
- Rapid-fire trap list
1. Security Basics ⭐⭐
- CIA triad: Confidentiality (only authorized parties can read), Integrity (no unauthorized modification), Availability (accessible when needed).
- Also: Authentication (verify identity), Authorization, Accountability/auditing, Non-repudiation (the sender can't deny sending; provided by digital signatures). AAA = Authentication, Authorization, Accounting.
- X.800 (OSI security architecture) covers security attacks, mechanisms and services. Services: authentication (peer entity, data origin), access control, data confidentiality, data integrity, non-repudiation (+ availability).
- Terms: vulnerability (weakness), threat (potential violation), exploit (code/technique that uses a vulnerability), risk (likelihood × impact), attack (an actual attempt), countermeasure. Zero-day = vulnerability unknown to the vendor / no patch yet.
Passive vs active attacks ⭐⭐⭐
| Passive | Active |
|---|---|
| Release of message contents (eavesdropping), traffic analysis | Masquerade (impersonation), replay, modification of messages, denial of service |
| Data not altered; hard to detect → focus on prevention (encryption) | Data altered/injected; hard to prevent → focus on detection and recovery |
- Mapping (Forouzan): confidentiality ← snooping, traffic analysis · integrity ← modification, masquerading, replaying, repudiation · availability ← denial of service.
- Principles: least privilege, defense in depth, separation of duties, fail-safe defaults, economy of mechanism, complete mediation, open design (Kerckhoffs), zero trust ("never trust, always verify"). Security through obscurity is not security.
2. Cryptography Basics ⭐⭐⭐
- Plaintext → (encryption with a key) → ciphertext → (decryption) → plaintext. Cryptology = cryptography + cryptanalysis.
- Steganography hides the existence of a message (e.g., in image LSBs); cryptography hides its meaning.
- Kerckhoffs's principle: security must depend only on the secrecy of the key, not of the algorithm.
| Symmetric (secret/private key) | Asymmetric (public key) |
|---|---|
| Same key to encrypt and decrypt | Key pair: public (shared) + private (kept secret) |
| Fast; used for bulk data | Slow (100–1000×); used for key exchange and signatures |
| Key-distribution problem | Solves key distribution |
| n users → n(n − 1)/2 keys | n users → 2n keys (n pairs) |
| DES, 3DES, AES, Blowfish, Twofish, IDEA, RC4, RC5/RC6, ChaCha20 | RSA, Diffie–Hellman, ElGamal, ECC, DSA |
- ⭐⭐⭐ Confidentiality: encrypt with the receiver's public key; the receiver decrypts with their own private key. Signature: sign with the sender's private key; anyone verifies with the sender's public key. Both: sign with the sender's private key, then encrypt with the receiver's public key.
- Hybrid encryption (TLS, PGP): asymmetric crypto exchanges a session key; symmetric crypto encrypts the data.
- Cryptanalysis attack models (weakest → strongest attacker): ciphertext-only, known-plaintext, chosen-plaintext, chosen-ciphertext. Also brute force (on average half the key space), side-channel (timing, power), man-in-the-middle, birthday attack (hash collisions in ~2^(n/2) work), meet-in-the-middle (Double DES).
- Unconditionally secure (one-time pad) vs computationally secure (everything practical).
3. Classical Ciphers ⭐⭐
Substitution ciphers
- Caesar: shift by 3; general shift k: C = (P + k) mod 26. Only 25 useful keys → trivial brute force. Example: HELLO → KHOOR.
- Monoalphabetic: any permutation of the alphabet; 26! ≈ 4 × 10^26 keys, but broken by frequency analysis (E is the most frequent letter in English).
- Affine: C = (aP + b) mod 26 with gcd(a, 26) = 1 → 12 × 26 = 312 keys.
- Playfair: 5 × 5 key matrix (I and J share a cell); encrypt digraphs (letter pairs); same row → take the letter to the right; same column → the letter below; otherwise → rectangle rule (swap columns). Put a filler (X) between repeated letters in a pair.
- Vigenère (polyalphabetic): repeating keyword; Cᵢ = (Pᵢ + Kᵢ) mod 26. Example: HELLO with key KEY → RIJVS. Broken by Kasiski/Friedman tests.
- Hill: matrix multiplication mod 26; the key matrix must be invertible mod 26; vulnerable to known-plaintext attacks.
- Vernam / one-time pad: XOR with a truly random key as long as the message, used once → perfect secrecy; impractical key distribution.
Transposition ciphers: rearrange positions (letter frequencies unchanged): rail fence, columnar transposition. Product ciphers combine substitution and transposition.
4. Symmetric-Key Ciphers ⭐⭐⭐
- Block cipher (fixed-size blocks: DES 64 bits, AES 128 bits) vs stream cipher (bit/byte at a time, XOR with a keystream: RC4 (broken; banned in TLS), ChaCha20, A5/1 (GSM)).
- Shannon's confusion (complex key–ciphertext relationship; substitution/S-boxes) and diffusion (each plaintext bit affects many ciphertext bits; permutation/mixing). Avalanche effect: flipping one input bit changes about half the output bits.
- Feistel structure: split the block into L and R; Lᵢ = Rᵢ₋₁; Rᵢ = Lᵢ₋₁ ⊕ F(Rᵢ₋₁, Kᵢ). Decryption = the same structure with subkeys in reverse order; F need not be invertible. Used by DES, 3DES, Blowfish, Camellia (Twofish is Feistel-like). ⚠️ AES is NOT Feistel: it is a substitution–permutation network (SPN).
4.1 DES ⭐⭐⭐ (1977; IBM, based on Lucifer)
- Block 64 bits; key 64 bits of which 56 are effective (8 parity bits); 16 rounds; 48-bit round subkeys; Feistel; initial and final permutations (IP, IP⁻¹).
- Round function: expansion (32 → 48 bits), XOR with the subkey, 8 S-boxes (6-bit input → 4-bit output; the only non-linear part), P-box permutation.
- 4 weak keys, 12 semi-weak keys (6 pairs); complementation property.
- Broken by brute force (EFF "Deep Crack", 1998). Double DES falls to meet-in-the-middle → about 2^57 work, not 2^112. Triple DES (EDE: C = E_K1(D_K2(E_K1(P)))): 2-key (112-bit) or 3-key (168-bit key, ~112-bit effective security); with K1 = K2 = K3 it equals single DES (backward compatibility). 3DES is now deprecated (NIST disallowed it for new encryption after 2023).
4.2 AES ⭐⭐⭐ (Rijndael, by Daemen & Rijmen; NIST FIPS 197, 2001)
- Block 128 bits (4 × 4 byte state); key 128 / 192 / 256 bits → 10 / 12 / 14 rounds ⭐.
- Each round: SubBytes (S-box, the non-linear step) → ShiftRows (cyclic row shifts) → MixColumns (column mixing in GF(2^8)) → AddRoundKey (XOR). One AddRoundKey before round 1; the final round has no MixColumns.
- Arithmetic in GF(2^8) with the polynomial x⁸ + x⁴ + x³ + x + 1. Key expansion produces (rounds + 1) round keys (44 words for AES-128).
- Other ciphers: Blowfish (64-bit block, 32–448-bit key, 16 rounds, Schneier), Twofish (AES finalist, 128-bit block), IDEA (64-bit block, 128-bit key, 8.5 rounds; early PGP), RC5 (variable), RC6 and Serpent (AES finalists), Camellia. AES finalists: MARS, RC6, Rijndael, Serpent, Twofish.
4.3 Block cipher modes ⭐⭐⭐
| Mode | How it works | Properties |
|---|---|---|
| ECB | Each block encrypted independently | Identical plaintext blocks → identical ciphertext (patterns leak, the "ECB penguin"); parallel; no IV; not recommended |
| CBC | Cᵢ = E(Pᵢ ⊕ Cᵢ₋₁), C₀ = IV | Needs an IV; encryption sequential, decryption parallel; one corrupted ciphertext block garbles two plaintext blocks; padding (padding-oracle attacks) |
| CFB | Cᵢ = Pᵢ ⊕ E(Cᵢ₋₁) | Self-synchronizing stream mode; no padding |
| OFB | Keystream Oᵢ = E(Oᵢ₋₁); Cᵢ = Pᵢ ⊕ Oᵢ | Keystream independent of the data; no error propagation; the IV must never repeat |
| CTR | Cᵢ = Pᵢ ⊕ E(nonce ‖ counter i) | Parallel encryption and decryption, random access, precomputation; no padding |
| GCM | CTR + Galois-field MAC | Authenticated encryption (AEAD): confidentiality + integrity; used in TLS 1.2/1.3 |
| CCM (CTR + CBC-MAC) is used in WPA2. |
5. Number Theory for Public-Key Crypto ⭐⭐
- Modular arithmetic: (a + b) mod n, (a·b) mod n = ((a mod n)(b mod n)) mod n. Modular exponentiation by square-and-multiply.
- Euclid: gcd(a, b) = gcd(b, a mod b). Extended Euclid finds x, y with ax + by = gcd(a, b) → the modular inverse a⁻¹ mod n exists iff gcd(a, n) = 1. Example: 7⁻¹ mod 20 = 3 (7 × 3 = 21 ≡ 1).
- Euler's totient φ(n) = count of integers in [1, n] coprime to n: φ(p) = p − 1 (p prime); φ(p^k) = p^k − p^(k−1); φ(pq) = (p − 1)(q − 1) for distinct primes; multiplicative for coprime factors. φ(10) = 4, φ(35) = 24, φ(37) = 36.
- Fermat's little theorem: a^(p−1) ≡ 1 (mod p) for prime p with gcd(a, p) = 1. Euler's theorem: a^φ(n) ≡ 1 (mod n) for gcd(a, n) = 1.
- Primitive root g mod p: the powers of g produce every value 1 … p − 1. Discrete logarithm: find x with g^x ≡ y (mod p); hard, and the basis of DH, ElGamal, DSA.
- Chinese Remainder Theorem: solves congruences with coprime moduli; speeds up RSA decryption.
- Primality tests: Fermat, Miller–Rabin (probabilistic), AKS (deterministic, polynomial time).
6. Public-Key Algorithms ⭐⭐⭐
6.1 RSA (Rivest–Shamir–Adleman, 1977; security = difficulty of factoring n)
- Pick large primes p, q; n = p·q.
- φ(n) = (p − 1)(q − 1).
- Pick e with 1 < e < φ(n) and gcd(e, φ(n)) = 1 (65537 is common).
- d = e⁻¹ mod φ(n) (so d·e ≡ 1 mod φ(n)).
- Public key (e, n); private key (d, n).
- Encrypt C = M^e mod n; decrypt M = C^d mod n (M < n). Sign S = M^d mod n; verify M = S^e mod n.
Examples (checked) ⭐⭐:
- p = 3, q = 11 → n = 33, φ = 20, e = 7 → d = 3. M = 2 → C = 2⁷ mod 33 = 29 → 29³ mod 33 = 2 ✓.
- p = 17, q = 11 → n = 187, φ = 160, e = 7 → d = 23. M = 88 → C = 11 (Stallings).
- p = 5, q = 11, e = 3 → n = 55, φ = 40 → d = 27. M = 9 → C = 9³ mod 55 = 14.
Key sizes today: ≥ 2048 bits (3072 for long-term use). Textbook RSA is deterministic, so real systems use padding: OAEP (encryption), PSS (signatures).
6.2 Diffie–Hellman key exchange ⭐⭐⭐ (1976; the first published public-key scheme; security = discrete logarithm)
- Public: prime q and primitive root α. A picks secret X_A and sends Y_A = α^X_A mod q; B picks X_B and sends Y_B = α^X_B mod q. Shared key K = Y_B^X_A mod q = Y_A^X_B mod q.
- Key exchange only (no encryption or signatures by itself).
- ⚠️ Unauthenticated DH is vulnerable to man-in-the-middle → fix with signatures/certificates (authenticated DH, as in TLS). Ephemeral DH (DHE/ECDHE) gives perfect forward secrecy.
- Examples (checked): q = 23, α = 5, X_A = 6, X_B = 15 → Y_A = 8, Y_B = 19, K = 2. Stallings: q = 353, α = 3, X_A = 97, X_B = 233 → Y_A = 40, Y_B = 248, K = 160.
6.3 Others
- ElGamal: encryption and signatures based on discrete log; randomized; ciphertext twice the plaintext size.
- ECC (elliptic-curve cryptography): the same security with much smaller keys (256-bit ECC ≈ 3072-bit RSA ≈ 128-bit symmetric). ECDH, ECDSA, Ed25519 (EdDSA).
- DSA/DSS (NIST Digital Signature Standard): signatures only, no encryption.
- Post-quantum (NIST, August 2024): ML-KEM (Kyber, FIPS 203) for key encapsulation; ML-DSA (Dilithium, FIPS 204) and SLH-DSA (SPHINCS+, FIPS 205) for signatures. Shor's algorithm would break RSA/DH/ECC; Grover's algorithm halves symmetric security (hence AES-256).
7. Hashes, MACs, Signatures, Certificates ⭐⭐⭐
7.1 Hash functions
- Map any input to a fixed-size digest; fast; one-way.
- Properties: preimage resistance (given h, hard to find m with H(m) = h), second-preimage resistance / weak collision resistance (given m₁, hard to find m₂ ≠ m₁ with the same hash), collision resistance / strong (hard to find any colliding pair). The birthday attack finds collisions in about 2^(n/2) work (a 128-bit hash → 2^64).
| Hash | Digest | Block | Status |
|---|---|---|---|
| MD5 | 128 bits | 512 | Broken (collisions, 2004) |
| SHA-1 | 160 bits | 512 (80 steps) | Broken (SHAttered collision, 2017) |
| SHA-224 / SHA-256 | 224 / 256 | 512 | Secure (SHA-2) |
| SHA-384 / SHA-512 | 384 / 512 | 1024 | Secure (SHA-2) |
| SHA-3 (Keccak) | 224–512 | Sponge | Secure; different design (sponge construction) |
| RIPEMD-160 | 160 | 512 | Used in Bitcoin addresses |
- MD5, SHA-1 and SHA-2 use the Merkle–Damgård construction (open to length-extension attacks); SHA-3 uses a sponge.
- Password storage: salted, deliberately slow hashes: bcrypt, scrypt, Argon2 (Password Hashing Competition winner), PBKDF2. A salt defeats rainbow tables; a pepper is a secret salt.
7.2 MAC
- tag = MAC(K, M) with a shared secret key → integrity + authentication of origin. ⚠️ No non-repudiation (both parties hold the key).
- HMAC = H((K ⊕ opad) ‖ H((K ⊕ ipad) ‖ M)); CMAC / CBC-MAC (block-cipher based); Poly1305; GMAC.
7.3 Digital signatures ⭐⭐⭐
- Sign the hash of the message with the sender's private key; verify with the sender's public key → authentication, integrity, non-repudiation. ⚠️ No confidentiality by itself.
- Algorithms: RSA (PKCS#1 / PSS), DSA, ECDSA, EdDSA.
| Hash | MAC | Digital signature | |
|---|---|---|---|
| Key | None | Shared secret | Private (sign) / public (verify) |
| Integrity | ✔ (if the hash itself is protected) | ✔ | ✔ |
| Authentication | ✘ | ✔ | ✔ |
| Non-repudiation | ✘ | ✘ | ✔ |
7.4 Digital certificates and PKI ⭐⭐
- A certificate binds an identity to a public key and is signed by a Certificate Authority (CA). Standard: X.509 (v3 current, with extensions). Fields: version, serial number, signature algorithm, issuer, validity (not before / not after), subject, subject public-key info, extensions (SAN, key usage), CA's signature.
- PKI parts: CA; Registration Authority (RA) (verifies identity); certificate repository; CRL (Certificate Revocation List) and OCSP (online status checks). Chain of trust: end-entity certificate → intermediate CA → root CA (self-signed, preinstalled in trust stores).
- Browsers check the chain, signatures, validity dates, hostname match and revocation status.
- PGP uses a web of trust instead of a CA hierarchy.
7.5 Key distribution and Kerberos ⭐⭐
- A KDC (key distribution center) shares a master key with each user and hands out session keys. The Needham–Schroeder protocol had a replay flaw, fixed with timestamps/nonces (leading to Kerberos).
- Kerberos (MIT, Project Athena; v5; port 88): ticket-based authentication using symmetric keys and a trusted third party. Parts: Authentication Server (AS) + Ticket-Granting Server (TGS) (together the KDC), Ticket-Granting Ticket (TGT), service tickets, authenticators with timestamps (needs synchronized clocks). Gives single sign-on; the password never crosses the network. Used by Windows Active Directory.
8. Security Protocols ⭐⭐⭐
8.1 SSL/TLS
- Sits between the transport layer (TCP) and the application layer; provides confidentiality, integrity, server authentication (client authentication optional). Used by HTTPS (443), SMTPS, IMAPS, FTPS, LDAPS.
- Versions: SSL 2.0/3.0 (broken; POODLE), TLS 1.0/1.1 (deprecated in 2021, RFC 8996), TLS 1.2 (2008), TLS 1.3 (2018, RFC 8446).
- SSL/TLS ≤ 1.2 sub-protocols: Handshake, Change Cipher Spec, Alert, Record (fragment → optional compression (since removed) → MAC → encrypt).
- TLS 1.2 handshake (2 RTT): ClientHello (versions, cipher suites, random) → ServerHello + Certificate + ServerKeyExchange + ServerHelloDone → ClientKeyExchange + ChangeCipherSpec + Finished → ChangeCipherSpec + Finished.
- TLS 1.3: 1-RTT handshake (0-RTT resumption, with replay risk); only (EC)DHE key exchange → forward secrecy is mandatory; removed RSA key transport, static DH, CBC/RC4/3DES/MD5/SHA-1 suites, compression and renegotiation; AEAD ciphers only (AES-GCM, ChaCha20-Poly1305).
- Known bugs/attacks: Heartbleed (OpenSSL bug), POODLE, BEAST, CRIME, Logjam, FREAK, DROWN. HSTS forces browsers to use HTTPS; certificate pinning.
8.2 IPsec (network layer) ⭐⭐⭐
| AH (Authentication Header) | ESP (Encapsulating Security Payload) | |
|---|---|---|
| IP protocol number | 51 | 50 |
| Integrity + origin authentication | ✔ (also covers immutable IP header fields) | ✔ (payload) |
| Confidentiality | ✘ | ✔ |
| Anti-replay | ✔ | ✔ |
| Works through NAT | ✘ | ✔ (NAT-T over UDP 4500) |
- Modes: Transport mode (protects the payload; original IP header kept; host-to-host) vs Tunnel mode (protects the entire original packet inside a new outer IP header; gateway-to-gateway / site-to-site VPNs).
- Security Association (SA): a one-way (simplex) agreement on keys and algorithms, identified by SPI + destination IP + protocol; stored in the SAD, policies in the SPD. Key management: IKE / IKEv2 (UDP 500), ISAKMP.
8.3 Other protocols
- PGP (email/file security): authentication (signature), confidentiality (session key + receiver's public key), compression (ZIP, applied after signing and before encrypting), email compatibility (radix-64), segmentation; web of trust. S/MIME: email security with X.509 certificates (CA-based).
- SSH (22): Transport Layer Protocol (server authentication, encryption, integrity), User Authentication Protocol (password / public key), Connection Protocol (multiplexed channels, port forwarding).
- VPN: encrypted tunnel over a public network; remote-access vs site-to-site; IPsec, SSL/TLS VPN (OpenVPN), WireGuard (modern; ChaCha20), L2TP/IPsec, PPTP (insecure, obsolete).
- Wi-Fi security ⭐⭐: WEP (RC4 + 24-bit IV, CRC-32 integrity → broken) → WPA (TKIP, interim fix; Michael MIC) → WPA2 (802.11i; AES-CCMP; 4-way handshake; KRACK attack 2017; PSK open to offline dictionary attacks) → WPA3 (SAE "Dragonfly" handshake, resists offline dictionary attacks, forward secrecy; 192-bit enterprise mode; OWE for open networks). Enterprise mode uses 802.1X/EAP with a RADIUS server.
- DNSSEC: signatures on DNS data (authenticity and integrity, not confidentiality). DoT/DoH add confidentiality to DNS queries.
- Email anti-spoofing: SPF (which IPs may send for a domain), DKIM (signature on the message), DMARC (policy + reporting).
- Authentication protocols: RADIUS (UDP 1812/1813; AAA; encrypts only the password), TACACS+ (TCP 49; Cisco; encrypts the whole payload; separates AAA functions), Kerberos, LDAP, OAuth 2.0 (delegated authorization with access tokens), OpenID Connect (authentication on top of OAuth 2.0), SAML (XML-based SSO), JWT (header.payload.signature; ⚠️ signed, not encrypted, by default).
9. Network Defense, Malware, Attacks ⭐⭐⭐
9.1 Firewalls
| Type | Layer | Decides using | Notes |
|---|---|---|---|
| Packet filter (stateless) | 3–4 | Source/destination IP, ports, protocol, flags, per packet (ACLs) | Fastest, cheap; no context; fooled by spoofing/fragment tricks |
| Stateful inspection | 3–4 + state table | Connection state (allows replies to established sessions) | Most common baseline |
| Application-level gateway (proxy) | 7 | Application content (HTTP requests, FTP commands), user authentication | Most secure, slowest; one proxy per application |
| Circuit-level gateway | 5 (session) | Validates TCP/UDP session setup, then relays (SOCKS) | Doesn't inspect content |
| NGFW / WAF | 7 | Deep packet inspection, application awareness, IPS, user identity / web attacks (SQLi, XSS) |
- Architectures: bastion host (hardened, exposed), dual-homed host, screened host, screened subnet / DMZ (public servers between an outer and an inner firewall). Default-deny is the safest policy. Rules are processed top-down, first match wins.
9.2 IDS / IPS ⭐⭐
- IDS monitors and alerts (passive, out-of-band, e.g., on a SPAN port); IPS sits inline and blocks (active).
- NIDS (watches network traffic) vs HIDS (host logs, file integrity: OSSEC, Tripwire).
- Signature/misuse-based (matches known patterns; few false positives; misses zero-days) vs anomaly/behavior-based (deviation from a baseline; can catch new attacks; more false positives).
- False positive = alarm on benign traffic; false negative = missed attack (worse). Tools: Snort, Suricata, Zeek. Honeypot / honeynet = decoy that lures and studies attackers. A SIEM aggregates logs (Splunk, ELK).
9.3 Malware ⭐⭐⭐
| Type | Key trait |
|---|---|
| Virus | Attaches to a host file/program; needs user action/execution to spread. Phases: dormant, propagation, triggering, execution. Kinds: boot sector, file infector, macro, polymorphic (changes its signature, e.g., by re-encrypting), metamorphic (rewrites its own code), stealth |
| Worm | Self-replicating standalone program; spreads over networks automatically by exploiting vulnerabilities (Morris 1988, Code Red, SQL Slammer, WannaCry 2017) |
| Trojan horse | Disguised as legitimate software; does not self-replicate |
| Ransomware | Encrypts data or locks the system and demands payment (WannaCry, Petya) |
| Spyware / keylogger | Secretly collects information / keystrokes |
| Adware | Unwanted advertising |
| Rootkit | Hides its presence (kernel or user level) and keeps privileged access |
| Backdoor / trapdoor | Secret entry that bypasses authentication |
| Logic bomb | Fires when a condition is met (date, event); time bomb = date-triggered |
| Botnet | Network of infected "zombies" controlled through a C&C server; used for DDoS and spam |
| RAT | Remote-access Trojan |
| Fileless malware | Lives in memory / abuses legitimate tools (PowerShell) |
9.4 Network and web attacks ⭐⭐⭐
- DoS / DDoS: SYN flood (half-open connections; defense: SYN cookies), Smurf (ICMP echo to a broadcast address with the victim's spoofed source → amplification), Fraggle (UDP version), Ping of Death (oversized ICMP packet > 65,535 bytes), Teardrop (overlapping fragment offsets), UDP flood, HTTP flood, amplification (DNS, NTP, memcached), Slowloris (keeps HTTP connections open).
- Spoofing: IP spoofing; ARP spoofing/poisoning (MITM on a LAN; defenses: dynamic ARP inspection, static ARP entries); DNS spoofing / cache poisoning; MAC flooding (fills the switch's CAM table so it floods like a hub); DHCP starvation / rogue DHCP; email spoofing.
- MITM, session hijacking (stealing a session cookie/token), replay attack (resending captured valid data; defenses: nonces, timestamps, sequence numbers), sniffing (Wireshark/tcpdump).
- Web attacks:
- SQL injection (
' OR '1'='1' --; defense: parameterized queries). - XSS (cross-site scripting: injected script runs in victims' browsers): stored/persistent, reflected, DOM-based. Defenses: output encoding, input validation, Content Security Policy, HttpOnly cookies.
- CSRF (cross-site request forgery: a forged state-changing request rides on the victim's session). Defenses: anti-CSRF tokens, SameSite cookies, re-authentication.
- Clickjacking (defense: X-Frame-Options / CSP frame-ancestors), SSRF, directory traversal (
../), command injection, insecure deserialization, XXE, IDOR (insecure direct object reference).
- SQL injection (
- OWASP Top 10:2025 (announced November 2025, final January 2026): A01 Broken Access Control (now includes SSRF), A02 Security Misconfiguration, A03 Software Supply Chain Failures (new), A04 Cryptographic Failures, A05 Injection, A06 Insecure Design, A07 Authentication Failures, A08 Software or Data Integrity Failures, A09 Security Logging & Alerting Failures, A10 Mishandling of Exceptional Conditions (new).
- The 2021 list (still in many question banks): A01 Broken Access Control, A02 Cryptographic Failures, A03 Injection, A04 Insecure Design, A05 Security Misconfiguration, A06 Vulnerable & Outdated Components, A07 Identification & Authentication Failures, A08 Software & Data Integrity Failures, A09 Security Logging & Monitoring Failures, A10 SSRF. Broken Access Control is #1 in both editions.
- Password attacks: brute force, dictionary, hybrid, rainbow tables (precomputed hashes; defeated by salting), credential stuffing (reusing leaked credentials), password spraying (one common password against many accounts), keylogging, shoulder surfing.
- Social engineering: phishing (mass email), spear phishing (targeted), whaling (executives), vishing (voice), smishing (SMS), pretexting, baiting, tailgating/piggybacking, pharming (redirects users via DNS/hosts-file poisoning), watering hole.
- Buffer overflow: writing past a buffer's end overwrites the return address → code execution. Defenses: bounds checking, stack canaries, DEP/NX, ASLR, memory-safe languages.
- Port scanning (nmap): TCP connect scan (full handshake), SYN scan (half-open, stealthier: SYN/ACK reply = open, RST = closed), FIN scan, NULL scan (no flags), Xmas scan (FIN + PSH + URG), ACK scan (maps firewall rules), UDP scan (ICMP port unreachable = closed).
- Cyber kill chain (Lockheed Martin): Reconnaissance → Weaponization → Delivery → Exploitation → Installation → Command & Control → Actions on Objectives. MITRE ATT&CK = matrix of attacker tactics and techniques.
9.5 Authentication and access control ⭐⭐
- Factors: something you know (password, PIN), have (token, smart card, phone OTP), are (biometrics); also somewhere you are / something you do. MFA = at least two different factor types (⚠️ password + PIN is not MFA; both are "know").
- OTPs: HOTP (HMAC + counter), TOTP (HMAC + time step, usually 30 s; Google Authenticator).
- Biometrics: FAR (false acceptance rate: security risk), FRR (false rejection rate: inconvenience), CER/EER (where FAR = FRR; lower is better).
- Challenge–response, zero-knowledge proofs, passkeys/FIDO2 (public-key based, phishing-resistant).
- Access control models: DAC (owner decides; ACLs; UNIX permissions), MAC (system-enforced labels and clearances; military), RBAC (permissions through roles; enterprises), ABAC (attribute/policy-based).
- Security models ⭐⭐: Bell–LaPadula (confidentiality): simple security property = no read up, *-property = no write down. Biba (integrity): no read down, no write up. Clark–Wilson (integrity via well-formed transactions and separation of duty; commercial). Brewer–Nash / Chinese Wall (conflicts of interest).
- Crypto hygiene: never roll your own crypto; prefer AES-GCM or ChaCha20-Poly1305, SHA-256 or better, RSA ≥ 2048 or ECC, TLS 1.2+.
10. Rapid-fire trap list ⭐⭐⭐
- Encrypt with the receiver's public key; sign with the sender's private key.
- Symmetric keys for n users: n(n − 1)/2; asymmetric: 2n.
- DES: 64-bit block, 56-bit key, 16 rounds, 8 S-boxes (6 bits → 4 bits).
- AES: 128-bit block; 10/12/14 rounds for 128/192/256-bit keys; not a Feistel cipher.
- 3DES uses 112- or 168-bit keys; Double DES falls to meet-in-the-middle.
- ECB leaks patterns; CTR and GCM parallelize; GCM is authenticated encryption.
- RSA: d = e⁻¹ mod φ(n); security rests on factoring.
- Diffie–Hellman: key exchange only; MITM if unauthenticated; rests on discrete log.
- MD5 = 128 bits, SHA-1 = 160, SHA-256 = 256; MD5 and SHA-1 are broken.
- A MAC gives no non-repudiation; a signature does.
- A digital signature alone gives no confidentiality.
- X.509 certificates are issued by CAs; CRL/OCSP handle revocation.
- Kerberos: AS + TGS, tickets, timestamps, symmetric keys, port 88.
- AH (51) has no confidentiality; ESP (50) does.
- Tunnel mode protects the whole packet under a new IP header.
- TLS 1.3: 1-RTT handshake, forward secrecy mandatory.
- WEP broken (RC4, 24-bit IV); WPA2 = AES-CCMP; WPA3 = SAE.
- A worm self-propagates; a virus needs a host; a Trojan doesn't replicate.
- Application gateway = most secure firewall; packet filter = fastest.
- IDS detects (passive); IPS prevents (inline).
- Signature-based detection misses zero-days; anomaly-based has more false positives.
- Salting defeats rainbow tables.
- Bell–LaPadula: no read up, no write down. Biba: the reverse.
- Nonces/timestamps stop replay attacks.
- Smurf = ICMP broadcast amplification; Teardrop = overlapping fragments; SYN flood = half-open connections.