Mục tiêu bài học — Learning Objectives
- Áp dụng NIST CSF v2.0 (6 Functions: Govern, Identify, Protect, Detect, Respond, Recover) vào gap analysis
- Mapping ISO 27001:2022 Annex A controls (93 controls, 4 themes) với regulatory requirements
- Thực hiện internal audit lifecycle: plan → fieldwork → reporting → follow-up
- Thu thập và quản lý audit evidence theo chuẩn ISACA/IIA
- Tự động hóa NIST CSF self-assessment với PowerShell và ISO 27001 gap analysis với Bash
Lý thuyết — Theory
1. NIST Cybersecurity Framework v2.0 — 6 Functions
CSF v2.0 (2024) bổ sung Function thứ 6 — Govern — phản ánh tầm quan trọng của governance trong cybersecurity. Không còn chỉ là kỹ thuật, mà là quản lý tổ chức.
Cybersecurity risk strategy, expectations, policy. Là nền tảng cho 5 functions còn lại.
Asset management, risk assessment, supply chain risk. Biết bạn đang bảo vệ cái gì.
Access control, awareness training, data security, platform security, resilience.
Continuous monitoring, adverse event analysis. Phát hiện bất thường kịp thời.
Incident management, analysis, mitigation, reporting, communication.
Restoration of assets, services, capabilities sau sự cố. Communications plan.
2. ISO 27001:2022 — 93 Controls trong 4 Themes
ISO 27001:2022 cập nhật từ 114 controls (2013) xuống 93 controls, tổ chức lại thành 4 themes thay vì 14 domains. Bổ sung 11 new controls tập trung vào cloud, threat intelligence và ICT security.
- 5. Organizational (37 controls): Policies, roles, supplier security, IR
- 6. People (8 controls): Screening, terms, awareness, remote work
- 7. Physical (14 controls): Physical boundaries, equipment security
- 8. Technological (34 controls): Access, cryptography, logging, dev security
- • 5.7 Threat intelligence
- • 5.23 Information security for cloud use
- • 5.30 ICT readiness for business continuity
- • 7.4 Physical security monitoring
- • 8.9 Configuration management
- • 8.10 Information deletion
- • 8.11 Data masking
- • 8.12 Data leakage prevention (DLP)
- • 8.16 Monitoring activities
- • 8.23 Web filtering
- • 8.28 Secure coding
3. Internal Audit Lifecycle
Audit nội bộ là cơ chế đảm bảo controls hoạt động hiệu quả như thiết kế. Theo IIA Standards, audit phải độc lập và objective — không phải là "compliance police" mà là business advisor.
4. Evidence Collection & Control Testing
Quality of evidence quyết định chất lượng audit. Evidence phải đủ (sufficient), thích hợp (appropriate/reliable), và liên quan (relevant) để hỗ trợ conclusions.
- Physical: Screenshots, photos, printouts
- Documentary: Policies, logs, configurations, reports
- Testimonial: Interview notes, management representations
- Analytical: Data analysis results, trend charts
- Re-performance: Auditor reproduces the control
- Inquiry: Hỏi auditees — lowest reliability
- Observation: Xem control thực hiện trực tiếp
- Inspection: Review documents/configurations
- Re-performance: Thực hiện lại control — highest reliability
- CAAT: Computer-assisted audit techniques (SQL, scripts)
5. PCI DSS 4.0 & HIPAA — Yêu cầu tuân thủ ngành
Bài thực hành — Hands-on Labs
NIST CSF Self-Assessment Tool — PowerShell CSV Report Generator
# NIST CSF v2.0 Self-Assessment Tool
# Score: 1=Initial, 2=Developing, 3=Defined, 4=Quantitatively Managed, 5=Optimizing
$csfAssessment = @(
# GOVERN Function
[PSCustomObject]@{ Function="GV"; Category="GV.OC"; Subcategory="GV.OC-01"; Description="Organizational mission understood"; Score=3; Target=4; Evidence="Mission statement published, security strategy aligned" },
[PSCustomObject]@{ Function="GV"; Category="GV.RM"; Subcategory="GV.RM-01"; Description="Risk management objectives established"; Score=2; Target=4; Evidence="Risk appetite statement: draft, not approved" },
[PSCustomObject]@{ Function="GV"; Category="GV.PO"; Subcategory="GV.PO-01"; Description="Security policy established"; Score=3; Target=4; Evidence="ISP v2.1 approved 2025-01, annual review scheduled" },
# IDENTIFY Function
[PSCustomObject]@{ Function="ID"; Category="ID.AM"; Subcategory="ID.AM-01"; Description="Asset inventory maintained"; Score=2; Target=4; Evidence="Manual spreadsheet, not auto-discovered, 60% coverage" },
[PSCustomObject]@{ Function="ID"; Category="ID.RA"; Subcategory="ID.RA-01"; Description="Vulnerabilities identified"; Score=3; Target=4; Evidence="Nessus scan monthly, critical patched in 15 days avg" },
[PSCustomObject]@{ Function="ID"; Category="ID.SC"; Subcategory="ID.SC-01"; Description="Supply chain risk managed"; Score=1; Target=3; Evidence="No formal vendor risk assessment process" },
# PROTECT Function
[PSCustomObject]@{ Function="PR"; Category="PR.AA"; Subcategory="PR.AA-01"; Description="Identities authenticated"; Score=3; Target=5; Evidence="MFA enabled for 85% users; 100% target" },
[PSCustomObject]@{ Function="PR"; Category="PR.DS"; Subcategory="PR.DS-01"; Description="Data-at-rest protected"; Score=4; Target=4; Evidence="AES-256 on all databases, KMS managed" },
[PSCustomObject]@{ Function="PR"; Category="PR.AT"; Subcategory="PR.AT-01"; Description="Security awareness conducted"; Score=3; Target=4; Evidence="Annual training, phishing sim quarterly, 83% completion" },
# DETECT Function
[PSCustomObject]@{ Function="DE"; Category="DE.CM"; Subcategory="DE.CM-01"; Description="Networks monitored"; Score=3; Target=4; Evidence="SIEM deployed, 90% log sources connected" },
[PSCustomObject]@{ Function="DE"; Category="DE.AE"; Subcategory="DE.AE-01"; Description="Anomalies detected"; Score=2; Target=4; Evidence="Basic SIEM rules, no ML-based detection" },
# RESPOND Function
[PSCustomObject]@{ Function="RS"; Category="RS.MA"; Subcategory="RS.MA-01"; Description="Incident response plan tested"; Score=3; Target=4; Evidence="IRP tested via tabletop Q4 2025, gaps documented" },
# RECOVER Function
[PSCustomObject]@{ Function="RC"; Category="RC.RP"; Subcategory="RC.RP-01"; Description="Recovery plan tested"; Score=2; Target=4; Evidence="BCP exists, last DR test 2024-02, RTO not validated" }
)
# Tính toán gaps và scores
$results = $csfAssessment | ForEach-Object {
$_ | Add-Member -NotePropertyName Gap -NotePropertyValue ($_.Target - $_.Score) -PassThru |
Add-Member -NotePropertyName Status -NotePropertyValue (if ($_.Score -ge $_.Target) { "MET" } elseif ($_.Gap -le 1) { "MINOR GAP" } else { "GAP" }) -PassThru
}
$results | Export-Csv "C:\GRC\csf-assessment.csv" -NoTypeInformation -Encoding UTF8
# Summary by Function
$results | Group-Object Function | ForEach-Object {
$avgScore = ($_.Group | Measure-Object Score -Average).Average
$avgTarget = ($_.Group | Measure-Object Target -Average).Average
[PSCustomObject]@{ Function=$_.Name; AvgScore=[math]::Round($avgScore,1); AvgTarget=[math]::Round($avgTarget,1); Gaps=($_.Group | Where-Object Status -ne "MET").Count }
} | Format-Table -AutoSize
Function AvgScore AvgTarget Gaps -------- -------- --------- ---- DE 2.5 4.0 2 GV 2.7 4.0 2 ID 2.0 3.7 3 PR 3.3 4.3 2 RC 2.0 4.0 1 RS 3.0 4.0 1 Critical gaps (Score vs Target ≥ 2): ID.SC-01: Supply chain risk — Score 1, Target 3 [GAP: 2] DE.AE-01: Anomaly detection — Score 2, Target 4 [GAP: 2] GV.RM-01: Risk management — Score 2, Target 4 [GAP: 2] CSV: C:\GRC\csf-assessment.csv [13 subcategories assessed]
ISO 27001 Gap Analysis Script — Bash kiểm tra Linux system controls
#!/bin/bash
# ISO 27001:2022 Gap Analysis — Linux System Controls
REPORT="/tmp/iso27001-gap-analysis.txt"
PASS=0; FAIL=0; WARN=0
check_control() {
local control=$1 desc=$2 status=$3 finding=$4
printf "%-10s %-45s [%s] %s\n" "$control" "$desc" "$status" "$finding" | tee -a $REPORT
case $status in
PASS) (( PASS++ )) ;;
FAIL) (( FAIL++ )) ;;
WARN) (( WARN++ )) ;;
esac
}
echo "=== ISO 27001:2022 Gap Analysis — $(hostname) — $(date) ===" | tee $REPORT
echo "" | tee -a $REPORT
# 8.2 — Privileged access rights
SUDO_USERS=$(getent group sudo 2>/dev/null || getent group wheel 2>/dev/null | cut -d: -f4)
if [ -z "$SUDO_USERS" ]; then
check_control "8.2" "Privileged access rights" "WARN" "Cannot enumerate sudo group"
else
check_control "8.2" "Privileged access rights" "PASS" "Sudo users: $SUDO_USERS"
fi
# 8.5 — Secure authentication (SSH key auth, password auth disabled)
SSH_PWAUTH=$(grep -i "^PasswordAuthentication" /etc/ssh/sshd_config 2>/dev/null | awk '{print $2}')
if [ "$SSH_PWAUTH" = "no" ]; then
check_control "8.5" "Secure authentication — SSH" "PASS" "PasswordAuthentication disabled"
else
check_control "8.5" "Secure authentication — SSH" "FAIL" "PasswordAuthentication=$SSH_PWAUTH (should be no)"
fi
# 8.15 — Logging (auditd running)
if systemctl is-active --quiet auditd; then
check_control "8.15" "Logging — auditd service" "PASS" "auditd is active"
else
check_control "8.15" "Logging — auditd service" "FAIL" "auditd not running — install: apt install auditd"
fi
# 8.9 — Configuration management (unattended-upgrades)
if dpkg -l unattended-upgrades &>/dev/null; then
check_control "8.9" "Configuration mgmt — auto updates" "PASS" "unattended-upgrades installed"
else
check_control "8.9" "Configuration mgmt — auto updates" "FAIL" "unattended-upgrades not installed"
fi
# 8.20 — Network security (firewall)
if command -v ufw &>/dev/null && ufw status | grep -q "Status: active"; then
check_control "8.20" "Network security — firewall" "PASS" "UFW active"
elif command -v firewall-cmd &>/dev/null && firewall-cmd --state 2>/dev/null | grep -q running; then
check_control "8.20" "Network security — firewall" "PASS" "firewalld active"
else
check_control "8.20" "Network security — firewall" "FAIL" "No active firewall detected"
fi
# 8.7 — Anti-malware (ClamAV or other)
if command -v clamscan &>/dev/null || command -v freshclam &>/dev/null; then
check_control "8.7" "Malware protection — ClamAV" "PASS" "ClamAV installed"
else
check_control "8.7" "Malware protection" "WARN" "ClamAV not found — verify EDR agent"
fi
echo "" | tee -a $REPORT
echo "=== SUMMARY: PASS=$PASS WARN=$WARN FAIL=$FAIL ===" | tee -a $REPORT
echo "Report: $REPORT"
=== ISO 27001:2022 Gap Analysis — ubuntu-prod-01 — 2026-05-24 === 8.2 Privileged access rights [PASS] Sudo users: devops,deploy 8.5 Secure authentication — SSH [FAIL] PasswordAuthentication=yes (should be no) 8.15 Logging — auditd service [PASS] auditd is active 8.9 Configuration mgmt — auto updates [PASS] unattended-upgrades installed 8.20 Network security — firewall [PASS] UFW active 8.7 Malware protection — ClamAV [WARN] ClamAV not found — verify EDR agent === SUMMARY: PASS=4 WARN=1 FAIL=1 === Report: /tmp/iso27001-gap-analysis.txt Priority action: Fix 8.5 (SSH password auth) — High risk finding
Tình huống doanh nghiệp — Business Scenario
Saigon Payment Hub xử lý thanh toán cho 200 merchants. QSA (Qualified Security Assessor) phát hiện trong audit PCI DSS 4.0: R8 — MFA chỉ áp dụng cho remote access, không áp dụng cho console access vào CDE (Cardholder Data Environment). Critical finding — có thể bị fine hoặc mất PCI compliance certificate.
Tự kiểm tra — Self-Assessment (5 câu)
1. NIST CSF v2.0 bổ sung Function nào so với v1.1?
2. Tài liệu nào là BẮT BUỘC trong ISO 27001 và liệt kê tất cả 93 controls cùng trạng thái applicable/not applicable?
3. Phương pháp test control nào có độ tin cậy cao nhất khi auditor muốn xác minh control hoạt động?
Re-performance = auditor tự thực hiện lại control để verify — highest reliability vì không phụ thuộc vào auditee's statement.
4. PCI DSS 4.0 Requirement nào yêu cầu MFA cho tất cả access vào CDE?
5. HIPAA Breach Notification Rule yêu cầu thông báo cho media (báo chí địa phương) khi nào?