B16 · 資安(後端視角) 詳細 ROADMAP
計畫文件,不會被 Quartz 渲染。
回主 roadmap → backend/ROADMAP.md
章節目標
本章只放後端特有資安議題——SQL Injection / Command Injection / SSRF / Path Traversal / Deserialization 等後端端的攻擊面、OWASP Top 10 的後端視角、API 安全(CSRF / CORS / Rate Limit)、secret / key 管理。通用資安概念(red/blue team、SDLC)屬於 security/ 系列。
🌱 基本介紹
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 01 | 後端資安獨特的威脅面 | 01-backend-threat-surface | 🌱 | Server-side 特有攻擊 vs client-side;「你的後端是整個系統的最後一道防線」 |
❓ 為什麼需要
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 02 | 為什麼「前端驗就好」是地雷 | 02-why-client-side-validation-not-enough | 🌱 | 任何 HTTP client 都能繞前端;Postman 直接打、自製 script、MITM proxy |
| 03 | 為什麼 Secret 不能進 git | 03-why-secrets-not-in-git | 🌱 | 歷史記錄永遠存在、fork / clone 帶走、公開 repo 洩漏實際案例 |
🕰️ 演進
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 04 | OWASP Top 10 演進 | 04-owasp-evolution | 🌱 | 2013 / 2017 / 2021 / 2024 的變化;SSRF 進榜、XXE 下榜 |
| 05 | 供應鏈攻擊興起 | 05-supply-chain-attack | 🌱 | event-stream / ua-parser-js / SolarWinds / xz utils(2024);為什麼 lockfile 是防線 |
🧠 知識型
F16-A OWASP Top 10 後端視角
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 06 | OWASP Top 10(web security) | ⛔️ security/03-web-security | 🌿 | 跨系列 |
| 07 | A01 Broken Access Control | 07-broken-access-control | 🌱 | IDOR、權限 bypass、後端 /admin 沒驗;跟 B10 授權連動 |
| 08 | A02 Cryptographic Failures | 08-crypto-failures | 🌱 | 敏感資料沒加密、弱演算法(MD5 / SHA1 存密碼)、key 管理失敗 |
| 09 | A03 Injection | 09-injection | 🌱 | SQL / Command / LDAP / NoSQL injection;parameterized query 是標配 |
| 10 | A04 Insecure Design | 10-insecure-design | 🌱 | 設計層面就錯(threat modeling 沒做)、跟 code-level 漏洞的差別 |
| 11 | A05 Security Misconfiguration | 11-misconfiguration | 🌱 | 預設帳密、debug 模式開在 prod、過度寬鬆的 CORS |
| 12 | A06 Vulnerable Components | 12-vulnerable-dependencies | 🌱 | 舊版 package 有 CVE、自動掃描工具、patch 節奏 |
| 13 | A07 Auth Failures | 13-auth-failures | 🌱 | Session fixation、timing attack、enumeration;跟 B10 Auth 連動 |
| 14 | A08 Software & Data Integrity Failures | 14-integrity-failures | 🌱 | CI/CD supply chain、unsigned deserialization、updates without verification |
| 15 | A09 Logging & Monitoring Failures | 15-logging-failures | 🌱 | 沒 log auth 失敗、log 洩漏 PII、沒 alert |
| 16 | A10 SSRF | 16-ssrf | 🌱 | 後端幫前端抓 URL 的功能被利用打內網;metadata endpoint(169.254.169.254)風險 |
F16-B 後端特有攻擊
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 17 | SQL Injection 深入 | 17-sqli-deep | 🌱 | 各種變體(union / time-based / boolean blind)、ORM 不自動等於免疫 |
| 18 | Command Injection | 18-command-injection | 🌱 | os.system / subprocess.call / shell=True 坑、輸入轉義困難 |
| 19 | Path Traversal | 19-path-traversal | 🌱 | 上傳檔案覆蓋、下載 /../../etc/passwd;白名單 vs 黑名單 |
| 20 | Deserialization 攻擊 | 20-deserialization | 🌱 | Java / PHP / Python pickle;pickle.loads 是 RCE 等級危險 |
| 21 | XXE(XML External Entity) | 21-xxe | 🌱 | XML 解析器預設行為、讀檔 / SSRF / DoS |
F16-C API 與 Web 安全
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 22 | CORS 深入 | 22-cors-deep | 🌱 | Preflight / credential / origin 設計、常見誤解(* + credentials: include) |
| 23 | CSRF 後端防禦 | 23-csrf-backend | 🌱 | SameSite cookie、CSRF token、double-submit;API-only 場景怎麼想 |
| 24 | Rate Limiting 作為資安工具 | 24-rate-limit-security | 🌱 | 防 brute force / DoS、帳號鎖定策略 |
| 25 | Idempotency 作為資安保護 | 25-idempotency-security | 🌱 | 避免重複扣款攻擊、replay 防護 |
| 25-2 | 微服務資安全景 | ⛔️ micro-service/50-microservice-security | 🌿 | 跨系列 |
| 25-3 | API Gateway 資安 | ⛔️ micro-service/51-api-gateway-security | 🌿 | 跨系列 |
F16-D Secret 管理
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 26 | Secret 管理基礎 | ⛔️ infra/09-secrets-config | 🌿 | 跨系列 |
| 27 | Secret 憑證管理深入 | ⛔️ infra/27-secrets-certificate-management | 🌿 | 跨系列 |
| 28 | Vault / KMS / SOPS | 28-secret-tools | 🌱 | HashiCorp Vault / AWS KMS / Mozilla SOPS;dev 流程整合 |
| 29 | Key rotation 策略 | 29-key-rotation | 🌱 | 怎麼做 zero-downtime rotation、JWT key rotation |
F16-E 依賴與供應鏈
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 30 | Dependency Scanning | ⛔️ infra/26-security-scanning | 🌿 | 跨系列 |
| 31 | SBOM(Software Bill of Materials) | 31-sbom | 🌱 | 為什麼需要、SPDX / CycloneDX、跟 CI 整合 |
| 32 | lockfile 是安全防線 | 32-lockfile-security | 🌱 | package-lock.json / uv.lock / poetry.lock 的角色、pinned dependencies |
F16-F 合規與 DDoS 防禦
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 33 | GDPR 後端實作 | 33-gdpr-backend | 🌱 | Data subject rights(存取 / 刪除 / 可攜帶)、consent management、data retention、跟 B03 Multi-tenancy 連動 |
| 34 | SOC 2 / ISO 27001 後端 | 34-soc2-iso27001 | 🌱 | Audit trail、access control、encryption at rest/in transit、跟 B07 audit log + B17 observability 配合 |
| 35 | HIPAA / PCI-DSS 後端 | 35-hipaa-pci | 🌱 | 醫療 / 金流特殊要求;PHI / cardholder data 處理;tokenization;scope reduction 策略 |
| 36 | DDoS 防禦分層 | 36-ddos-defense-layers | 🌱 | Layer 3/4(volumetric)vs Layer 7(application)攻擊;CloudFlare / AWS Shield / Akamai;app 層配合(rate limit / CAPTCHA) |
| 37 | Audit Trail 合規設計 | 37-audit-trail-compliance | 🌱 | 不可竄改 log(append-only)、保留期限、事件覆蓋範圍;跟 B07 #30 audit service 擴充 |
🔧 小實作注意事項
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 38 | Security Headers 中介層 | 38-security-headers-middleware | 🌱 | proto middleware/security_headers.py 案例 |
| 39 | Threat Modeling 實戰 | 39-threat-modeling | 🌱 | STRIDE 方法、Data Flow Diagram、何時該做 |
💣 Anti-pattern
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 40 | 後端資安 Anti-patterns | 40-backend-security-antipatterns | 🌱 | SQL 字串拼接、密碼 MD5、JWT expiration 無限、只信任 X-Forwarded-For、用 eval / exec、CORS *、log 印 password、secret 寫死在 code |
🧰 對應檢查工具
| # | 主題 | Slug | Stage | 大綱 |
|---|
| 41 | 後端資安工具 | 41-backend-security-tooling | 🌱 | SAST(Semgrep / CodeQL)、DAST(OWASP ZAP)、SCA(Snyk / Socket / Dependabot)、secret scanning(TruffleHog / gitleaks) |
📎 補充
| # | 主題 | Slug | Stage | 大綱 |
|---|
| S01 | Prompt Injection(AI 後端時代) | s01-prompt-injection | 🌱 | LLM 輸出被注入、跟傳統 injection 的差別、defense-in-depth |
| S02 | Red / Blue Team 後端視角 | ⛔️ security/02-red-blue-team | 🌿 | 跨系列 |
| S03 | SDLC 後端實踐 | ⛔️ security/04-secure-development-lifecycle | 🌿 | 跨系列 |
章節進度統計
- 知識主題:36 + 3 補充 = 39 項
- 🌿 growing:5(跨系列)
- 🌱 seed:34
跨系列連結
- →
security/ 系列(1–4,通用資安)
- →
infra/09、26、27、30-application-security
- →
backend/auth/ B10(auth 本身就是資安)
- →
backend/api-design/ B09(rate limit / idempotency)
- →
backend/conventions/ B07 #24 security headers middleware
- →
standards/(好的 infra / CI/CD 含資安檢查)