Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!
Lesson 11 of 11
Practice & Quiz - Cybersecurity Fundamentals
Test your understanding of the CIA triad, threat landscape, and NIST Cybersecurity Framework with a practical risk assessment exercise and 5 quiz questions.
Practical Exercise - Qualitative Risk Assessment Matrix
import pandas as pd
import numpy as np
# ─── Risk Assessment: Likelihood × Impact ─────────────────────
# Industry standard: 5x5 risk matrix per NIST SP 800-30
LIKELIHOOD = {1: 'Rare', 2: 'Unlikely', 3: 'Possible', 4: 'Likely', 5: 'Almost Certain'}
IMPACT = {1: 'Negligible', 2: 'Minor', 3: 'Moderate', 4: 'Major', 5: 'Critical'}
def risk_level(likelihood: int, impact: int) -> str:
score = likelihood * impact
if score >= 15: return '🔴 CRITICAL'
if score >= 9: return '🟠 HIGH'
if score >= 4: return '🟡 MEDIUM'
return '🟢 LOW'
# Sample asset inventory for a fintech company
assets = [
{'asset': 'Customer PII Database', 'threat': 'SQL Injection', 'l': 4, 'i': 5},
{'asset': 'Payment Processing API', 'threat': 'Man-in-the-Middle', 'l': 2, 'i': 5},
{'asset': 'Admin Web Portal', 'threat': 'Credential Stuffing', 'l': 4, 'i': 4},
{'asset': 'S3 Config Bucket', 'threat': 'Misconfiguration', 'l': 5, 'i': 4},
{'asset': 'Employee Laptops', 'threat': 'Phishing / Malware', 'l': 5, 'i': 3},
{'asset': 'Source Code Repo', 'threat': 'Insider Threat', 'l': 2, 'i': 4},
{'asset': 'Production Servers', 'threat': 'Ransomware', 'l': 3, 'i': 5},
{'asset': 'DNS Infrastructure', 'threat': 'DNS Hijacking', 'l': 2, 'i': 4},
]
df = pd.DataFrame(assets)
df['risk_score'] = df['l'] * df['i']
df['risk_level'] = df.apply(lambda r: risk_level(r['l'], r['i']), axis=1)
df['likelihood_label'] = df['l'].map(LIKELIHOOD)
df['impact_label'] = df['i'].map(IMPACT)
# Sort by risk score descending (treatment priority)
df = df.sort_values('risk_score', ascending=False)
print('=== Fintech Risk Register ===')
print(df[['asset', 'threat', 'likelihood_label', 'impact_label', 'risk_score', 'risk_level']].to_string(index=False))
# ─── NIST CSF mapping for top risks ──────────────────────────
print('\n=== NIST CSF Controls for CRITICAL/HIGH Risks ===')
nist_controls = {
'SQL Injection': {'Identify': 'Asset inventory + DAST scanning',
'Protect': 'Parameterized queries, WAF, least-privilege DB accounts',
'Detect': 'DB activity monitoring, anomaly alerts',
'Respond': 'Incident playbook, DB isolation procedure',
'Recover': 'Clean restore from backup, patch + redeploy'},
'Credential Stuffing': {'Identify': 'Exposed credential monitoring (HaveIBeenPwned API)',
'Protect': 'MFA enforcement, rate limiting, CAPTCHA, bcrypt hashing',
'Detect': 'Login anomaly detection (geo, velocity, device fingerprint)',
'Respond': 'Force password reset, block IPs, notify users',
'Recover': 'Review session tokens, audit access logs'},
}
for threat, controls in nist_controls.items():
print(f'\n{threat}:')
for fn, control in controls.items():
print(f' [{fn}] {control}')
# ─── CIA Triad violation analysis ─────────────────────────────
print('\n=== CIA Triad Impact Analysis ===')
cia_impacts = {
'SQL Injection': {'C': True, 'I': True, 'A': False},
'Man-in-the-Middle': {'C': True, 'I': True, 'A': False},
'Ransomware': {'C': False, 'I': True, 'A': True},
'DDoS': {'C': False, 'I': False, 'A': True},
'Credential Stuffing': {'C': True, 'I': True, 'A': False},
}
for threat, impact in cia_impacts.items():
violated = [k for k, v in impact.items() if v]
print(f' {threat}: violates {", ".join(violated)}')Module Quiz
What does the CIA triad stand for and what does each component protect against?
Tip
Tip
Practice Practice Quiz Cybersecurity Fundamentals in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
The foundational security model: Confidentiality (privacy), Integrity (trust), and Availability (uptime).
Practice Task
Note
Practice Task - (1) Write a working example of Practice Quiz Cybersecurity Fundamentals from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Common Mistake
Warning
A common mistake with Practice Quiz Cybersecurity Fundamentals is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready cybersecurity code.
Finished this lesson?