CISSP · Domain 6 · 12%

Đánh giá & Kiểm thử bảo mật

Security Assessment & Testing — Domain 6

Domain tập trung vào quy trình xác minh hiệu quả của các kiểm soát bảo mật. Từ vulnerability assessment đến penetration testing, code review, đến continuous testing trong DevSecOps pipeline — tư duy CISSP: test để verify, không phải để tìm lỗi.

Mục tiêu chương / Learning objectives

1. Lý thuyết cốt lõi / Core theory

1.1. Các loại đánh giá bảo mật (Security assessment types)

LoạiMục tiêuNgười thực hiệnOutput
Vulnerability AssessmentTìm và liệt kê lỗ hổng — không exploitInternal team, scanner toolsVulnerability list + CVSS scores
Penetration TestExploit lỗ hổng để đo business impactCertified tester (CEH/OSCP)Report: findings + PoC + remediation
Red Team ExerciseSimulate APT — test detection & responseExternal red team, adversary simulationAttacker TTPs + Blue team gaps
Bug BountyCrowdsource vulnerability discoveryExternal researchers (HackerOne/Bugcrowd)Individual vulnerability reports
Security AuditVerify compliance với policy/standardInternal audit, external auditor (Big4)Audit report + compliance status

CISSP Key Distinction: Vulnerability assessment = tìm holes. Penetration test = chứng minh holes có thể exploit được và impact là gì. Red team = test toàn bộ security posture (people + process + technology). CISSP câu hỏi hay hỏi: "Board muốn biết khả năng attacker xâm nhập và tác động kinh doanh" → Penetration test, không phải VA.

1.2. Penetration Testing Methodology (PTES · OWASP · NIST 800-115)

Pentest theo PTES (Penetration Testing Execution Standard) gồm 7 giai đoạn:

  1. Pre-engagement: Định nghĩa scope, Rules of Engagement (RoE), legal authorization (written permission!), emergency contacts, NDA. Không có giai đoạn này → pentest là tội phạm.
  2. Intelligence Gathering (Recon): Passive (OSINT: WHOIS, LinkedIn, Shodan, Google dorks) và Active (DNS enum, network scanning trong scope). Mục tiêu: hiểu attack surface trước khi chạm vào target.
  3. Threat Modeling: Identify attack vectors, threat actors, và prioritize targets dựa trên business value.
  4. Vulnerability Analysis: Scan (Nessus/OpenVAS) + manual analysis. Map findings to CVEs và CVSS scores.
  5. Exploitation: Verify vulnerabilities bằng cách exploit (trong scope). Mục tiêu: đạt access, không phải phá hoại. Document mọi step.
  6. Post-Exploitation: Privilege escalation, lateral movement, persistence (để demo impact). Nếu mục tiêu là data exfil → extract sample (không phải toàn bộ data).
  7. Reporting: Executive summary (business impact, risk rating) + Technical details (vuln, PoC, remediation steps). Cleanup artifacts sau test.

Rules of Engagement bắt buộc bao gồm: Authorized systems/IPs (explicit whitelist), time window (testing hours), authorized techniques (no DoS trên production), emergency stop procedure, data handling (captured data phải được encrypt và delete sau test), notification requirements (nếu phát hiện critical vulnerability trong khi test).

1.3. OWASP Top 10 (2021) (Web application vulnerabilities)

A01
Broken Access Control — IDOR, missing function-level access control, privilege escalation. Số 1 vì phổ biến nhất và thường bị bỏ qua.
A02
Cryptographic Failures — Data transmitted in clear, weak crypto (MD5/SHA1/DES), hardcoded keys.
A03
Injection — SQL, NoSQL, LDAP, OS command injection. Input không được validate/sanitize/parameterize.
A04
Insecure Design — Thiết kế không có threat modeling, thiếu security requirements từ đầu.
A05
Security Misconfiguration — Default credentials, unnecessary features enabled, verbose error messages, missing hardening.
A06
Vulnerable & Outdated Components — Libraries/frameworks với known CVEs. Log4Shell (Log4j CVE-2021-44228) là ví dụ điển hình.
A07
Identification & Authentication Failures — Brute force không bị limit, weak passwords, no MFA, session fixation.
A08
Software & Data Integrity Failures — Không verify integrity của updates, CI/CD pipeline không secure, deserialization issues.
A09
Security Logging & Monitoring Failures — Không log đủ, không alert khi có attack, logs không được protect.
A10
Server-Side Request Forgery (SSRF) — App fetch URL do user kiểm soát → attacker access internal services (AWS metadata, Redis).

1.4. Code Review & Testing Types (SAST · DAST · IAST · RASP)

1.5. Continuous Security Testing & DevSecOps (Fuzzing, pipeline integration)

DevSecOps tích hợp security vào mọi stage của CI/CD pipeline:

2. Bài thực hành / Hands-on labs

🖥️ Platform: Windows 11 Lab VM · Kali Linux
🛠️ Tools: PowerShell 7 · nmap · Nikto · theHarvester

⚠️ LEGAL WARNING: Chỉ thực hiện các lệnh scan/exploit trên hệ thống bạn được phép rõ ràng bằng văn bản. Unauthorized scanning là vi phạm pháp luật (Computer Fraud and Abuse Act tại Mỹ, Điều 224-225 Bộ luật Hình sự Việt Nam). Dùng lab environment riêng (Metasploitable, HackTheBox, TryHackMe, DVWA).

Lab 1 — Windows Privilege Escalation Check (PowerShell — Lab VM Only)

OS: Windows 11 Lab VM (authorized) · Tool: PowerShell 7

# === WINDOWS SECURITY ASSESSMENT (LAB ONLY) ===
# Run on authorized lab VMs only

Write-Host "=== 1. Missing Security Patches ===" -ForegroundColor Cyan
Get-HotFix | Sort-Object InstalledOn -Descending |
    Select-Object -First 10 HotFixID, Description, InstalledOn |
    Format-Table -AutoSize

Write-Host "`n=== 2. Enabled Optional Features (attack surface) ===" -ForegroundColor Cyan
Get-WindowsOptionalFeature -Online |
    Where-Object { $_.State -eq "Enabled" } |
    Where-Object { $_.FeatureName -match "Telnet|TFTP|SMB1|RDS|RemoteDesktop" } |
    Select-Object FeatureName, State | Format-Table -AutoSize

Write-Host "`n=== 3. Services running as SYSTEM (high-risk) ===" -ForegroundColor Cyan
Get-WmiObject Win32_Service |
    Where-Object { $_.StartName -in @("LocalSystem","NT AUTHORITY\SYSTEM") -and $_.State -eq "Running" } |
    Select-Object Name, DisplayName, PathName |
    Where-Object { $_.PathName -notlike "*system32*" -and $_.PathName -notlike "*SysWOW64*" } |
    Format-Table -AutoSize

Write-Host "`n=== 4. Unquoted Service Paths (privilege escalation vector) ===" -ForegroundColor Cyan
Get-WmiObject Win32_Service |
    Where-Object { $_.PathName -notlike '"*' -and $_.PathName -like '* *' } |
    Select-Object Name, PathName | Format-Table -AutoSize

Write-Host "`n=== 5. PrivescCheck (if available — lab use only) ===" -ForegroundColor Cyan
if (Test-Path ".\PrivescCheck.ps1") {
    Write-Host "Loading PrivescCheck..." -ForegroundColor Yellow
    . .\PrivescCheck.ps1
    Invoke-PrivescCheck -Extended | Select-Object -First 20
} else {
    Write-Host "Download: https://github.com/itm4n/PrivescCheck (for authorized lab use)" -ForegroundColor Gray
}

Write-Host "`n=== 6. AlwaysInstallElevated (MSI privilege escalation) ===" -ForegroundColor Cyan
$hklm = Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer" -EA SilentlyContinue
$hkcu = Get-ItemProperty "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Installer" -EA SilentlyContinue
if ($hklm.AlwaysInstallElevated -eq 1 -and $hkcu.AlwaysInstallElevated -eq 1) {
    Write-Host "[VULN] AlwaysInstallElevated is ENABLED - privilege escalation possible!" -ForegroundColor Red
} else {
    Write-Host "[OK] AlwaysInstallElevated not enabled" -ForegroundColor Green
}

✅ Kết quả mong đợi (lab VM): Missing patches: list của KB numbers chưa được cài (so sánh với WSUS/patch baseline). Unquoted service paths: nếu có "C:\Program Files\My App\service.exe" (không có quotes) → attacker có thể tạo "C:\Program.exe" để hijack. AlwaysInstallElevated enabled → high privilege escalation risk. Trên hardened system: không có unquoted paths, không có AlwaysInstallElevated, patches up-to-date.

Lab 2 — Recon & Web Scanning (Lab Network Only — Kali Linux)

OS: Kali Linux · Tool: nmap · Nikto · theHarvester (lab network/authorized target only)

#!/bin/bash
# === PENTEST RECON & SCANNING (AUTHORIZED LAB ONLY) ===
# Replace 192.168.56.0/24 with your lab network range

LAB_NETWORK="192.168.56.0/24"
TARGET_IP="192.168.56.10"   # Metasploitable or authorized target
TARGET_DOMAIN="targetdomain.com"  # Replace with authorized domain

echo "=== PHASE 1: PASSIVE RECON ==="
echo "--- WHOIS ---"
whois $TARGET_DOMAIN 2>/dev/null | grep -E "Registrant|Admin|Tech|Emails|Name Server" | head -15

echo -e "\n--- DNS Enumeration ---"
dig +short $TARGET_DOMAIN MX
dig +short $TARGET_DOMAIN NS
dig +short $TARGET_DOMAIN TXT

echo -e "\n--- OSINT: theHarvester (passive) ---"
theHarvester -d $TARGET_DOMAIN -b google -l 50 2>/dev/null | \
    grep -E "@|Host:|IP:" | head -20

echo -e "\n=== PHASE 2: NETWORK SCANNING (lab only) ==="
echo "--- Host Discovery ---"
nmap -sn $LAB_NETWORK -oG - 2>/dev/null | grep "Up" | awk '{print $2}'

echo -e "\n--- Service Version Scan ---"
nmap -sV -sC --open -T4 $TARGET_IP -oN /tmp/nmap-scan.txt 2>/dev/null
cat /tmp/nmap-scan.txt | grep -E "open|OS:|Service"

echo -e "\n=== PHASE 3: WEB APPLICATION SCANNING ==="
echo "--- Nikto Web Scanner ---"
nikto -h http://$TARGET_IP -maxtime 120 -output /tmp/nikto-report.txt 2>/dev/null
grep -E "OSVDB|CVE|\+ " /tmp/nikto-report.txt | head -20

echo -e "\n=== PHASE 4: VULNERABILITY IDENTIFICATION ==="
echo "--- Nmap Vuln Scripts ---"
nmap --script=vuln --script-args=unsafe=1 -p 80,443,22,21,3389 $TARGET_IP 2>/dev/null | \
    grep -E "VULNERABLE|CVE|State" | head -20

✅ Kết quả mong đợi (Metasploitable lab): nmap phát hiện nhiều port mở (21/FTP, 22/SSH, 80/HTTP, 3306/MySQL, 5432/PostgreSQL — dấu hiệu intentionally vulnerable VM). Nikto báo cáo: outdated Apache, directory listing enabled, default scripts. theHarvester tìm thấy email addresses và subdomains (từ OSINT). Đây là starting point cho exploitation phase trong controlled lab — không bao giờ thực hiện trên production systems.

3. Tình huống doanh nghiệp / Enterprise scenario

Bối cảnh:

Công ty e-commerce VNShop chuẩn bị launch website mới xử lý thanh toán (PCI-DSS yêu cầu). CISO phải trình Board về security assurance program. Dev team muốn "chạy nhanh", không muốn security làm chậm release. Pentest năm ngoái phát hiện SQL injection nhưng chưa được fix vì "không có thời gian".

Security assurance strategy:

  1. Non-negotiables (PCI-DSS 11.x): Penetration test ít nhất 1 lần/năm và sau mỗi major change. Vulnerability scan mỗi quý (internal) và mỗi quý (external ASV-approved scanner). SQL injection unfixed = PCI fail → delay launch.
  2. DevSecOps integration (không làm chậm): SAST trong IDE (Semgrep VS Code plugin) — developer thấy issue trước khi commit. SCA trong pipeline (Snyk) — tự động fail build nếu Critical CVE. Target: shift security left, tìm bugs lúc code rẻ hơn lúc prod đắt 100x.
  3. Risk-based testing: DAST tập trung vào payment flows (highest risk). OWASP ZAP automated trong staging. Manual pentest focus trên business logic (automation miss).
  4. Bug Bounty program: Sau launch, mở HackerOne với scope = app.vnshop.vn (không bao gồm internal systems). Tận dụng crowd để tìm what internal team missed.
  5. Remediation SLA: Critical → 24h. High → 7 days. Medium → 30 days. SQL injection unpatched = Critical → escalate to Board nếu không fix trong 24h.

Bài học CISSP: Testing không phải mục đích — verify controls hoạt động mới là mục đích. CISSP manager quan tâm đến risk acceptance, không phải số lượng vulnerabilities. Unfixed critical = business risk được accept explicitly bởi management.

4. Tự kiểm tra / CISSP-style knowledge check

  1. Tester thực hiện penetration test và phát hiện vulnerability nghiêm trọng ngoài scope đã được approve. Theo phương pháp luận và đạo đức nghề nghiệp, bước tiếp theo là gì?
  2. CISO yêu cầu "penetration test toàn bộ hệ thống" nhưng không cung cấp Rules of Engagement và không có written authorization. Là security manager, bạn xử lý như thế nào?
  3. OWASP Top 10 A01 "Broken Access Control" — mô tả 2 ví dụ tấn công cụ thể và control tương ứng từ góc nhìn developer và security manager.
  4. Công ty bạn có 5 developers và cần security testing. Không có budget cho full pentest. Mô tả minimal viable security testing program với SAST + DAST + SCA, ước tính ROI.
  5. DAST tìm thấy SQL injection trong staging. SAST không tìm thấy cùng bug này. Giải thích tại sao và điều này nói gì về cần thiết phải dùng nhiều testing types?
  6. Fuzzing phù hợp nhất cho loại vulnerabilities nào? Cho ví dụ loại phần mềm mà fuzzing đặc biệt hiệu quả và lý do.
C05: Quản lý định danh & Truy cập C07: Vận hành bảo mật
Thực hành trên công cụPowerShell 7 · nmap · Nikto · theHarvester
Nền tảngWindows 11 Lab VM · Kali Linux
Thời điểm phát hànhQ2/2026
Ngày biên soạn24/05/2026
Người biên soạnTrần Văn Hòa (MCT)
Phiên bảnv1.0
Zalo