About this guide

Status: supplementary. This guide is staged material provided for study and practice.

Source of unit outline: The unit titles, topics, and teaching hours in this guide come from a third-party syllabus page (NEBians, https://nebians.consica.com.np/app/syllabus/bca-course/cyber-security-and-ethical-hacking/), captured on 2026-11-20. This is a candidate table of contents only.

Not official: This candidate TOC is not the official Tribhuvan University micro-syllabus, and it is not verified against the official TU 2025 record. The official TU 2025 course record confirms the course identity (BCA401, Cyber Security and Ethical Hacking, Semester 7, 3 credits) but states that the course has no verified numbered unit outline in the cited document. Do not cite this guide as official TU text.

Teaching material: All explanations, worked examples, diagrams, and practice questions below are original BCA Nepal study material written to ground the listed topics. Nothing here is copied from the third-party page except the unit titles, topic names, and hours used to build the table of contents.

Security use — read carefully: All security examples are defensive, legal, and intended for authorized lab or classroom use only, on systems you own or have written permission to test. Do not scan, probe, attack, or test any system without explicit written authorization. Unauthorized access is illegal under Nepal's Electronic Transactions Act and similar laws, regardless of intent.


Course code: BCA401
Semester: 7
Curriculum: 2025
Credits: 3
Workload: 3 hours lecture / week
Candidate outline source: Third-party syllabus page, captured 2026-11-20
Outline status: Unverified — not the official TU micro-syllabus


Course overview

Cyber Security and Ethical Hacking teaches how to defend systems and how attackers operate, so defences can be built and tested lawfully. The candidate outline organizes the course into eight units: foundations (CIA triad, threat modelling, CVSS); network protocol analysis (TCP flags, asset discovery governance); authentication, entropy, key derivation, and access control; secure application engineering (input validation, parameterised queries, CSP, cookies/sessions/CSRF); network defence architecture (DNSSEC, Wi-Fi, rate limiting, ACLs); intrusion detection, alert statistics, incident response, and digital forensics; security audits, penetration-testing rules of engagement, and Nepal cyber law; and ethical-hacking methodology, attack categories, and their defences.

The course is defensive in posture: students learn attacker tactics only to recognize, detect, and mitigate them within authorized labs. Because the official 2025 record publishes no unit-level outline, the sequence and hours below come from the third-party candidate outline and should be treated as provisional.


Learning outcomes

Derived from the third-party candidate unit outline (not verified against the official TU micro-syllabus):

  1. Explain the CIA triad, defence in depth, threat modelling (STRIDE), and CVSS v3.1 scoring.
  2. Analyse network protocols, TCP header fields, handshake/sequence arithmetic, flag combinations, and governed asset discovery.
  3. Describe authentication factors, password entropy, key derivation (PBKDF2, bcrypt, scrypt, Argon2), and access-control models (DAC, MAC, RBAC, ABAC).
  4. Apply secure application engineering: input validation, output encoding, parameterised queries, CSP, cookie/session/CSRF controls.
  5. Describe network-defence architecture: segmentation, DMZ, DNSSEC, WPA2/WPA3, token-bucket rate limiting, ACLs.
  6. Describe IDS/IPS, confusion-matrix metrics, base-rate fallacy, incident-response lifecycle, and digital forensics (hashing, chain of custody).
  7. Describe security audits, risk quantification (SLE, ARO, ALE, ROSI), penetration-testing rules of engagement, and Nepal's cyber-law framework.
  8. Describe ethical-hacking phases, attack categories (malware, sniffing, social engineering, DoS, web/app, wireless/mobile/IoT/cloud, evasion, crypto attacks), and defences.
  9. Conduct only defensive, authorized security testing with written rules of engagement; never test systems without permission.

Unit 1: Foundations, the CIA Triad, Threat Modelling and CVSS Scoring (6 hours)

Key terms

  • Asset: anything of value (data, hardware, services, reputation).
  • Threat: a potential cause of harm to an asset.
  • Vulnerability: a weakness a threat can exploit.
  • Risk: likelihood × impact of a threat exploiting a vulnerability.
  • CIA triad: confidentiality, integrity, availability.
  • Defence in depth: layered controls so no single failure compromises the system.
  • Threat modelling: structured identification of threats (e.g., STRIDE).
  • CVSS v3.1: Common Vulnerability Scoring System, 0–10 severity score.
  • STRIDE: Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege.

1.1 Vocabulary

Definition and why it matters. Precise security vocabulary lets students and professionals discuss risk accurately and avoid confusing a threat with a vulnerability or an exploit with an impact.

Core theory. Asset = something of value. Threat = potential source of harm. Vulnerability = weakness. Risk = function of likelihood and impact. Control/mitigation = measure that reduces risk. Exploit = code/technique that uses a vulnerability. Attack surface = all points where an attacker can interact with the system.

Worked example. A college web server (asset). Threat: an attacker defaces the site. Vulnerability: outdated CMS with a known flaw. Risk = likelihood (publicly known flaw) × impact (reputation, downtime). Mitigation: patch the CMS, use a web application firewall.

Use case. A student documents assets, threats, and vulnerabilities for a lab network as the first step of a risk assessment.

Comparison. Threat (actor/event) vs vulnerability (weakness) vs risk (likelihood × impact) vs exploit (realization).

Common mistakes. Saying "the vulnerability is a hacker" (a hacker is a threat actor, not a vulnerability); treating every vulnerability as equally risky.

Exam points. Define asset, threat, vulnerability, risk, control; give one example each.

Self-check. Q: Is an outdated CMS a threat or a vulnerability? A: Vulnerability — the weakness; the attacker exploiting it is the threat.

1.2 The CIA triad and beyond

Definition and why it matters. CIA (confidentiality, integrity, availability) is the classic security goal model; modern practice adds authentication, non-repudiation, and sometimes privacy/safety.

Core theory. Confidentiality: only authorized parties read data (encryption, access control). Integrity: data not altered undetected (hashes, signatures, MACs). Availability: service works when needed (redundancy, DDoS protection). Beyond CIA: authentication (verify identity), non-repudiation (prevent denial), accountability (audit logs).

Worked example. A student grade database: confidentiality (only teachers/student see grades), integrity (grades not changed without authorization), availability (grade portal online during results period), authentication (login), non-repudiation (teacher cannot deny submitting a grade).

Use case. Designing access controls for a college result-management system.

Comparison. CIA core goals vs extended goals (authentication, non-repudiation, accountability).

Common mistakes. Forgetting availability (security is not only secrecy); assuming confidentiality implies integrity (encrypted data can still be altered).

Exam points. Define CIA and each extended goal; give an example of each in a student system.

Self-check. Q: Does encryption alone guarantee integrity? A: No — encrypted data can still be modified; use hashes/MACs for integrity.

1.3 Defence in depth and principles

Definition and why it matters. Defence in depth layers multiple independent controls so a single control failure does not lead to compromise.

Core theory. Layers: physical security, network perimeter (firewall), host hardening, application security, authentication, monitoring, backups. Principles: least privilege (minimum access needed), fail-safe (default deny), separation of duties, economy of mechanism (simple design), open design (security by design, not secrecy), psychological acceptability (usable security).

Worked example. A web app protected by: WAF at edge, authentication at login, least-privilege database account, encrypted backups, and monitoring. If the WAF is bypassed, authentication and the DB account still limit damage.

Use case. A college network layers firewalls, VLANs, endpoint protection, and backups.

Comparison. Single strong control (fragile) vs layered controls (resilient).

Common mistakes. Relying on one control (e.g., only a firewall); assuming complexity equals security.

Exam points. Describe defence in depth; state least privilege and fail-safe principles.

Self-check. Q: What does least privilege mean? A: Give a user/process only the access it needs, nothing more.

1.4 Threat modelling

Definition and why it matters. Threat modelling systematically finds threats before they are exploited, so controls can be prioritized.

Core theory. STRIDE: Spoofing (fake identity), Tampering (unauthorized modification), Repudiation (deny an action), Information disclosure (data exposed to unauthorized), Denial of service (service unavailable), Elevation of privilege (gain higher access). Process: decompose the system (data-flow diagram), identify threats per STRIDE category, rate them, and decide mitigations.

Worked example. Data-flow diagram: user → browser → web server → database. STRIDE: spoofing (steal credentials) → mitigate with MFA; tampering (modify DB records) → mitigate with authorization checks; information disclosure (database leak) → mitigate with encryption at rest.

Use case. A student threat-models a capstone project before coding.

Comparison. Threat modelling (proactive, design-time) vs penetration testing (reactive, finds issues in a running system).

Common mistakes. Modelling only external attackers (ignore insiders); not updating the model when the system changes.

Exam points. List the six STRIDE categories; describe the threat-modelling process.

Self-check. Q: Which STRIDE category covers "an attacker denies sending a message"? A: Repudiation.

1.5 Rating and ranking risk

Definition and why it matters. Not all risks are equal; rating and ranking let an organization fix the most dangerous issues first.

Core theory. Risk = likelihood × impact. Rate each on a scale (low/medium/high or 1–5). Plot on a risk matrix (likelihood axis vs impact axis). High likelihood + high impact = top priority. Consider velocity (how fast a threat can spread) and exposure (how many assets affected).

Worked example. Vulnerability A: likelihood 4, impact 4 → risk 16 (high). Vulnerability B: likelihood 2, impact 5 → risk 10 (medium). Fix A first. If A is internet-facing and B is internal-only, A's exposure is higher still.

Use case. Prioritizing patching for a college server room.

Comparison. Qualitative rating (low/medium/high) vs quantitative (annualized loss expectancy, Unit 7).

Common mistakes. Rating impact only and ignoring likelihood; treating all "high" findings as equal without considering exposure.

Exam points. Show how to compute a risk score; explain how a risk matrix prioritizes.

Self-check. Q: Risk = likelihood × what? A: Impact.

1.6 CVSS v3.1: scoring a known vulnerability

Definition and why it matters. CVSS v3.1 is a standard 0–10 score that communicates how severe a vulnerability is, helping teams prioritize patching.

Core theory. Base metrics: exploitability (attack vector: network/adjacent/local/physical; attack complexity; privileges required; user interaction; scope) and impact (confidentiality, integrity, availability). Temporal and environmental metrics adjust over time and by environment. Score 0–10, with qualitative ratings (none, low, medium, high, critical).

Worked example. A remote code execution with network attack vector, low complexity, no privileges, no user interaction, full confidentiality/integrity/availability impact → base score 9.8–10.0 (critical). A local, low-impact information disclosure → score ~2–3 (low).

Use case. Using CVSS scores from a vendor advisory to decide which college servers to patch first.

Comparison. Base score (intrinsic) vs temporal (changes over time, e.g., exploit availability) vs environmental (depends on your assets).

Common mistakes. Comparing scores across different products without context; assuming CVSS alone decides patching (business context matters too).

Exam points. Name CVSS metric groups; state score range and what 10 means.

Self-check. Q: What does a CVSS base score of 10 indicate? A: Critical severity (e.g., remote, no auth, full impact).

1.7 Seeing the ideas: real hardware, the triad, STRIDE and the risk matrix

Definition and why it matters. This topic visualizes hardware assets, the CIA triad, STRIDE categories, and the risk matrix to connect abstract concepts to concrete systems.

Core theory. Hardware asset = server, router, laptop, phone. CIA applied to hardware: confidentiality (locked server room), integrity (firmware not tampered), availability (UPS, redundant power). STRIDE mapped to a data-flow diagram. Risk matrix plotting likelihood vs impact.

Worked example. A college router: confidentiality (config encrypted), integrity (signed firmware), availability (redundant link). STRIDE on a login flow: spoofing → MFA; information disclosure → HTTPS. Risk matrix: a public RCE (likelihood high, impact high) sits in the top-right cell.

Use case. Presenting a risk assessment to college IT management.

Comparison. Abstract model (CIA/STRIDE) vs concrete asset (router/server).

Common mistakes. Modelling without identifying assets first; using a risk matrix without defining likelihood/impact scales.

Exam points. Sketch a risk matrix; map STRIDE categories to mitigations.

Self-check. Q: On a risk matrix, which cell is top priority? A: High likelihood and high impact.


Unit 1 summary

Unit 1 covers security vocabulary, the CIA triad and extended goals, defence-in-depth principles, threat modelling with STRIDE, risk rating/ranking, and CVSS v3.1 scoring. Students should compute a CVSS score conceptually, build a STRIDE model, and place risks on a matrix.


Unit 2: Network Protocol Analysis, TCP Flag Math and Asset Discovery Governance (6 hours)

Key terms

  • OSI/TCP-IP layers: application, transport, internet/network, link.
  • TCP header: source/dest port, sequence, acknowledgement, flags, window, checksum, urgent pointer.
  • Three-way handshake: SYN, SYN-ACK, ACK.
  • Sequence number: byte-stream position; ISN = initial sequence number.
  • TCP flags: SYN, ACK, FIN, RST, PSH, URG.
  • Service inventory: list of hosts, ports, services, versions.
  • Discovery governance: authorization, scope, rules of engagement before scanning.

2.1 Layers and what each reveals

Definition and why it matters. Each network layer exposes different information to an observer; defenders must know what each layer leaks and protect accordingly.

Core theory. Application layer (HTTP, DNS, TLS) reveals content, hostnames, user agents. Transport layer (TCP/UDP) reveals ports and connection state. Network layer (IP) reveals source/destination addresses. Link layer (Ethernet/Wi-Fi) reveals MAC addresses. Encryption (TLS) hides application content but not IP/port metadata.

Worked example. An observer on the network sees: MAC addresses (link), IP addresses (network), port 443 TCP (transport), and encrypted TLS (application) — but not the HTTP URL or cookies inside TLS.

Use case. A network defender decides what a firewall (network layer) vs a WAF (application layer) can see and control.

Comparison. Network-layer visibility (IPs/ports) vs application-layer visibility (content, when unencrypted).

Common mistakes. Assuming TLS hides everything (metadata like IP and timing remains visible); assuming a firewall inspects application content (only application-layer controls do).

Exam points. List layers and what each reveals; state what TLS hides vs exposes.

Self-check. Q: Does TLS hide the destination IP address? A: No — IP is network-layer and remains visible.

2.2 The TCP header (RFC 793)

Definition and why it matters. TCP is the reliable transport behind most internet services; its header fields are the basis for connection analysis, fingerprinting, and flag-based attacks.

Core theory. Header fields: source port, destination port, sequence number, acknowledgement number, data offset, reserved, flags (URG, ACK, PSH, RST, SYN, FIN), window size, checksum, urgent pointer, options. Sequence/acknowledgement track byte streams. Flags control connection state and flow.

Worked example. A TCP segment: source port 54321, dest port 443, sequence 1000, acknowledgement 2000, flags SYN=1, window 65535. This is a client initiating a connection to HTTPS.

Use case. Analyzing a captured TCP handshake to confirm a connection was established.

Comparison. TCP (reliable, ordered, connection-oriented) vs UDP (unreliable, datagram, no handshake).

Common mistakes. Confusing sequence number (bytes sent) with acknowledgement number (next byte expected); forgetting checksum covers header+data+pseudo-header.

Exam points. List TCP header fields; state the purpose of sequence/acknowledgement numbers and key flags.

Self-check. Q: Which TCP flag initiates a connection? A: SYN.

2.3 Handshake and sequence arithmetic

Definition and why it matters. The TCP three-way handshake establishes a connection and initializes sequence numbers; sequence arithmetic underlies acknowledgements and some attacks (e.g., TCP reset injection).

Core theory. Handshake: client sends SYN with ISN = x. Server replies SYN-ACK with its ISN = y and acknowledges x+1. Client replies ACK acknowledging y+1. Each SYN/FIN consumes one sequence number; data consumes its byte length.

Worked example. Client ISN = 2000 (SYN). Server ISN = 1000, SYN-ACK acknowledges 2001. Client ACK acknowledges 1001. If client then sends 150 bytes, next acknowledgement from server will be 2001 + 150 = 2151.

Use case. Predicting expected acknowledgement numbers when analysing captures or troubleshooting.

Comparison. Handshake (connection setup) vs teardown (FIN/FIN-ACK or RST).

Common mistakes. Forgetting SYN consumes one sequence number; miscounting acknowledgement after data.

Exam points. Trace a handshake with example ISNs; compute acknowledgement numbers.

Self-check. Q: If client ISN is 2000, what does the server acknowledge in SYN-ACK? A: 2001.

2.4 Classifying flag combinations

Definition and why it matters. Certain TCP flag combinations are abnormal and indicate scanning, probing, or malformed traffic that sensors can detect and drop.

Core theory. Normal combinations: SYN (start), SYN-ACK, ACK, FIN/FIN-ACK (close), RST (abort). Suspicious: SYN+FIN, FIN+URG+PSH ("Xmas", all flags), NULL (no flags), SYN+RST. These are used in OS fingerprinting and port scanning; legitimate traffic rarely uses them.

Worked example. A packet with flags FIN=1, URG=1, PSH=1 is an "Xmas" scan — a probe to identify OS/stack behavior. A sensor flags and drops it.

Use case. Configuring an IDS/IPS rule to alert on Xmas or NULL scan packets.

Comparison. Normal flag sets (connection lifecycle) vs abnormal sets (reconnaissance/probes).

Common mistakes. Treating all flag anomalies as attacks (some are buggy stacks); blocking legitimate traffic with overly broad rules.

Exam points. Name normal vs suspicious flag combinations; state what an Xmas or NULL scan is used for.

Self-check. Q: Which scan sets all TCP flags? A: Xmas scan (FIN+URG+PSH, often shown with all flags).

2.5 Service inventory

Definition and why it matters. A service inventory (which hosts run which services on which ports) is the foundation of asset management and vulnerability management; unknown services are unmanaged risk.

Core theory. Inventory: host, IP, MAC, open ports, service, version, owner, business criticality. Build via authorized scans, DHCP logs, network-access control, and agent inventories. Review regularly; unknown or unauthorized services are findings.

Worked example. Inventory row: 10.0.5.12 | server-01 | port 22 SSH OpenSSH 8.2 | port 443 HTTPS nginx | owner: IT team | critical: high. An unknown device on port 3389 (RDP) is flagged.

Use case. A college IT team inventories lab machines each semester and removes unauthorized services.

Comparison. Authorized inventory (known, approved) vs shadow IT (unknown, unmanaged).

Common mistakes. Never updating the inventory (stale = useless); scanning without authorization.

Exam points. List inventory fields; state why unknown services are findings.

Self-check. Q: What is shadow IT? A: Unknown/unmanaged systems or services not in the inventory.

2.6 Governance of discovery

Definition and why it matters. Asset discovery (scanning, enumeration) must be governed: authorized, scoped, scheduled, and communicated, so it is lawful and does not disrupt operations.

Core theory. Governance elements: written authorization (signatories), scope (in/out of scope systems), testing window and blackout periods, permitted vs forbidden techniques (no denial-of-service, destructive actions unless agreed), data handling (protect and destroy sensitive data seen), emergency contacts and stop conditions, reporting and retention.

Worked example. A rules-of-engagement document: scope = college lab VLAN only; window = weekends 02:00–06:00; forbidden = DoS and social engineering; stop condition = service degradation; emergency contact = IT head.

Use case. A student performs lab discovery only after signing the ROE.

Comparison. Governed discovery (authorized, scoped) vs unauthorized scanning (illegal, disruptive).

Common mistakes. Scanning production systems during business hours; scanning systems out of scope (e.g., cloud or third-party hosts).

Exam points. List ROE elements; state why written authorization is required.

Self-check. Q: What must exist before scanning any network? A: Written authorization and a defined scope.

2.7 Seeing the ideas: perimeter hardware, the TCP header, the handshake and the flag byte

Definition and why it matters. This topic visualizes perimeter hardware, TCP header fields, the handshake flow, and flag-byte classification together.

Core theory. Perimeter hardware (firewall, IDS/IPS) inspects TCP headers and flags. Handshake flow: SYN → SYN-ACK → ACK. Flag byte: combinations classified as normal or suspicious (Xmas, NULL, SYN+FIN).

Worked example. Firewall sees SYN to port 443 → allows per policy. IDS sees Xmas flags → alerts and drops. Handshake completes → encrypted session begins.

Use case. Explaining to a junior analyst what a perimeter device sees in a packet capture.

Comparison. Perimeter packet inspection vs endpoint inspection.

Common mistakes. Assuming the firewall sees inside TLS (it sees IP/port, not content); classifying all unusual flags as malicious without context.

Exam points. Sketch a handshake; classify a flag byte as normal/suspicious.

Self-check. Q: Does a perimeter firewall see the HTTP URL inside HTTPS? A: No.


Unit 2 summary

Unit 2 covers network layers and what each reveals, the TCP header (RFC 793), handshake and sequence arithmetic, flag-combination classification, service inventory, and discovery governance. Students should trace a handshake, classify flag combinations, and state ROE requirements for discovery.


Unit 3: Authentication, Entropy, Key Derivation and Access Control Models (7 hours)

Key terms

  • Authentication factor: something you know/have/are.
  • MFA: multi-factor authentication (two or more factors).
  • Entropy: unpredictability of a secret, H = L × log₂(R) bits.
  • Key derivation: turning a password into a cryptographic key with a work factor.
  • PBKDF2 / bcrypt / scrypt / Argon2: password-based key-derivation functions.
  • DAC / MAC / RBAC / ABAC: access-control models.
  • Salt: random per-user value added before hashing.

3.1 Authentication factors

Definition and why it matters. Authentication proves identity; using multiple independent factors greatly reduces the value of a stolen password.

Core theory. Factors: knowledge (password, PIN), possession (security key, phone, token), inherence (fingerprint, face). MFA combines factors from different families. Phishing-resistant factors (FIDO2/WebAuthn, passkeys) bind to the origin and cannot be replayed on a lookalike site. SMS codes and TOTP are better than nothing but can be intercepted or relayed.

Worked example. Bank login: password + FIDO2 security key. A phishing site captures the password but cannot produce the key's origin-bound response, so the attack fails.

Use case. Enabling MFA on email, banking, and admin accounts.

Comparison. Single factor (password only) vs MFA (two+ factors) vs phishing-resistant MFA (security keys/passkeys).

Common mistakes. Relying on SMS alone where a security key is available; thinking MFA removes all risk (it reduces, not eliminates).

Exam points. List the three factor families; state the MFA benefit; name a phishing-resistant factor.

Self-check. Q: Is a fingerprint a knowledge, possession, or inherence factor? A: Inherence.

3.2 Entropy of a secret

Definition and why it matters. Entropy measures password/passphrase unpredictability and directly relates to cracking time.

Core theory. Entropy H = L × log₂(R) bits, where L = length, R = size of symbol set. An 8-character password from 36 symbols: H = 8 × log₂(36) ≈ 41 bits. Keyspace = R^L = 2^H. Cracking time at G guesses/second ≈ keyspace / (2G) on average.

Worked example. 8 chars, 36 symbols: keyspace = 36⁸ ≈ 2.8×10¹² ≈ 2⁴¹. At 10 guesses/sec online → ≈ 8,946 years to exhaust (half on average). At 10¹⁰/sec offline → ≈ 282 seconds. With bcrypt (~10⁴/sec) → ≈ 9 years.

Use case. Explaining why long passphrases and slow hashing matter.

Comparison. Online attack (throttled, network-bound) vs offline attack (fast after a hash breach).

Common mistakes. Equating length with entropy regardless of symbol set; using short passwords with many symbols vs long passphrases.

Exam points. State the entropy formula; compute keyspace and cracking time for a small example.

Self-check. Q: Does H = L × log₂(R) use symbols count R raised to L for keyspace? A: Yes, keyspace = R^L = 2^H.

3.3 Work factors and key derivation

Definition and why it matters. Passwords must be stored as slow, salted hashes so offline cracking is expensive; key-derivation functions add cost per guess.

Core theory. KDFs: PBKDF2-HMAC (iterations, e.g., ≥600,000 for SHA-256 per OWASP; low memory), bcrypt (cost 2ⁿ, 72-byte input limit), scrypt (memory-hard), Argon2id (memory-hard, RFC 9106; OWASP minimum ~19 MiB, 2 passes, 1 lane). Each uses a unique random salt per user. Work factor makes mass guessing expensive but verification still feasible.

Worked example. Store: salt + Argon2id(password, salt, memory=64 MiB, iterations=3, parallelism=4). To verify, recompute with the stored salt and compare. Two users with identical passwords have different salts → different stored values.

Use case. A website user database where the hash file is stolen; slow hashing buys time to force password resets.

Comparison. Fast hash (SHA-256, unsuitable for passwords — GPU cracking) vs slow salted KDF (suitable).

Common mistakes. Storing unsalted fast hashes; reusing one salt for all users (rainbow tables); using too few iterations.

Exam points. Recommend KDFs; state why salt must be unique per user; give OWASP PBKDF2/Argon2 guidance.

Self-check. Q: Why must a salt be unique per user? A: Prevents rainbow tables and identical passwords producing identical hashes.

3.4 Access control models

Definition and why it matters. After authentication, authorization decides what a user may do. Access-control models structure these decisions.

Core theory. DAC (discretionary access control): owner decides access (e.g., file permissions). MAC (mandatory access control, e.g., Bell–LaPadula: no read up, no write down): central policy. RBAC (role-based access control): permissions assigned to roles, users assigned roles; separation of duties (no one holds conflicting roles). ABAC (attribute-based access control): decisions based on user/resource/environment attributes.

Worked example. RBAC: role "clerk" can create invoices; role "auditor" can view invoices only; a user must not hold both auditor and clerk (separation of duties).

Use case. A college system: students can view own grades; lecturers can enter grades for their courses; administrators manage accounts.

Comparison. DAC (owner-controlled) vs MAC (policy-controlled) vs RBAC (role-controlled) vs ABAC (attribute-controlled).

Common mistakes. Giving everyone admin "for convenience"; one person holding both requester and approver roles (no separation of duties).

Exam points. Describe DAC, MAC, RBAC, ABAC with one example each; state separation of duties.

Self-check. Q: In RBAC, who is assigned permissions? A: Roles (users are assigned to roles).

3.5 Practical guidance

Definition and why it matters. Translating authentication and access-control theory into everyday actions: MFA, long passphrases, breach screening, least privilege, recovery planning.

Core theory. Use MFA everywhere important; prefer phishing-resistant factors; allow long passphrases (64+ chars, spaces allowed); screen against breached-password lists; store passwords with slow salted hashes; rate-limit and alert on failed logins; apply least privilege after login; plan safe account recovery (backup codes, verified contacts, delays).

Worked example. Policy: every admin account requires FIDO2 key + password; password reset requires backup code + verified email + 24-hour delay for sensitive accounts.

Use case. A college IT security policy for staff and student accounts.

Comparison. Guidance (practice) vs theory (models/formulas).

Common mistakes. Allowing password reset without identity verification (recovery is the weakest door); not rate-limiting logins.

Exam points. List practical authentication/access-control controls.

Self-check. Q: What is the weakest door in account security often? A: Account recovery.

3.6 Seeing the ideas: factors in hardware, entropy bars and access models

Definition and why it matters. Visualizing hardware authenticators, entropy as bar lengths, and access-control models as decision structures.

Core theory. Hardware factors: security key, phone, fingerprint reader. Entropy bars: longer bars = more bits = harder to crack. Access models: DAC (owner arrow), RBAC (user→role→permission), ABAC (attribute rules).

Worked example. Entropy bar for an 8-char password (~41 bits) vs a 5-word Diceware passphrase (~64 bits): the passphrase bar is longer and easier to remember.

Use case. Explaining to users why a long passphrase beats a short complex password.

Comparison. Hardware token (possession) vs biometric (inherence) vs password (knowledge).

Common mistakes. Drawing entropy bars without labeling bits; mixing up RBAC and ABAC diagrams.

Exam points. Sketch an RBAC model; compare entropy bars qualitatively.

Self-check. Q: Which gives more entropy: short complex password or long passphrase? A: Usually the long passphrase (length dominates).


Unit 3 summary

Unit 3 covers authentication factors and MFA, entropy and password strength, key derivation (PBKDF2, bcrypt, scrypt, Argon2), and access-control models (DAC, MAC, RBAC, ABAC). Students should compute entropy, recommend a KDF, and contrast access models.


Unit 4: Secure Application Engineering (8 hours)

Key terms

  • Secure development lifecycle (SDL): security in every phase (design, code, test, deploy).
  • Input validation: accept only expected type/length/format (allow-list).
  • Output encoding: encode data for its output context (HTML, URL, JS).
  • Parameterised query: SQL with placeholders; values sent separately.
  • Content Security Policy (CSP): header restricting resource sources.
  • Cookie flags: Secure, HttpOnly, SameSite.
  • CSRF: cross-site request forgery; mitigated by tokens and SameSite.
  • Least privilege: app DB account accesses only needed tables.

4.1 Secure development lifecycle

Definition and why it matters. Security built in from design is cheaper and more effective than bolted-on fixes after deployment.

Core theory. SDL phases: requirements (security/abuse cases), design (threat modelling, secure patterns), implementation (secure coding, code review), testing (SAST/DAST, pen test), deployment (hardened config), maintenance (patch, monitor). Threat modelling before coding; security review before release.

Worked example. A team threat-models a login feature (STRIDE), codes with parameterised queries, runs SAST, then pen-tests before launch.

Use case. A student capstone applies SDL: design review → code → test → deploy.

Comparison. SDL (security throughout) vs patch-after-breach (expensive, reactive).

Common mistakes. Security considered only at the end; skipping design review.

Exam points. List SDL phases; state why threat modelling precedes implementation.

Self-check. Q: Should threat modelling happen before or after coding? A: Before (during design).

4.2 Validate input, encode output

Definition and why it matters. Validation keeps bad data out; encoding keeps data from being interpreted as code in its output context. Together they stop injection and XSS.

Core theory. Input validation: allow-list type, length, range, format before use (e.g., phone field accepts digits and + only). Reject everything else with a clear error. Output encoding: encode for HTML, URL, JavaScript, or CSS context when inserting untrusted data; modern template engines do this by default. Validation ≠ encoding; both are needed.

Worked example. A comment field: validate length ≤ 500 and allowed characters; when rendering, HTML-encode so <script> becomes text, not running code.

Use case. A user profile form that prevents XSS via validation + output encoding.

Comparison. Validation (input, allow-list) vs encoding (output, context-specific).

Common mistakes. Validating but not encoding (XSS still possible); encoding but not validating (bad data stored).

Exam points. Describe validation and encoding; give an XSS example stopped by encoding.

Self-check. Q: Where does output encoding happen? A: At output, for the target context (HTML/URL/JS).

4.3 Parameterised queries

Definition and why it matters. Parameterised queries separate SQL code from data, preventing SQL injection — a top web risk.

Core theory. Send the SQL template with placeholders first, then values separately; the database treats values as data, never code. Never join user text into a query string. Placeholders cannot be used for table/column names; validate those via allow-list.

Worked example. Unsafe: SELECT * FROM users WHERE name = ' + name + '. Safe (SQLite/Python): SELECT * FROM users WHERE name = ?, (name,). If name = '; DROP TABLE users;--, the safe query looks for a user literally named that string — no harm.

Use case. A login endpoint that never builds SQL from user input.

Comparison. String concatenation (vulnerable) vs parameterised query (safe).

Common mistakes. Using placeholders for identifiers (table/column names); building "dynamic ORDER BY" by concatenation without allow-list.

Exam points. Show safe vs unsafe SQL; explain why placeholders stop injection.

Self-check. Q: Can placeholders be used for table names? A: No — use an allow-list for identifiers.

4.4 Content Security Policy

Definition and why it matters. CSP is an HTTP header that restricts where browsers may load resources, reducing XSS and data-injection impact.

Core theory. Directives: default-src (fallback), script-src (where scripts load), object-src ('none' disables plugins), base-uri (restricts ), frame-ancestors (who may embed — replaces clickjacking headers). Sources: 'self', explicit hosts, nonces/hashes. Avoid '*' and 'unsafe-inline'. Use Content-Security-Policy-Report-Only to test before enforcing.

Worked example. Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted.cdn.example; object-src 'none'; frame-ancestors 'none'.

Use case. A college portal sets CSP so only its own scripts and one trusted CDN run.

Comparison. CSP (resource restriction) vs input validation/encoding (injection prevention) — layered.

Common mistakes. Using 'unsafe-inline' (defeats CSP); not testing with Report-Only before enforcing.

Exam points. List CSP directives and source keywords; state why 'unsafe-inline' is avoided.

Self-check. Q: What does object-src 'none' do? A: Disables plug-in content.

4.5 Cookies, sessions and CSRF

Definition and why it matters. Cookies carry session state; CSRF tricks a browser into sending state-changing requests. Proper cookie flags and tokens mitigate both.

Core theory. Cookie flags: Secure (HTTPS only), HttpOnly (not readable by JS), SameSite (controls cross-site sending; Strict/Lax). Session: long random ID, regenerate at login/privilege change, idle and absolute timeouts, server-side invalidation at logout. CSRF: add a secret per-session token to state-changing forms and verify server-side; never change state with GET. SameSite already blocks classic forged form posts.

**Worked example. Login flow: server sets session cookie (Secure, HttpOnly, SameSite=Lax), regenerates session ID after login. A state-changing form includes token csrf=random; server verifies it matches the session.

Use case. A banking site where a malicious site cannot forge a transfer because it lacks the CSRF token and cookies are SameSite.

Comparison. Cookie flags (protect cookie itself) vs CSRF token (protects state-changing requests).

Common mistakes. Storing secrets in cookies; using GET for state changes; constant CSRF token for all users.

Exam points. List cookie flags; describe CSRF token verification; state why not GET for state changes.

Self-check. Q: What does HttpOnly do? A: Prevents page JavaScript from reading the cookie.

4.6 Further hardening

Definition and why it matters. Additional controls reduce the attack surface: secrets management, dependency updates, safe logging, fail-safe errors, and security headers.

Core theory. Keep secrets (passwords, API keys) out of code — use environment variables or a secrets vault; rotate leaked keys. Track and patch dependencies (old libraries introduce flaws). Log logins/access failures/admin actions without writing passwords. Show users generic errors; keep details in server logs. Security headers: CSP, X-Content-Type-Options, Referrer-Policy, frame protections.

Worked example. A deployment reads DB_PASSWORD from an environment variable, never hardcoded; dependency scan flags an old library; the team patches it.

Use case. A college app stores API keys in a vault, not in GitHub.

Comparison. Secrets in code (leaked within minutes) vs secrets in vault/environment (controlled, rotatable).

Common mistakes. Committing a .env with keys to a public repository; logging passwords.

Exam points. State secret-management and dependency-update practices; describe safe error handling.

Self-check. Q: Where should API keys never be stored? A: In source code / public repositories.

Definition and why it matters. This topic visualizes the SDL, parameterised-query flow, cookie-flag combinations, and the validate→encode pipeline.

Core theory. SDL: design → code → test → deploy → maintain. Query flow: template with placeholders → values separately → database treats values as data. Cookie flags: Secure+HttpOnly+SameSite combined. Pipeline: validate input → (process) → encode output.

Worked example. A request: validate the email format → query DB with parameterised statement → render result with HTML encoding → set session cookie Secure/HttpOnly/SameSite.

Use case. A code-review checklist covering SDL, queries, cookies, and output encoding.

Comparison. Validation (keeps bad data out) vs encoding (keeps data from becoming code).

Common mistakes. Encoding at input instead of output; setting a session cookie without Secure.

Exam points. Sketch the validate–encode pipeline; list cookie flags.

Self-check. Q: Should validation happen at input and encoding at output? A: Yes.


Unit 4 summary

Unit 4 covers the secure development lifecycle, input validation and output encoding, parameterised queries, Content Security Policy, cookies/sessions/CSRF, and further hardening (secrets, dependencies, logging, headers). Students should write a safe parameterised query and list CSP directives and cookie flags.


Unit 5: Network Defence Architecture, DNSSEC, Wi-Fi Keys, Rate Limiting and ACLs (6 hours)

Key terms

  • Network segmentation: splitting a network into zones (DMZ, internal, restricted).
  • DMZ: demilitarized zone holding public-facing servers.
  • Default deny: block everything not explicitly allowed.
  • DNSSEC: DNS Security Extensions — signed DNS responses.
  • ZSK / KSK / DNSKEY / RRSIG / DS: DNSSEC keys and records.
  • WPA2 / WPA3: Wi-Fi Protected Access (PSK or Enterprise).
  • SAE: Simultaneous Authentication of Equals (WPA3 handshake).
  • Token bucket: rate-limiting algorithm (burst capacity B, rate r).
  • ACL: access control list; first-match evaluation; shadowing.

5.1 Architecture of a defended network

Definition and why it matters. Segmentation and zoning limit blast radius: if one zone is compromised, others remain protected by firewalls between zones.

Core theory. Zones: public (DMZ — web/mail servers), internal (staff devices), restricted (servers/database). Firewalls between zones with default deny. Zero trust at the network layer: never trust by network location; verify each flow. A college separates lab, staff, and database networks.

Worked example. Web server in DMZ; staff laptops in internal VLAN; student-record database in restricted VLAN. Firewall allows internet→DMZ port 443, DMZ→database port 5432 only, and blocks everything else.

Use case. Designing a defensible college network layout.

Comparison. Flat network (one broadcast domain, high risk) vs segmented network (zones, firewalls between).

Common mistakes. Putting the database in the DMZ; no firewall between internal zones.

Exam points. Describe zones and default deny; state why databases should not be in the DMZ.

Self-check. Q: Which zone holds publicly accessible servers? A: The DMZ.

5.2 DNS and DNSSEC

Definition and why it matters. DNS maps names to IP addresses; without protection, responses can be forged (cache poisoning, redirection to fake sites). DNSSEC signs responses so resolvers can verify authenticity.

Core theory. A zone signs record sets with a zone signing key (ZSK), publishing the signature as RRSIG and the public key as DNSKEY. A key signing key (KSK) signs the DNSKEY set; a hash of the KSK is published as a DS record in the parent zone, which is itself signed. The resolver starts from the root trust anchor and follows DS→DNSKEY down the hierarchy. A failed check yields validation failure, not a forged answer. NSEC/NSEC3 give authenticated denial of existence.

Worked example. Resolver validates example.com: root → .com (DS) → example.com DNSKEY (verified via KSK/DS) → A record (verified via ZSK/RRSIG). If any signature fails, the resolver returns a validation failure.

Use case. Enabling DNSSEC validation on college resolvers to protect users from fake bank sites.

Comparison. Plain DNS (responses not authenticated) vs DNSSEC (signed, verifiable).

Common mistakes. Thinking DNSSEC encrypts queries (it authenticates, does not encrypt); assuming signing your zone protects you if your resolver doesn't validate.

Exam points. Name DNSSEC record types (ZSK, KSK, DNSKEY, RRSIG, DS, NSEC/NSEC3); describe the chain of trust.

Self-check. Q: Does DNSSEC encrypt DNS queries? A: No — it authenticates responses.

5.3 Wi-Fi security: WPA2 and WPA3

Definition and why it matters. Wi-Fi broadcasts radio; encryption and authentication protect traffic and access. WPA3 is the current stronger standard; WPA2 remains common.

Core theory. WPA2-Personal uses a pre-shared key (PSK) and a 4-way handshake deriving PMK/PTK/GTK/KEK/TK. WPA2-Enterprise uses 802.1X/RADIUS with per-user credentials. WPA3 uses SAE (dragonfly) handshake, providing forward secrecy and resistance to offline dictionary attacks on weak passwords. WEP is broken and must not be used.

Worked example. WPA3 SAE: both sides commit to a password-derived element and exchange confirmations; an offline capture of the handshake does not reveal the password (forward secrecy), unlike WPA2-Personal where a weak PSK can be cracked from a captured handshake.

Use case. Campus Wi-Fi (WPA2-Enterprise with RADIUS) vs home Wi-Fi (WPA3 or WPA2-Personal with a long passphrase).

Comparison. WPA2 (widely deployed, PSK crackable if weak) vs WPA3 (forward secrecy, stronger).

Common mistakes. Using WEP; short/common Wi-Fi passwords; not separating guest Wi-Fi from the office network.

Exam points. Contrast WPA2 and WPA3; describe the 4-way handshake purpose; state why WEP is unusable.

Self-check. Q: What does WPA3 SAE provide that WPA2-Personal lacks? A: Forward secrecy and resistance to offline dictionary attacks.

5.4 Rate limiting with a token bucket

Definition and why it matters. Rate limiting protects availability by capping request rates while allowing normal bursts.

Core theory. Token bucket: bucket capacity B, fill rate r tokens/second. Each request consumes a token; if none, reject. Max accepted in time t ≈ B + r×t. Bursts up to B are allowed; sustained excess is rejected. Apply to login, OTP, and search endpoints.

Worked example. B = 20, r = 10/sec. 15 requests arrive at once: bucket starts full → 10 accepted, 5 rejected (limited by arrival, not bucket). Over 10 seconds at 100/sec → 1000 requests; accepted ≈ B + r×10 = 20 + 100 = 120 theoretical, simulation ~59–60 depending on timing.

Use case. Rate-limiting a login endpoint to slow password guessing.

Comparison. Token bucket (allows bursts, smooths rate) vs fixed-window counter (allows burst at window edges).

Common mistakes. Rate-limiting only by IP (shared NAT = many users); not applying to sensitive endpoints (login, password reset).

Exam points. Describe token-bucket parameters; compute accepted requests for a burst.

Self-check. Q: With B = 20 and r = 10/sec, what is the max accepted in 5 seconds? A: B + r×5 = 20 + 50 = 70 theoretical.

5.5 First-match ACLs and shadowing

Definition and why it matters. ACLs filter traffic by ordered rules; first-match means order matters, and an early broad rule can shadow a later specific one.

Core theory. Rules evaluated top to bottom; first match wins. Default deny at the end. Shadowing: an early allow-all rule hides a later deny rule. Review and test ACLs with sample packets after every change.

**Worked example. Rules: (1) allow 10.0.0.0/8 to port 443; (2) deny all to port 443. Packet from 10.0.0.5:443 matches rule 1 → allowed. If rule 2 (deny all) came first, it would be shadowed by nothing but would block everything — order determines outcome.

Use case. A firewall ACL permitting a lab subnet to an internal server while denying everyone else.

Comparison. First-match (order matters) vs best-match (longest prefix, used in routing).

Common mistakes. Placing a broad allow before a specific deny; not testing ACLs after changes.

Exam points. Explain first-match and shadowing; show rule reordering effect.

Self-check. Q: In a first-match ACL, what happens if an early rule matches? A: Later rules are not evaluated.

5.6 Operating the controls

Definition and why it matters. Controls must be operated: logs collected, alerts tuned, devices patched, backups kept, and access reviewed.

Core theory. Collect firewall, DNS, and authentication logs centrally with synchronized clocks; alert on unusual patterns (sudden rise in denied connections). Patch firewalls/routers (they have vulnerabilities too); store configuration backups offline; keep logs long enough (e.g., 90 days) for investigation.

Worked example. After a firewall rule change, a capture confirms blocked traffic really stops; a sudden rise in denied connections triggers investigation.

Use case. A college SOC reviews centralized logs daily and patches edge devices monthly.

Comparison. Deploying a control (install) vs operating it (monitor, patch, review).

Common mistakes. Installing a firewall and never reviewing logs; keeping backups online (ransomware can encrypt them).

Exam points. List operating activities (logging, patching, backups, review).

Self-check. Q: Why keep configuration backups offline? A: So ransomware cannot encrypt them.

5.7 Seeing the ideas: network hardware, zones, the DNSSEC chain, Wi-Fi keys and the token bucket

Definition and why it matters. This topic visualizes defended-network zones, the DNSSEC chain of trust, Wi-Fi key derivation, and token-bucket rate limiting together.

Core theory. Zones separated by firewalls; DNSSEC chain root→TLD→zone via DS/DNSKEY/RRSIG; WPA2/WPA3 derive PMK/PTK/GTK/KEK/TK; token bucket B and r smooth traffic bursts.

Worked example. A diagram: internet → firewall → DMZ (web), internal (staff), restricted (DB). DNSSEC resolver chain. Wi-Fi 4-way handshake. Token bucket accepting/rejecting packets.

Use case. Presenting network defence layers to management.

Comparison. Perimeter firewall vs internal segmentation vs endpoint controls.

Common mistakes. Drawing zones without firewall rules between them; omitting the trust anchor in DNSSEC.

Exam points. Sketch zoned network and DNSSEC chain; describe token bucket.

Self-check. Q: What is the DNSSEC trust anchor? A: The root zone's public key configured in the validating resolver.


Unit 5 summary

Unit 5 covers defended-network architecture (zones, DMZ, default deny), DNSSEC (ZSK/KSK/DNSKEY/RRSIG/DS, chain of trust), Wi-Fi security (WPA2/WPA3, SAE), token-bucket rate limiting, ACLs (first-match, shadowing), and operating controls (logs, patching, backups).


Unit 6: Intrusion Detection, Alert Statistics, Incident Response and Digital Forensics (6 hours)

Key terms

  • IDS: intrusion detection system (alerts only); NIDS (network) / HIDS (host).
  • IPS: intrusion prevention system (alerts + blocks).
  • SIEM: security information and event management (centralized alerts).
  • Confusion matrix: TP, TN, FP, FN; TPR, FPR, precision, accuracy, F1.
  • Base-rate fallacy: low prevalence makes even accurate detectors produce many false alerts.
  • Incident response: preparation, detection/analysis, containment/eradication/recovery, post-incident.
  • Chain of custody: recorded handling of evidence; hash-chained logs make tampering detectable.
  • SHA-256: hash used to verify forensic image integrity.

6.1 Detection systems

Definition and why it matters. Detection systems spot malicious or anomalous activity and alert (IDS) or block (IPS), complementing firewalls that filter by header.

Core theory. IDS types: network-based (NIDS, sees traffic) and host-based (HIDS, sees a host). Detection methods: signature-based (known patterns — accurate for known threats, silent on new), anomaly-based (baseline of normal — catches novel, more false alarms), stateful/behavioural rules (e.g., many failed logins then success). SIEM centralizes and correlates alerts.

Worked example. A NIDS sees many SYN packets from one host to many ports → port-scan alert. Signature-based IDS matches a known exploit byte pattern. Anomaly-based flags a 100× outbound DNS spike (possible exfiltration).

Use case. Detecting brute-force login attempts on a college portal.

Comparison. IDS (detect/alert) vs IPS (detect/alert/block); signature (known) vs anomaly (novel, false positives).

Common mistakes. Relying only on signatures (misses zero-days); not tuning baselines (alert fatigue).

Exam points. Describe IDS vs IPS; contrast signature and anomaly detection; name NIDS vs HIDS.

Self-check. Q: Can an IDS block traffic by itself? A: No — IDS alerts; IPS blocks.

6.2 The confusion matrix

Definition and why it matters. The confusion matrix quantifies detector performance: true/false positives/negatives, from which TPR, FPR, precision, accuracy, and F1 are derived.

Core theory. TP (attack detected), TN (benign correctly ignored), FP (benign flagged), FN (attack missed). TPR = TP/(TP+FN) = recall. FPR = FP/(FP+TN). Precision = TP/(TP+FP). Accuracy = (TP+TN)/total. F1 = 2TP/(2TP+FP+FN).

Worked example. TP=45, FN=5, FP=200, TN=9750. TPR = 45/50 = 0.90. FPR = 200/9950 ≈ 0.020. Precision = 45/245 ≈ 0.184. Accuracy = 9795/10000 = 0.9795. F1 = 90/(90+200+5) = 90/295 ≈ 0.305.

Use case. Evaluating an IDS: high accuracy (98%) but low precision (18%) means most alerts are false — analysts waste time.

Comparison. Accuracy (good for balanced classes) vs precision/recall (better for rare attacks).

Common mistakes. Using accuracy alone for rare events (a detector that always says "benign" is accurate but useless).

Exam points. Define TP/TN/FP/FN; compute TPR, FPR, precision, accuracy, F1.

Self-check. Q: TPR = TP ÷ what? A: (TP + FN).

6.3 The base-rate fallacy

Definition and why it matters. When attacks are rare, even a low false-positive rate produces many false alerts, overwhelming analysts — the base-rate fallacy.

Core theory. P(malicious | alert) depends on prevalence. By Bayes' rule: with TPR 95%, FPR 2%, prevalence 0.5%, P(malicious|alert) = (0.95×0.005) / (0.95×0.005 + 0.02×0.995) ≈ 0.00475 / 0.02465 ≈ 0.193 (19%). So ~81% of alerts are false despite a good detector.

Worked example. 10,000 events, 50 malicious. Detector catches 47.5 (TPR 95%) and flags 199 benign (FPR 2% of 9,950). Total alerts ≈ 246.5; only ~47.5 are real → ~19% precision.

Use case. Triage design: rank alerts by asset value and severity; analysts cannot review 1,000 alerts/day.

Comparison. High prevalence (most alerts real) vs low prevalence (most alerts false).

Common mistakes. Judging a detector by TPR/FPR alone without considering prevalence.

Exam points. Compute P(malicious|alert) with Bayes' rule; state the implication for alert design.

Self-check. Q: Does a low FPR guarantee most alerts are real when attacks are rare? A: No — base rate matters.

6.4 Incident response lifecycle

Definition and why it matters. Incident response is a structured process to handle security incidents with minimal damage and preserved evidence.

Core theory. Phases: preparation (plan, team, contacts, tooling, exercises), detection and analysis (identify, validate, scope, severity, preserve evidence, notify), containment/eradication/recovery (isolate hosts, disable accounts, remove cause, patch, rotate credentials, restore from clean backups, monitor), post-incident (blameless review, lessons learned, update controls, metrics like time-to-detect/recover).

Worked example. Ransomware detected: isolate infected hosts (keep powered if memory evidence needed), remove malware, restore from clean backups, reset credentials, hold a blameless review within days.

Use case. A college computer-lab malware outbreak handled by the IR plan.

Comparison. Preparation (before) vs post-incident activity (after).

Common mistakes. Wiping too early (destroys evidence); not notifying the right parties; blaming individuals.

Exam points. List the four phases with one activity each; explain order of volatility.

Self-check. Q: Which IR phase includes restoring from clean backups? A: Containment, eradication and recovery.

6.5 Digital forensics

Definition and why it matters. Digital forensics collects, preserves, analyzes, and reports digital evidence in a way that is admissible and verifiable.

Core theory. Order of volatility: memory, network state, running processes, disk, logs, backups (most volatile first). Preservation: write blocker, bit-for-bit image, SHA-256 hash of original and copy (equal hashes = exact copy). Work only on copies. Analysis: files, deleted data, logs, browser history, timelines on the verified copy. Reporting: methods, tools, hash values so another examiner can verify.

Worked example. Image a seized disk through a write blocker; compute SHA-256 of original (abc123...) and copy (abc123...) — equal → exact; analyze only the copy.

Use case. Investigating a suspected insider data exfiltration with forensically sound evidence.

Comparison. Forensic image (bit-for-bit, hashed) vs ordinary file copy (not verifiable).

Common mistakes. Analyzing the original (risks alteration); not recording the chain of custody.

Exam points. List order of volatility (five sources); describe hash-chained custody; state what a hash proves and cannot prove.

Self-check. Q: What does matching SHA-256 of original and copy prove? A: The copy is an exact bit-for-bit duplicate (integrity), not that the content is innocent.

6.6 Seeing the ideas: forensic hardware, sensor placement, the confusion matrix, the incident cycle and the custody chain

Definition and why it matters. This topic visualizes forensic hardware, IDS sensor placement, confusion-matrix metrics, the incident cycle, and the chain of custody together.

Core theory. Forensic hardware: write blocker, imager. Sensor placement: perimeter and internal taps. Confusion matrix: TP/FP/TN/FN rates. Incident cycle: prepare → detect → contain → recover → review. Custody chain: each handling event recorded and linked; hash chain makes tampering detectable.

Worked example. A forensic kit (write blocker + imager) at the scene; IDS sensor at the internet edge; confusion matrix computed from a week of alerts; custody log signed at each transfer.

Use case. A small college lab sets up a forensics-ready evidence process.

Comparison. Live analysis (volatile data first) vs post-mortem disk analysis.

Common mistakes. Skipping the custody log; imaging without a write blocker.

Exam points. Sketch the custody chain; list five volatile evidence sources in order.

Self-check. Q: What is captured first due to volatility? A: Memory (RAM).


Unit 6 summary

Unit 6 covers IDS/IPS/SIEM, confusion-matrix metrics (TPR, FPR, precision, accuracy, F1), the base-rate fallacy, the incident-response lifecycle, and digital forensics (order of volatility, hashing, chain of custody). Students should compute confusion-matrix metrics and outline incident response and evidence handling.


Unit 7: Security Audits, Penetration Testing Rules of Engagement and Nepal Cyber Law (6 hours)

Key terms

  • Security audit: compares systems/practice with a standard or policy; reports conformance and gaps.
  • Vulnerability assessment: identifies and rates weaknesses; prioritized list.
  • Penetration test: controlled attempt to demonstrate impact by chaining weaknesses.
  • Red team / purple team: adversary simulation vs cooperative improvement.
  • Rules of engagement (ROE): signed document defining scope, window, techniques, contacts, stop conditions.
  • SLE / ARO / ALE / ROSI: risk quantification (single loss expectancy, annualized rate of occurrence, annualized loss expectancy, return on security investment).
  • ETA 2063: Nepal Electronic Transactions Act 2063 (Sections 44–47, 52).
  • National Cyber Security Policy 2080: Nepal's cyber-security policy.

7.1 Audits, assessments and tests

Definition and why it matters. Audits, assessments, and penetration tests differ in depth and goal; choosing the right one gives management a true picture.

Core theory. Audit: compares systems and processes with a standard/policy, reports conformance and gaps (design and operating effectiveness). Vulnerability assessment: finds and rates weaknesses (scanners + manual validation), prioritized list. Penetration test: under controlled conditions, demonstrates what an adversary could achieve by chaining weaknesses. Red team: simulates an adversary against detection/response. Purple team: attackers and defenders cooperate.

Worked example. An audit finds the college backup job silently failed for months — better found in an audit than during ransomware.

Use case. Annual ISO/IEC 27001-aligned audit of a college IT department.

Comparison. Audit (conformance to standard) vs assessment (weakness list) vs pen test (demonstrated impact).

Common mistakes. Calling a vulnerability scan a "penetration test"; expecting a pen test to find all issues.

Exam points. Differentiate audit, assessment, pen test, red team, purple team.

Self-check. Q: Which activity demonstrates actual impact by chaining weaknesses? A: Penetration test.

7.2 The audit process

Definition and why it matters. A repeatable audit process produces credible findings that management can act on.

Core theory. Planning/scoping: objectives, criteria, systems in/out of scope, timetable, access, confidentiality. Evidence gathering: documents, config exports, interviews, observation, automated checks. Testing: design effectiveness (would the control work?) and operating effectiveness (did it work over the period?). Findings: condition, criteria, cause, effect, recommendation, risk rating. Reporting: report to management, agreed actions with owners and dates, re-testing.

Worked example. Audit finding: condition = backups not verified; criteria = policy requires weekly restore tests; cause = no owner assigned; effect = data loss risk; recommendation = assign owner and test monthly; rating = high.

Use case. An internal audit of college access controls.

Comparison. Design effectiveness vs operating effectiveness.

Common mistakes. Findings without owners/dates; not re-testing after remediation.

Exam points. List audit process steps; describe a finding's components (condition, criteria, cause, effect, recommendation).

Self-check. Q: What is operating effectiveness? A: Whether the control worked over the period.

7.3 Quantifying risk

Definition and why it matters. Risk quantification translates risk into money, helping prioritize spending and justify controls.

Core theory. Asset value (AV), exposure factor (EF = fraction lost in one incident). SLE = AV × EF. Annualized rate of occurrence (ARO = expected incidents/year). ALE = SLE × ARO. Return on security investment (ROSI) = (risk reduction − control cost) ÷ control cost. Four risk treatments: avoid, transfer, mitigate, accept.

**Worked example. Asset worth Rs 8,00,000, EF 25%, ARO 0.5 → SLE = Rs 2,00,000, ALE = Rs 1,00,000. A control costing Rs 30,000 halves ARO → ALE after = Rs 50,000; risk reduction = Rs 50,000/year; net benefit = Rs 20,000; ROSI = 20,000/30,000 = 66.7%.

Use case. Justifying a WAF purchase with ROSI.

Comparison. Qualitative risk (low/medium/high) vs quantitative (ALE/ROSI in currency).

Common mistakes. Using made-up AV/EF without data; comparing ROSI across unrelated controls.

Exam points. State SLE, ARO, ALE, ROSI formulas; list four risk treatments.

Self-check. Q: ALE = SLE × what? A: ARO.

7.4 Penetration testing: rules of engagement

Definition and why it matters. A penetration test is lawful only under written rules of engagement; without them, testing can be treated as unauthorized access.

Core theory. ROE elements: scope (systems in/out of scope, exclusions like life-critical or third-party hosts), authorized signatories (legal authority; provider consent for hosted systems), testing window and blackout periods, permitted vs forbidden techniques (no DoS/destructive unless agreed), data handling (protect and destroy sensitive data), emergency contacts and stop conditions (service degradation, real attacker), reporting and retention, legal indemnity and confidentiality in writing.

**Worked example. ROE: scope = college lab VLAN; signatory = IT head; window = weekend; forbidden = DoS; stop condition = service degradation; emergency contact = security lead; report within 10 days.

**Use case. A student performs a lab pen test only after the ROE is signed.

Comparison. Authorized test (signed ROE, in scope) vs unauthorized access (illegal regardless of intent).

Common mistakes. Testing cloud or third-party systems without provider consent; no written stop condition.

**Exam points. List eight ROE elements; state which two matter most for a hospital system (scope exclusions of life-critical systems, and stop conditions/emergency contacts).

Self-check. Q: Is good intent a defence for testing without written permission? A: No.

Definition and why it matters. Nepal's Electronic Transactions Act 2063 and National Cyber Security Policy 2080 define offences and penalties; security work must stay within them.

Core theory. ETA 2063 offences (reported sections 44–47 and 52) include unauthorized access, unauthorized interception, damage to computer systems/data, computer-related fraud, and misuse of devices; penalties include fines and imprisonment. The National Cyber Security Policy 2080 sets national cyber-security direction. Authorized testing needs written permission; Nepal Police Cyber Bureau handles cyber-crime complaints.

**Worked example. A student testing a college web server "to help" without permission engages unauthorized-access provisions. The lawful path: written permission, defined scope, in-scope systems only, report findings.

**Use case. Understanding legal risk before any lab testing; including a legal clause in the ROE.

Comparison. Authorized testing (legal, with permission) vs unauthorized access (criminal offence).

Common mistakes. Assuming "I was helping" excuses unauthorized access; not knowing which authority to notify.

**Exam points. State ETA 2063 offence categories; state the need for written authorization.

Self-check. Q: Which Nepal law covers computer-related offences? A: Electronic Transactions Act 2063.

7.6 Seeing the ideas: places under audit, the audit cycle, ALE, the test with its ROE gate and the penalty chart

Definition and why it matters. This topic visualizes audited places, the audit cycle, ALE money, the ROE gate before a test, and penalties under cyber law.

**Core theory. Places under audit: servers, networks, applications, data, physical sites, third-party/cloud hosts. Audit cycle: plan → gather evidence → test → find → report → act → re-test. ALE money: SLE × ARO per year. ROE gate: no test without signed scope and authorization. Penalty chart: ETA 2063 sections and maximum penalties.

**Worked example. A college audits its result-management system (application) and server room (physical); computes ALE for a likely outage; before any pen test, the ROE is signed (gate); unauthorized access would trigger ETA penalties.

**Use case. Briefing college leadership on audit, risk, and legal boundaries.

**Comparison. Audit cycle (continuous improvement) vs one-off test (snapshot).

**Common mistakes. Testing without the ROE gate; computing ALE with guessed values.

**Exam points. Sketch the audit cycle; state the ROE as a gate; name penalty-relevant ETA sections.

Self-check. Q: What is the "ROE gate"? A: No penetration test without a signed rules-of-engagement document.


Unit 7 summary

Unit 7 covers audits/assessments/pen tests, the audit process, risk quantification (SLE, ARO, ALE, ROSI, ROSI calculations), penetration-testing rules of engagement, and Nepal's cyber-law framework (ETA 2063, National Cyber Security Policy 2080). Students should compute ALE/ROSI and list ROE elements.


Unit 8: Ethical Hacking Methodology, Attack Categories and Their Defences (8 hours)

Key terms

  • Ethical hacking: authorized testing to find and fix weaknesses; follows ROE and law.
  • Hacker types: white hat (ethical, authorized), grey hat, black hat (criminal), script kiddie.
  • Cyber Kill Chain: reconnaissance, weaponisation, delivery, exploitation, installation, C2, actions on objectives.
  • MITRE ATT&CK: tactics (goals) and techniques (methods, with IDs and detection advice).
  • Footprinting: collecting target info (passive = public sources; active = touches target).
  • Scanning: host discovery, port scan, service/OS detection.
  • Enumeration: extracting accounts, shares, versions from services.
  • Password attacks: online (throttled) vs offline (fast after hash breach).
  • Malware: virus, worm, trojan, ransomware, rootkit, botnet, spyware, keylogger.
  • Sniffing / spoofing / session hijacking: capturing traffic, impersonating identity, taking over a session.
  • Social engineering: phishing, pretexting, baiting, tailgating, etc.
  • DoS / DDoS / botnet: denial of service, distributed, compromised hosts.
  • IDS / IPS / honeypot / honeytoken: detection/prevention and deception controls.
  • Birthday attack: finding collisions faster than brute force (≈2^(n/2)).

8.1 Hackers, hats and the phases of an attack

Definition and why it matters. Understanding attacker motivation and phases helps defenders place controls at the right points in an attack chain.

Core theory. White hat = ethical, authorized; grey hat = unauthorized but not criminal intent; black hat = criminal; script kiddie = uses tools without understanding. Five classic phases: reconnaissance, scanning/enumeration, gaining access, maintaining access, covering tracks. Mapped to Cyber Kill Chain (7 stages) and MITRE ATT&CK (tactics + techniques).

Worked example. Kill Chain: reconnaissance (WHOIS) → weaponisation (malicious doc) → delivery (phishing email) → exploitation (macro runs) → installation (backdoor) → C2 (beacon to attacker) → actions on objectives (exfiltrate data). Breaking any link stops the intrusion.

Use case. Mapping observed alerts to MITRE ATT&CK tactics to check detection coverage.

Comparison. White hat (authorized, improves security) vs black hat (criminal).

Common mistakes. Calling every hacker a "criminal" (white hats are authorized); assuming phases always happen in strict order.

**Exam points. List hacker types and the five phases; map to Kill Chain stages.

Self-check. Q: Which hacker type is authorized and ethical? A: White hat.

8.2 Footprinting and reconnaissance

Definition and why it matters. Reconnaissance gathers target information; passive methods are harder to detect, active methods leave traces.

Core theory. Passive: public sources (WHOIS, DNS, job postings, social media, code repositories) — no traffic to target. Active: querying the target's name servers, visiting and mapping the site — leaves logs. Defences: publish only what is needed, remove metadata from documents, use generic role mailboxes, split DNS, privacy services for WHOIS, monitor your own footprint.

**Worked example. Attacker finds a college's subdomains via public DNS and an exposed GitHub repo with a hardcoded key. Defence: the college removed metadata and rotated the exposed key.

**Use case. A red team's first step (authorized); a defender's self-reconnaissance.

**Comparison. Passive (no target traffic, harder to detect) vs active (touches target, logged).

**Common mistakes. Assuming passive reconnaissance is always legal (personal-data privacy/ethics questions remain).

**Exam points. List passive vs active sources; name three defender controls.

Self-check. Q: Does active footprinting leave traces in target logs? A: Yes.

8.3 Scanning and enumeration

Definition and why it matters. Scanning finds live hosts, open ports, and services; enumeration extracts usable details (accounts, shares, versions) for attack or defence.

Core theory. Host discovery (ping sweeps, ARP, port probes). Port scanning (TCP connect, SYN, FIN/Xmas, ACK, UDP) — which ports accept connections. Service/OS detection (banners, TCP/IP stack responses). Enumeration: SNMP, SMB shares, email DNS, user accounts. Defences: close unneeded ports, default-deny firewall, hide banners, patch, IDS alerts on scan-like behavior, scan yourself against the asset inventory.

**Worked example. A scan finds port 22 (SSH) and 443 (HTTPS) open on a server; enumeration reveals the SSH banner version. Defence: close unused ports, banner suppression, IDS alerts on SYN scans.

**Use case. A college lab scans its own subnet (authorized) and finds an unexpected open port — a finding.

**Comparison. Host discovery (who is alive) vs port scanning (which ports) vs enumeration (what details).

**Common mistakes. Scanning without authorization; acting on a single banner version without verification.

**Exam points. Compare connect/SYN/FIN/UDP scans; name three services that leak info and a countermeasure each.

Self-check. Q: What is enumeration? A: Extracting usable details (accounts, shares, versions) from services.

8.4 System hacking and password attacks

Definition and why it matters. Gaining access via weak credentials or flaws; password attacks illustrate why entropy and hashing matter.

**Core theory. Gaining access: exploit software flaws, weak passwords, misconfigurations, or people; then privilege escalation (vertical: user→admin; horizontal: same level, other user's data). Password attacks: online (guessing against a live service, throttled/locked) vs offline (attacker has stolen hashes, limited by hardware). Defences: MFA, long passphrases, breach screening, slow salted hashes, rate limiting, account lockout.

**Worked example. 8-char password from 36 symbols: keyspace ≈ 2.8×10¹². Online at 10/sec → ~8,946 years to exhaust (half on average). Offline at 10¹⁰/sec → ~282 seconds; with bcrypt (~10⁴/sec) → ~9 years. This shows why hash theft is critical.

**Use case. A stolen user database: attackers crack offline; strong hashing buys reset time.

**Comparison. Online attack (throttled) vs offline attack (fast, local).

**Common mistakes. Reusing passwords (credential stuffing); storing fast unsalted hashes.

**Exam points. Contrast online vs offline attacks; compute keyspace/cracking time; list defences.

Self-check. Q: Why is an offline password attack faster? A: No network delay or lockout; limited only by hardware.

8.5 Malware threats

Definition and why it matters. Malware families behave differently; defences differ accordingly. Knowing them underpins detection and response.

**Core theory. Virus (needs host/user action; four phases: dormant, propagation, triggering, execution), worm (self-propagating over networks), trojan (disguised legitimate), ransomware (encrypts files, demands payment), rootkit (hides itself/others), spyware (collects secretly), keylogger (records keystrokes), botnet (compromised hosts under C2). Worm-spread model: infections grow exponentially early, so manual response is too slow — automated patching/isolation needed.

**Worked example. SI model with N=10,000, contact rate 0.8, one initial infection: reaches 99% quickly, showing manual response is impractical without automation.

**Use case. Detecting ransomware on a lab machine; isolating a botnet-infected host.

**Comparison. Virus (needs action) vs worm (self-spreads) vs trojan (user runs) vs ransomware (encrypts for ransom).

**Common mistakes. Calling all malware "viruses"; relying only on antivirus (need patching, backups, least privilege).

**Exam points. Define six malware families; list the four virus phases.

Self-check. Q: Which malware self-propagates without user action? A: Worm.

8.6 Sniffing, spoofing and session hijacking

Definition and why it matters. These attacks intercept or falsify traffic and sessions; encryption and switched networks limit the damage.

**Core theory. Sniffing: capturing traffic (easier on hubs/wireless; harder on switched Ethernet but still possible via ARP spoofing). Spoofing: impersonating another address (IP/MAC/ARP). Session hijacking: taking over an authenticated session (steal session cookie/token). Defences: HTTPS everywhere (limits sniffing), HSTS, ARP spoofing defences (dynamic ARP inspection, DHCP snooping), switch port security, short session timeouts, HttpOnly/Secure/SameSite cookies.

**Worked example. ARP spoofing: attacker sends fake ARP replies to associate the gateway's IP with the attacker's MAC and intercepts traffic. Defence: dynamic ARP inspection on switch ports. HTTPS limits sniffing damage because traffic and cookies are encrypted.

**Use case. A lab detects ARP spoofing via dynamic ARP inspection alerts.

**Comparison. Sniffing (passive capture) vs spoofing (active impersonation) vs hijacking (take over session).

**Common mistakes. Assuming HTTPS prevents all sniffing (metadata still visible; endpoint compromise defeats it).

**Exam points. Define sniffing/spoofing/hijacking; name two switch features preventing ARP spoofing.

Self-check. Q: Does HTTPS eliminate all sniffing damage? A: No — it protects traffic content; metadata and endpoint compromise remain.

8.7 Social engineering and insider threats

Definition and why it matters. People are often the weakest link; social engineering exploits trust, urgency, and authority.

**Core theory. Techniques: phishing (email), vishing (voice), smishing (SMS), pretexting (fabricated scenario), baiting (offer something), tailgating (physical access), quid pro quo. Defences: verify out of band (call a known number), slow down when pushed, never share OTPs/PINs/passwords, check links and sender addresses, use phishing-resistant MFA (FIDO2), run simulated phishing and training, reward reporting, control physical access (badges, visitor logs, shredders, clean desk), payment changes need two-person approval and call-back to a known contact.

**Worked example. An email urges "urgent password reset" with a look-alike link. Defence: hover to see the real address, call the sender on a known number, never enter the OTP.

**Use case. A college runs simulated phishing and tracks the report rate (not just click rate).

**Comparison. Technical controls (firewall) vs human controls (training, verification).

**Common mistakes. Sharing an OTP because the caller sounds official; clicking links without checking sender.

**Exam points. List six social-engineering techniques and eight preventive measures.

Self-check. Q: Should you ever share an OTP? A: No — no real bank asks for it.

8.8 Denial of service and botnets

Definition and why it matters. DoS/DDoS and botnets threaten availability; defences combine network and application-layer controls.

**Core theory. DoS: one source overwhelms a target. DDoS: many sources (often a botnet). Amplification: small request → large response (DNS/NTP). Botnet: compromised hosts under C2. Defences: disable open resolvers and legacy monitor commands; rate-limit responses; ingress/egress filtering (BCP 38); SYN cookies and tuned backlog; CDN/anycast; scrubbing provider; application-layer rate limiting/caching/WAF; tested DDoS runbook; keep your own devices out of botnets (change defaults, patch, segment IoT).

**Worked example. A 100 Mbit/s attacker with a 50× amplifier sends 5 Gbit/s to the victim. A 128-entry backlog with a 60-second timeout stays full at roughly 128/60 ≈ 2.1 SYN/sec sustained (illustrative scale depends on timeout).

**Use case. A college website behind a CDN/scrubbing service absorbs a volumetric attack.

**Comparison. DoS (single source) vs DDoS (many/botnet) vs amplification (protocol abuse).

**Common mistakes. Over-provisioning alone (costly) without filtering; not testing the DDoS runbook.

**Exam points. Define DoS/DDoS/botnet; name four DDoS defences; explain amplification with an example.

Self-check. Q: What is amplification? A: A small request provokes a disproportionately large response.

8.9 Hacking web servers and web applications

Definition and why it matters. Web apps are common targets; hardening servers and applications reduces compromise.

**Core theory. Patch OS, web server, components; remove sample files/default accounts; disable directory listing and unneeded modules; run as low-privilege user; serve HTTPS only with current TLS, redirect HTTP, set HSTS; generic error pages (no stack traces/version banners); security headers (CSP, X-Content-Type-Options, Referrer-Policy, frame protections); WAF + rate limiting + central logging; test with authorized scanner and manual review, retest after each release.

**Worked example. A college web server: directory listing disabled, PHP info page removed, HTTPS+HSTS enforced, CSP header set, WAF in front, monthly authorized scan.

**Use case. Preparing a student-project deployment for the internet.

**Comparison. Default installation (samples, banners, listing on) vs hardened server.

**Common mistakes. Leaving default credentials and sample apps; showing stack traces to users.

**Exam points. List server-hardening steps; state why generic errors matter.

Self-check. Q: Should directory listing be enabled on a public web server? A: No — disable it.

8.10 Wireless, mobile, IoT and cloud attack surfaces

Definition and why it matters. Modern environments extend the attack surface beyond traditional PCs; each domain has specific risks.

**Core theory. Wireless: WPA2/WPA3, rogue APs, evil twin. Mobile: app sandboxing, OS updates, app permissions, MDM, lost-device wipe. IoT: default credentials, unpatched firmware, insecure services — segment IoT devices. Cloud: shared responsibility (provider secures cloud; customer secures data/config), misconfigurations (open buckets), IAM least privilege. Defences per domain as above.

**Worked example. An IoT camera with default admin/admin credentials on the office network → segmented into an IoT VLAN and firmware updated.

**Use case. A college audits cloud storage permissions and finds a public bucket — a customer-side misconfiguration.

**Comparison. Cloud provider security vs customer responsibility (shared responsibility).

**Common mistakes. Assuming the cloud provider handles all security; connecting IoT devices to the main network.

**Exam points. Describe shared responsibility; name four cloud misconfigurations; state IoT segmentation.

Self-check. Q: Under shared responsibility, who secures customer data in the cloud? A: The customer.

8.11 Evading detection: IDS, firewalls and honeypots

Definition and why it matters. Attackers try to evade detection; defenders use IDS, firewalls, honeypots, and honeytokens to detect and study them.

**Core theory. Evasion: fragmentation, encryption, protocol evasion, timing. IDS/IPS detect signature/anomaly. Honeypot: decoy system to attract and observe attackers. Honeytoken: fake data (credential, file) that alerts if used. Defences: updated signatures, anomaly baselines, honeypots in isolated segments, alert on honeytoken access.

**Worked example. A honeytoken AWS key is placed in a repository; any use triggers an immediate alert, revealing an intruder or leaker.

**Use case. A college places honeytokens in its grade database to detect unauthorized access.

**Comparison. Honeypot (decoy system) vs honeytoken (fake data) vs IDS (detection on real traffic).

**Common mistakes. Placing a honeypot on the production network without isolation.

**Exam points. Define IDS/IPS, honeypot, honeytoken; distinguish signature vs anomaly detection.

Self-check. Q: What is a honeytoken? A: Fake data (credential/file) whose use triggers an alert.

8.12 Cryptographic attacks

Definition and why it matters. Attackers target cryptographic weaknesses; understanding them guides algorithm and key choices.

**Core theory. Birthday attack: finds collisions in ≈2^(n/2) work for an n-bit hash (e.g., ~2^64 for 128-bit MD5, ~2^80 for 160-bit SHA-1 — both practically broken). MD5 and SHA-1 are collision-broken; SHA-256/SHA-3 are considered safe. Other attacks: weak keys, poor RNG, side-channel, padding-oracle (defended by OAEP/PKCS#1 and authenticated encryption).

**Worked example. Birthday bound: a 20-bit space has a 50% collision chance after ≈2^10 ≈ 1,024 samples (closed form). For 128-bit hashes, ≈2^64 — infeasible; for broken MD5, far less work.

**Use case. Choosing SHA-256 over MD5 for file integrity and signatures.

**Comparison. MD5/SHA-1 (broken, collisions) vs SHA-256 (safe for now).

**Common mistakes. Using MD5 for security; assuming a hash with a big output is automatically secure (algorithm quality matters).

**Exam points. Explain the birthday attack and bound; state why SHA-256 is preferred over MD5.

Self-check. Q: Why is MD5 unsuitable for signatures? A: Collision attacks are practical.

8.13 Seeing the ideas: the phases, amplification and worm growth

Definition and why it matters. This topic visualizes attack phases, DDoS amplification, and exponential worm growth together.

**Core theory. Attack phases map to Kill Chain; amplification multiplies attack traffic (50×); worm growth (SI model) is exponential early, defeating manual response.

**Worked example. Kill chain diagram; amplification: 100 Mbit/s → 5 Gbit/s via 50× amplifier; worm: infections double quickly, needing automated containment.

**Use case. Explaining to management why automated controls and runbooks matter.

**Comparison. Human-scale response vs automated, layered defence.

**Common mistakes. Thinking manual response can stop a fast worm or large DDoS.

**Exam points. Sketch attack phases; describe amplification; state why worm growth defeats manual response.

Self-check. Q: Why is worm growth a problem for manual response? A: It grows exponentially, faster than humans can act.


Unit 8 summary

Unit 8 covers ethical hacking methodology and attacker phases, reconnaissance, scanning/enumeration, system hacking and password attacks, malware, sniffing/spoofing/hijacking, social engineering, DoS/botnets, web/server hardening, wireless/mobile/IoT/cloud surfaces, evasion and honeypots, and cryptographic attacks. Students should contrast attack and defence for each category and keep all examples defensive and authorized.


Detailed practice questions and answer keys

Question 1: Explain the CIA triad and give an example for each goal in a college grade system.

Answer key:

  • Confidentiality: only the student and authorized teachers see a grade (encryption, access control).
  • Integrity: grades cannot be changed without authorization (hashes, signatures, authorization checks).
  • Availability: the grade portal is online during results (redundancy, DDoS protection).
  • Extended: authentication (login), non-repudiation (teacher cannot deny submitting a grade), accountability (audit logs).

Question 2: Trace a TCP three-way handshake with example ISNs and compute acknowledgement numbers.

Answer key:

  • Client SYN, ISN = 2000. Server SYN-ACK, ISN = 1000, acknowledges 2001. Client ACK acknowledges 1001.
  • If the client then sends 150 bytes, the server's next acknowledgement is 2001 + 150 = 2151.
  • Note: each SYN consumes one sequence number.

Question 3: Compute entropy and cracking time for an 8-character password from 36 symbols.

Answer key:

  • Entropy H = 8 × log₂(36) ≈ 41 bits; keyspace = 36⁸ ≈ 2.8×10¹² ≈ 2⁴¹.
  • Online at 10 guesses/sec: ≈ 8,946 years to exhaust (half on average).
  • Offline at 10¹⁰ guesses/sec: ≈ 282 seconds. With bcrypt (~10⁴/sec): ≈ 9 years.
  • Conclusion: offline hash theft is the critical risk; slow salted hashing buys time.

Question 4: Write a safe vs an unsafe SQL query for user input.

Answer key:

  • Unsafe: SELECT * FROM users WHERE name = ' + name + '.
  • Safe (parameterised): SELECT * FROM users WHERE name = ?, with name sent as a separate parameter.
  • If name = '; DROP TABLE users;--, the safe query treats it as literal data — no harm. Placeholders cannot be used for table names; use an allow-list for identifiers.

Question 5: Compute SLE, ARO, ALE and ROSI.

Answer key:

  • AV = Rs 8,00,000; EF = 25% → SLE = Rs 2,00,000; ARO = 0.5/year → ALE = Rs 1,00,000/year.
  • Control costs Rs 30,000 and halves ARO → ALE after = Rs 50,000; risk reduction = Rs 50,000/year; net benefit = Rs 20,000; ROSI = 20,000 ÷ 30,000 ≈ 66.7%.

Question 6: List eight rules-of-engagement elements and state the two most important for a hospital system.

Answer key:

  • Scope, authorized signatories, testing window/blackout, permitted/forbidden techniques, data handling, emergency contacts/stop conditions, reporting/retention, legal indemnity/confidentiality.
  • For a hospital: scope exclusions (life-critical systems out of scope) and stop conditions/emergency contacts (patient safety first).

Question 7: Describe social-engineering defences and never-share rules.

Answer key:

  • Verify out of band (call a known number); slow down when pushed; never share OTPs/PINs/passwords; check links and sender addresses; use phishing-resistant MFA (FIDO2); simulated phishing + training; reward reporting; physical access control; two-person approval + call-back for payment changes.
  • No real bank asks for an OTP.

Mermaid diagrams

CIA triad and defence-in-depth flowchart

flowchart TD
    A[Asset: data, systems, services] --> C[Confidentiality: encryption, access control]
    A --> I[Integrity: hashes, signatures, MACs]
    A --> Av[Availability: redundancy, DDoS protection]
    A --> Au[Authentication: verify identity]
    A --> NR[Non-repudiation: digital signatures]
    D[Defence in depth: layers] --> L1[Physical security]
    D --> L2[Network perimeter: firewall]
    D --> L3[Host hardening]
    D --> L4[Application security]
    D --> L5[Monitoring and backups]

Explanation: Security goals protect an asset; defence in depth stacks independent layers so no single failure compromises the system.

TCP three-way handshake sequence diagram

sequenceDiagram
    participant C as Client
    participant S as Server
    C->>S: SYN, ISN = x
    S->>C: SYN-ACK, ISN = y, ACK x+1
    C->>S: ACK, ACK y+1
    note over C,S: Connection established; each SYN consumes one sequence number

Explanation: The handshake establishes a TCP connection and initializes sequence numbers; acknowledgements track the next expected byte.

Kill Chain and attack phases flowchart

flowchart TD
    R[Reconnaissance] --> W[Weaponisation]
    W --> D[Delivery]
    D --> E[Exploitation]
    E --> I[Installation]
    I --> C2[Command and control]
    C2 --> A[Actions on objectives]
    note over R,A: Breaking any link stops the intrusion (defence in depth)

Explanation: The Cyber Kill Chain maps attacker phases; defenders place controls at several links so breaking any one stops the intrusion.

Incident response lifecycle flowchart

flowchart TD
    Prep[Preparation: plan, team, tooling] --> DA[Detection & analysis]
    DA --> CER[Containment, eradication, recovery]
    CER -> PI[Post-incident: review, lessons, fix controls]
    PI --> Prep

Explanation: Incident response is a cycle; post-incident findings improve preparation for the next event.

Chain of custody flowchart

flowchart TD
    S[Seize evidence] --> I[Image via write blocker]
    I --> H1[SHA-256 hash original]
    I --> H2[SHA-256 hash copy]
    H1 --> M[Match?]
    H2 --> M
    M -->|yes| W[Work on verified copy only]
    M -->|no| F[Re-image; do not proceed]
    W --> L[Log each custody transfer]
    L --> R[Report with methods and hashes]

Explanation: Evidence is imaged with a write blocker; matching hashes prove the copy is exact; every custody transfer is logged.

Token bucket rate limiting flowchart

flowchart TD
    B[Bucket: capacity B, fill rate r] --> R[Request arrives]
    R --> T{Token available?}
    T -->|yes| A[Accept; consume token]
    T -->|no| J[Reject / rate-limit]
    A --> F[Fill token at rate r up to B]
    J --> F

Explanation: The token bucket allows bursts up to B and sustains rate r; excess requests are rejected.

CVSS scoring flowchart

flowchart TD
    V[Vulnerability] --> E[Exploitability: AV, AC, PR, UI, scope]
    V --> Im[Impact: C, I, A]
    E --> S[Base score 0–10]
    Im --> S
    S --> Q[Qualitative: none/low/medium/high/critical]

Explanation: CVSS v3.1 combines exploitability and impact into a 0–10 base score, with qualitative severity ratings.


Pitfalls and common mistakes

  • Testing without written authorization: Illegal under Nepal's ETA 2063 regardless of intent; always have a signed ROE.
  • Scanning out-of-scope or production systems: Can disrupt services and breach law; define scope and testing window first.
  • Relying on passwords alone: Use MFA, preferably phishing-resistant (FIDO2/passkeys).
  • Storing unsalted fast password hashes: Use Argon2id/bcrypt/scrypt/PBKDF2 with a unique salt per user.
  • String-concatenated SQL: Use parameterised queries; never join user input into SQL.
  • Using MD5 or SHA-1: Collision-broken; use SHA-256 or SHA-3.
  • ECB mode / reused IV nonces: Reveals patterns or breaks confidentiality; use CBC/CTR with unique IV or authenticated modes.
  • Accepting invalid TLS/SSH certificates: Enables man-in-the-middle; validate certificates and host keys.
  • Default-deny not applied, or broad ACL shadowing denies: Review and test firewall rules; order matters.
  • Hardcoding keys/secrets in code: Use environment variables or a secrets vault; rotate leaked keys.
  • Assuming HTTPS hides everything: It hides content but not IP/port metadata; endpoint compromise still defeats it.
  • Sharing OTPs/PINs: No legitimate bank or service asks for them; verify out of band.
  • Wiping a compromised system too early: Destroys forensic evidence; image first with a write blocker.

References

  • Stallings, W. (2017). Cryptography and Network Security: Principles and Practice (7th ed.). Pearson.
  • RFC 793: Transmission Control Protocol.
  • RFC 4033/4034/4035: DNS Security Introduction and Requirements.
  • OWASP Top 10 (2021) and OWASP Password Storage Cheat Sheet.
  • MITRE ATT&CK knowledge base.
  • Electronic Transactions Act 2063 (Nepal), Sections 44–47 and 52 (as cited).
  • National Cyber Security Policy 2080 (Nepal).
  • Tribhuvan University. (2025). Curriculum of Bachelor of Computer Applications (BCA), Semester VII — course record BCA401 (structure only; no verified numbered unit outline).
  • NEBians syllabus pages (third-party candidate outline), https://nebians.consica.com.np/app/syllabus/bca-course/cyber-security-and-ethical-hacking/, captured 2026-11-20. Not official, not verified.
  • All attack examples are defensive and for authorized labs only; never test systems without written permission.