Hassiba Benbouali University of Chlef
Faculty of Exact Sciences and Computer Science
Department of Computer Science
Computer Security
Tutorial Worksheet N°: 1
Exercise 1:
1. Precisely define the following terms and provide a concrete example for each: Vulnerability, Threat,
Preventive countermeasure and Risk.
2. Name two main objectives of safety and explain how they differ from security objectives.
Exercise 2: For each scenario below, identify which principle(s) of the CIA triad (Confidentiality, Integrity,
Availability) is/are violated. Also specify whether authentication or non-repudiation could have mitigated the
damage:
1. Ransomware encrypts the files of a hospital enterprise.
2. An employee secretly alters the amount of a bank transfer.
3. An attacker publishes stolen personal data from a database on the Internet.
Exercise 3: An attacker successfully installs a keylogger on a bank employee's computer after sending a phishing
email with a malicious attachment. The attacker then harvests login credentials and transfers funds to an offshore
account.
Describe the 5 stages of the attack lifecycle illustrated in this scenario (reconnaissance, intrusion/breach, privilege
escalation, exfiltration/impact, covering tracks).
Exercise 4:
1. Encrypt the message « CHLEF » with a shift k = 7.
2. Decrypt the ciphertext « YMJ UJWXTS » knowing it was encrypted with a Caesar cipher (k unknown). Justify
your approach.
3. Why is this cipher vulnerable to brute-force attacks? Compute the maximum number of trials required.
Exercise 5: You intercept the following message:
«IQIFCCVQQRFBRDQVFLLCQNARDQCFJWHWZHRBNNBHCCHWWHBSQVQBREHWQVHLQ»
1. Calculate the frequency of letters in this message.
2. Compare with typical English letter frequencies.
3. Propose a plausible substitution to decrypt the message.
Exercise 6:
1. Encrypt « ALGER » with the key « SECURITE ».
2. Explain why the Vigenère cipher resists simple frequency analysis.
3. If the key length is 4 characters, how many distinct keys exist? What is the key space size?
Exercise 7: Using the keyword « PEGASOS»:
1. Build the 5×5 matrix (merging I/J into one cell).
2. Encrypt the text PT=« CRYPTOXOLIST » according to Playfair rules.
3. Why is this cipher more resistant than Caesar to frequency analysis?
Exercise 8: The affine cipher uses the formula: Eₖ(x) = (a·x + b) mod N, with gcd(a, N) = 1.
1. Explain why the condition gcd(a, N) = 1 is necessary for decryption to be possible.
2. List all valid values of a (1 ≤ a < 26) that satisfy this condition.
3. How many distinct affine cipher keys (a, b) exist over the English alphabet? Justify your calculation.
4. Encrypt « BONJOUR » with key (a=5, b=8).
5. Compute the modular inverse of a=5 modulo 26.
6. Decrypt « MZILKZ » with the same key (a=5, b=8).
7. Find the elements of Z4 and Z6 that do not have a multiplicative inverse.
8. Why does the multiplicative inverse exist for all non-null elements in Z5?
1/2
Exercise 9: Classify each attack below according to:
• Attack vector (phishing, malware, DoS…)
• Objective (data theft, sabotage…)
• Exploited vulnerability type (technical, human…)
Attack Description
A Email impersonating a bank to harvest credentials
B Buffer overflow in an unpatched web server
C SYN flood overwhelming a server to cause downtime
D SQL injection via an unfiltered login form
Exercise 10: A small-to-medium enterprise (SME) wants to secure its information system. Propose a defense-in-
depth strategy by specifying:
1. 3 preventive countermeasures (e.g., firewall)
2. 2 detective countermeasures (e.g., IDS)
3. 1 corrective countermeasure
4. 2 non-technical best practices (training, policy…)
Briefly justify each measure in relation to course concepts.
Exercise 11: Encrypt the message « SECURITEINFORMATIQUE » with the numeric key 3 1 4 2 (column reading order).
Detail the steps: grid construction and ciphertext extraction.
Exercise 12:
1. State Bézout's theorem and explain the necessary condition for an integer «a» to have a modular inverse
modulo «n».
2. Use the Extended Euclidean Algorithm to calculate the modular inverse (if it exists) for the following cases:
17 in Z30, 12 in Z67, 17 in Z67.
Exercise 13: Consider a variant of the Caesar cipher where the encryption depends on the previous ciphertext
character. Let m1, m2, …, mn be the numerical values of the message letters (A=0, B=1, ..., Z=25).
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Given a key K (a letter), the ciphertext C1, C2, …, C3 is calculated as:
• C1= (m1 + K) mod 26
• For i >= 2, Ci = (mi + Ci-1) mod 26
1. Encrypt the message "MESSAGE" using the key "C" (K=2).
2. Give the general formula of Decryption (find mi from Ci and Ci-1.
3. Decrypt the message "PNAAMUKEI" which was encrypted with the key "M" (K=12).
4. What can be said about the security of this cryptogram compared to a standard Caesar cipher?
Exercise 14: We aim to extend the method to encrypt and decrypt messages written in German (German alphabet =
English alphabet + 4 additional letters: Ä, Ö, Ü, ß).
1. Provide the encryption/decryption equations in this case?
2. What is the size of the key space?
3. The ciphertext "ä u ß w ß" was encrypted using the key (a = 17, b = 1). Find the plaintext message?
2/2