📝 Mock Examination A
Instructions
- Time: 2 Hours
- Questions: Answer ALL FOUR questions.
- Marks: All questions carry equal marks.
Question 1: Foundations & Risk
(a) A web-server hosting a critical e-commerce database has an estimated value of £500,000. A specific SQL Injection vulnerability has an Exposure Factor (EF) of 100% (total data loss). The Annualized Rate of Occurrence (ARO) is estimated to be 0.1 (once every 10 years).
- Calculate the Single Loss Expectancy (SLE).
- Calculate the Annualized Loss Expectancy (ALE).
- If a Web Application Firewall (WAF) costs £20,000 per year to license and maintain, is it cost-effective to implement? [6 marks]
(b) Which of the following statements about Salted Hashes are true? (Tick all that apply) [4 marks]
- Salting prevents Rainbow Table attacks.
- Salting encrypts the password using a public key.
- Salting makes the password hash collision-resistant.
- Salting ensures that two users with the same password have different hashes.
(c) Explain Kerckhoffs’s Principle. Why is “Security through Obscurity” considered a bad practice in modern network design? [5 marks]
Question 2: Cryptography
(a) You are establishing a Diffie-Hellman key exchange with a partner.
- Public Parameters: Prime , Generator .
- Alice’s Private Key: .
- Bob’s Private Key: .
- Calculate the public value Alice sends to Bob ().
- Calculate the Shared Secret (). Show your working. [8 marks]
(b) The ciphertext 01011 was encrypted using a One-Time Pad (OTP) with the key 11001.
- Recover the plaintext.
- Explain why the One-Time Pad is considered to have “Perfect Secrecy” but is impractical for internet traffic. [7 marks]
Question 3: Web Vulnerabilities
(a) Consider the following PHP code snippet:
$user = $_GET['username'];
$query = "SELECT * FROM accounts WHERE name = '" . $user . "'";
$db->execute($query);-
Identify the vulnerability.
-
Provide a specific input string that an attacker could use to log in without a password (authentication bypass).
-
Rewrite the code to fix the vulnerability using a Prepared Statement. [9 marks]
(b) Explain the mechanism of a Reflected XSS attack. How does it differ from Stored XSS in terms of where the malicious script is saved? [6 marks]
Question 4: Protocols & Network Defense
(a) During an SSL/TLS Handshake, the client and server must agree on a “Cipher Suite”.
-
Break down the following cipher suite string into its 4 components:
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256-
Key Exchange: ?
-
Authentication: ?
-
Encryption (Cipher): ?
-
Integrity (MAC): ?
-
-
Why is ECDHE preferred over standard RSA for the key exchange? (Hint: Forward Secrecy). [8 marks]
(b) You are configuring a firewall for a corporate network.
-
What is the difference between a Packet Filtering Firewall and a Stateful Inspection Firewall?
-
Write a rule set (Source, Dest, Port, Action) to allow public web traffic into a Web Server (IP: 10.0.0.5) but block all other access to it. [7 marks]