SEN2008 · Week 10 · Security Fundamentals (I): Security Concepts, Vulnerabilities, Threats and Attacks

Security fundamentals: CIA, threats and attacks

The concepts of asset, vulnerability, threat, attack and risk; the CIA triad; DoS/DDoS, MITM, spoofing, phishing and types of malware. The definition and risk calculation questions of the final exam come from here.

CIA triadconfidentialityintegrityavailabilityvulnerabilitythreatattackexploitriskattack surfaceDoSDDoSamplificationSYN floodman-in-the-middlespoofingphishingmalwarewormtrojanransomwareALE

The second half of the course starts here. In the first eight weeks you learned how packets are carried; now we will look at how the same packets are abused. This week looks like a vocabulary week, but the exam has two kinds of questions: choosing the right definition (is this a vulnerability or a threat?) and small risk calculations (risk score, ALE, DDoS traffic). Five golden rules:

  1. The vulnerability is inside, the threat is outside. A vulnerability is a weakness of the system; a threat is the event or person that could exploit it. An attack is the two meeting.
  2. Tie every attack to one of the CIA properties. Reading → confidentiality, modification → integrity, inability to access → availability.
  3. Risk = likelihood × impact. The monetary version: ALE=SLE×AROALE = SLE \times ARO.
  4. In DDoS, find the traffic by multiplying. Number of bots × bot rate, or attacker rate × amplification factor.
  5. The smaller the attack surface, the better. Every open port, every service, every user is an entry door.

Basic concepts

In the language of security, the words are very close to each other, and these are exactly what the exam asks. Let’s think about it through a bank’s online branch.

TermMeaningBank example
AssetAnything worth protectingCustomer account data, servers, reputation
VulnerabilityA weak point in the systemA login form that doesn’t validate input
ThreatA possible event that could cause harmA criminal group that wants to steal data
Threat agentThe one who carries out the threatAn external attacker, a malicious employee, a natural disaster
AttackThe actual exploitation of a vulnerabilityAn attempted SQL injection through the form
ExploitThe code or technique that carries out the attackA ready-made script that triggers the vulnerability
RiskThe combination of the likelihood and the size of the harm“A likely large data loss each year”
Countermeasure (control)A measure that reduces riskParameterized query, WAF, patch

The chain is this: a threat agent carries out an attack through a vulnerability and harms the asset. A countermeasure breaks one link of this chain: it closes the vulnerability, detects the attack, or limits the harm.

PITFALL · confusing a vulnerability with a threat. An “unpatched server” is not a threat, it is a vulnerability. “A botnet scanning this server” is a threat. Ask yourself: is this a property of my system (vulnerability), or something that could come from outside (threat)?

The CIA triad

Information security has three basic goals. The abbreviation is CIA (the CIA triad):

  • Confidentiality: only authorized people read the information. Tools: encryption, access control.
  • Integrity: information is not modified without authorization; if it is modified, this is noticed. Tools: hash, MAC, digital signature.
  • Availability: an authorized user reaches the information when needed. Tools: redundancy, backups, DDoS protection.

Two goals often added to these: authentication / authenticity, meaning the message really comes from the claimed person, and non-repudiation, meaning the sender cannot say “I didn’t send it”.

EventWhat is violated
A password being sniffed on unencrypted Wi-FiConfidentiality
A grade being changed in the grading systemIntegrity
A website going down because of DDoSAvailability
Ransomware locking the filesAvailability (and confidentiality too if there is exfiltration)
Impersonating the CEO with a forged emailAuthenticity
A customer denying the order they placedNon-repudiation

Risk calculation

There is no budget to close every risk at once. First you rank the risks. The simplest method is a qualitative scale: likelihood and impact are scored from 1 to 5 and multiplied.

R=L×IR = L \times I

RiskLikelihoodImpactScore
SQL injection in the login form4520
A malicious employee leaks data2510
A laptop is stolen339
DDoS on the website248

The risk with 20 points is addressed first. The product determines the order; two risks with impact 5 are not equally important.

Monetary risk: SLE and ALE

The quantitative method converts risk into money:

  • AV (asset value): the value of the asset.
  • EF (exposure factor): the fraction lost in a single event (between 0 and 1).
  • SLE (single loss expectancy): loss from a single event, SLE=AV×EFSLE = AV \times EF.
  • ARO (annualized rate of occurrence): the expected number of events per year. For “once every 4 years” it is 0.25.
  • ALE (annualized loss expectancy): the expected yearly loss, ALE=SLE×AROALE = SLE \times ARO.

Worked example. A database valued at 400 000 USD loses 30% of its value in a breach. A breach is expected once every two years.

SLE = AV × EF   = 400000 × 0.30 = 120000 USD
ARO = 1 / 2     = 0.5
ALE = SLE × ARO = 120000 × 0.5  = 60000 USD / year

Whether to adopt a control is decided like this: (ALE before − ALE after) − annual cost of the control. If the result is positive, the control pays for itself. If negative, accepting the risk (risk acceptance) or transferring it by insurance (risk transfer) makes more sense. The four strategies: avoid, mitigate, transfer, accept.

Types of attacks

First the big distinction: a passive attack only listens (eavesdropping, traffic analysis); since it does not change the system, it is hard to detect, and the countermeasure is encryption. An active attack changes something: it modifies a message, replays it, impersonates an identity (masquerade) or stops the service. Active attacks are hard to prevent, but they can be detected.

DoS and DDoS

Denial of service (DoS) targets availability. If it comes from a single source it is called DoS, and if it comes from thousands of compromised machines (a botnet) it is called distributed DoS (DDoS). Three main classes:

  • Volumetric: fills the link with traffic. Example: UDP flood, amplification.
  • Protocol: exhausts the server’s state tables. Example: SYN flood.
  • Application layer: sends expensive requests. Example: thousands of queries per second to a search page.

Botnet calculation. 5000 bots, each sending 2 Mbps: 5000×2=100005000 \times 2 = 10000 Mbps =10= 10 Gbps. A 1 Gbps link is exceeded ten times over.

Amplification (reflection/amplification). The attacker sends a small request to an open server, making the source address the victim’s address (spoofing). The server sends a much larger response to the victim. If the request is 64 bytes and the response 3200 bytes:

factor        = 3200 / 64     = 50
attacker      = 10 Mbps of forged requests
to the victim = 10 × 50       = 500 Mbps

SYN flood. Recall the TCP three-way handshake (week 7). When the server receives a SYN, it sends a SYN-ACK and keeps the half-open connection in a queue (backlog) until the final ACK arrives. The attacker sends SYNs from forged addresses, and the ACK never arrives. If the queue is 2048 entries and the timeout is 60 s, 2048/60≈34.12048 / 60 \approx 34.1 SYN/s is enough to keep the queue full. A very low rate. The defense is SYN cookies: the server keeps no state and encodes the information in the sequence number of the SYN-ACK.

TIP · DDoS questions are always multiplication. Bots × rate, attacker rate × factor, backlog / timeout. Watch the units: when converting Mbps to Gbps, divide by 1000.

Man-in-the-middle (MITM)

The attacker gets between the two parties and acts toward each as if it were the other. It can read the traffic (confidentiality) and modify it (integrity). On a local network the typical way is ARP poisoning (week 4): the attacker broadcasts a forged ARP reply saying “the gateway’s MAC address is mine”. Countermeasures: end-to-end encryption and server verification with a certificate (TLS), static ARP entries, dynamic ARP inspection on the switch.

Spoofing (identity forgery)

Forging an identity. IP spoofing: changing the source address of the packet; used in DDoS reflection. ARP spoofing: a forged MAC mapping. DNS spoofing: redirecting a user to another server with a forged DNS reply. Email spoofing: forging the “From” field; reduced with SPF, DKIM and DMARC.

Phishing

Convincing a user with a fake message to enter a password or open a file. The targeted version is spear phishing, the one aimed at executives is whaling, the SMS version is smishing, and the phone version is vishing. It exploits human weakness more than technical weakness; it is a kind of the social engineering in week 11. Countermeasures: awareness training, multi-factor authentication (MFA), email filters.

Malware

TypeDistinguishing feature
VirusAttaches to a file, spreads when the file runs
WormSpreads itself over the network without a user
Trojan horseLooks useful, does the bad work secretly, does not replicate
RansomwareEncrypts data, demands a ransom
Spyware, keyloggerCollects information, records keystrokes
RootkitHides itself from the operating system
BackdoorA hidden entrance that bypasses normal authentication
Logic bombTriggers when a condition occurs
BotTakes remote commands, is part of a botnet

The attack surface

The attack surface is the sum of all the points where an attacker can touch the system. Three components: the network surface (open ports, services), the software surface (every function that takes input, APIs, plugins) and the human surface (every employee who could fall for phishing). Ways to reduce it: shutting down unused services, restricting ports with a firewall, deleting unnecessary code and accounts, giving each component the least privilege.

Authentication is part of the surface too. Weak passwords are open to brute force:

8 characters, lowercase only: 26^8 = 208 827 064 576
10^9 guesses per second      →   ~209 s (3.5 minutes)
8 characters, 62 symbols:     62^8 ≈ 2.18 × 10^14
10^9 guesses per second      →   ~2.5 days

As the length and the symbol set grow, the time increases exponentially. Still, the real defense against an offline attack is a slow, salted password hash.

Common mistakes

Wrong ideaCorrect
Unpatched software is a threatIt is a vulnerability; the threat is whoever will exploit it
Ransomware is a confidentiality violationPrimarily an availability violation
Modifying a message is a confidentiality violationIt is an integrity violation; reading is confidentiality
“Once every 4 years” → ARO = 4ARO = 1/4 = 0.25
ALE = AV × AROFirst SLE = AV × EF, then ALE = SLE × ARO
If the control’s cost is less than the ALE, always take itCompare: is the ALE reduction − cost > 0?
An IDS easily catches a passive attackA passive attack leaves no trace; the countermeasure is encryption
Worm and virus are the sameA worm spreads without a user or a file
SYN flood needs a lot of trafficOnly backlog / timeout, tens of packets per second are enough

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

A web server runs an outdated library with a publicly known flaw that has not been patched. In security terminology, the unpatched flaw itself is best described as a:

  1. threat
  2. vulnerability
  3. attack
  4. countermeasure
Show answer
B) vulnerability

A vulnerability is a weak point in the system: the unpatched library is exactly this. A threat is a possible event or person that could exploit this weakness. An attack is the actual exploitation of the vulnerability. The countermeasure would be installing the patch.

Question 2easy

Ransomware encrypts all files on a hospital file server so that staff cannot open patient records. Which CIA property is primarily violated?

  1. Confidentiality
  2. Integrity
  3. Availability
  4. Non-repudiation
Show answer
C) Availability

The files were encrypted, and the staff cannot access the records. An authorized user being unable to reach the data when needed is a violation of availability. If the ransomware also exfiltrates the data, confidentiality is violated too, but the primary effect in the question is the inability to access.

Question 3easy

An attacker on the path between a customer and a bank changes the amount in a transfer request from 100 to 9000 without being noticed. Which property is violated?

  1. Confidentiality
  2. Integrity
  3. Availability
  4. Anonymity
Show answer
B) Integrity

The content of the message was modified without authorization. Integrity means data is not modified without authorization. Even if the attacker also read the message, the real damage comes from the modification. The countermeasure is a MAC or a digital signature (week 12).

Question 4easy

On a 1 to 5 scale, a threat has likelihood 3 and impact 4. Using risk = likelihood × impact, what is the risk score?

Show answer
12

R=L×I=3×4=12R = L \times I = 3 \times 4 = 12. 12 out of 25 is a medium-high risk. In a risk matrix, 1-6 is usually considered low, 8-12 medium, and 15-25 high; the thresholds vary by organization, so use them if the question gives them.

Question 5medium

A customer database is valued at 250,000 USD. A breach would destroy 20% of its value, and such a breach is expected once every 4 years. Compute the annualized loss expectancy (ALE).

Show answer
12,500 USD

First the single loss expectancy (SLE): SLE=AV×EF=250000×0.20=50000SLE = AV \times EF = 250000 \times 0.20 = 50000.

Expected number of events per year: one event every 4 years means ARO=1/4=0.25ARO = 1/4 = 0.25.

ALE=SLE×ARO=50000×0.25=12500ALE = SLE \times ARO = 50000 \times 0.25 = 12500 USD/year.

Question 6medium

Without a control, ALE = 50,000 USD. With a new intrusion prevention system, ALE drops to 10,000 USD. The system costs 25,000 USD per year. What is the net annual benefit, and is the control justified?

Show answer
15,000 USD; yes

Value of the control = (previous ALE − new ALE) − annual cost.

(50000−10000)−25000=40000−25000=15000(50000 - 10000) - 25000 = 40000 - 25000 = 15000 USD.

Since the result is positive, the control makes economic sense. If it had come out negative, accepting the risk or transferring it (insurance) would have been more appropriate.

Question 7medium

In a reflection/amplification attack, each spoofed 50-byte request makes a server send a 2500-byte response to the victim. If the attacker sends 4 Mbps of requests, how much traffic reaches the victim?

Show answer
200 Mbps

Amplification factor: 2500/50=502500 / 50 = 50.

Traffic going to the victim: 4 Mbps×50=2004 \text{ Mbps} \times 50 = 200 Mbps.

Because the source IP is forged (spoofed), the responses go to the victim. Defense: filtering packets with forged sources at egress (egress filtering) and closing open reflector servers.

Question 8medium

A botnet of 8000 compromised hosts each sends 1.5 Mbps toward a victim whose access link is 1 Gbps. What is the total attack rate, and how many times larger is it than the link capacity?

Show answer
12 Gbps; 12 times

8000×1.5=120008000 \times 1.5 = 12000 Mbps =12= 12 Gbps.

12 Gbps/1 Gbps=1212 \text{ Gbps} / 1 \text{ Gbps} = 12. The link is exceeded 12 times over; legitimate traffic can't even get into the queue. Since each bot produces little traffic, source-based blocking is hard, and this is exactly what distinguishes DDoS from DoS.

Question 9hard

A server keeps at most 512 half-open TCP connections, and each half-open entry times out after 20 s. What minimum SYN rate keeps the backlog permanently full during a SYN flood?

Show answer
25.6 SYN/s (about 26 per second)

Each half-open entry occupies a slot for 20 s. To keep the queue full, 512 new SYNs are needed every 20 seconds:

512/20=25.6512 / 20 = 25.6 SYN/s.

So about 26 packets per second are enough; this is a very small amount of traffic. That is why SYN flood is a cheap attack. Defense: SYN cookies (the server keeps no state), enlarging the backlog, shortening the timeout.

Question 10easy

Which type of malware spreads across a network by itself, without needing to attach to a host file or wait for a user to run it?

  1. Virus
  2. Trojan horse
  3. Worm
  4. Logic bomb
Show answer
C) Worm

A worm spreads on its own: it scans the network for vulnerabilities and copies itself to other machines. A virus attaches to a file and spreads when that file runs. A trojan looks useful but does not replicate itself. A logic bomb is triggered under a specific condition.

Question 11hard

Passwords are 6 characters long, each chosen from 36 symbols (a-z, 0-9). An offline attacker tests 10^6 guesses per second. What is the worst-case time to try the whole space?

Show answer
about 2177 s (about 36.3 minutes)

Key space: 366=2 176 782 33636^6 = 2\,176\,782\,336.

Worst-case time: 2.18×109/106≈21772.18 \times 10^9 / 10^6 \approx 2177 s ≈36.3\approx 36.3 minutes. On average it is found at half of that: about 1088 s.

Lesson: a short password falls within minutes on fast hardware, even if uppercase letters and symbols are added. Length is the strongest factor; slow hashes (bcrypt, Argon2) and salt are also used.

Question 12medium

Which of the following is a passive attack?

  1. Replaying a captured login message
  2. Eavesdropping on unencrypted Wi-Fi traffic
  3. Flooding a server with SYN packets
  4. Modifying DNS replies in transit
Show answer
B) Eavesdropping on unencrypted Wi-Fi traffic

A passive attack does not modify the system, it only listens: eavesdropping and traffic analysis. This makes it hard to detect, and the way to protect against it is encryption. Replay, SYN flood and modifying DNS replies are active attacks: they change or disrupt something in the system.

Verification: Risk scores, SLE/ALE, amplification, botnet traffic, SYN backlog rate and brute-force times were computed with node (verify/SEN2008/10.mjs). The definition questions are conceptual and need no calculation.

Review card

Asset: what is to be protected. Vulnerability: weak point. Threat: possible source of harm. Attack: actual exploitation of a vulnerability. Exploit: the code/technique that performs the attack. CIA: Confidentiality (reading) / Integrity (modification) / Availability (access) sniffing → C modification, forged transaction → I DoS, ransomware → A Risk = Likelihood × Impact (1-5 scale, max 25) SLE = AV × EF ALE = SLE × ARO "once every 4 years" → ARO = 0.25 Value of control = (ALE_before − ALE_after) − annual cost (take it if > 0) Amplification = response size / request size; victim traffic = attacker × factor SYN flood: required rate = backlog / timeout defense: SYN cookies Passive = eavesdropping, traffic analysis (countermeasure: encryption). Active = replay, modification, DoS, impersonation Worm spreads itself; virus attaches to a file; trojan disguises itself; rootkit hides Brute force: time = (number of characters)^length / rate; average is half Reduce the attack surface: closed ports, no unnecessary services, few privileges, little code