A01:2021 — Broken Access Control

Security Control: Access Control Enforcement

How to Implement:

  • Enforce server-side access control for every protected action (never rely on client checks).
  • Use centralized authorization library / middleware (RBAC/ABAC).
  • Deny-by-default: default to no access, grant minimal privileges.
  • Protect object references (use indirect references/UUIDs; validate ownership).
  • Test: automated authorization unit tests, access matrix tests, fuzz object ids, role switching tests, DAST checks for access bypass.
A02:2021 — Cryptographic Failures

Security Control: Cryptography & Secret Handling

How to Implement:

  • Do not invent crypto; use vetted libraries and current primitives (AEAD, TLS ≥1.2/1.3).
  • Encrypt sensitive data at rest with strong KDFs / key management (separate KMS).
  • Protect secrets: use vaults (HashiCorp Vault, cloud KMS), avoid hardcoded secrets, rotate keys.
  • Test: secret scanning in code, repo scans, verify TLS configs (Mozilla TLS tools), encryption unit tests.
A03:2021 — Injection (incl. XSS)

Security Control: Input Validation & Injection Protection

How to Implement:

  • Use parameterized queries / ORM with bind parameters for DBs.
  • Validate & canonicalize input server-side; apply allowlists where possible.
  • Contextual output encoding for HTML/JS/URL/CSS to prevent XSS.
  • Use CSP headers, HttpOnly & Secure cookies.
  • Test: SAST for injection patterns, dynamic scanners for injection/XSS, manual verification of encoding.
A04:2021 — Insecure Design

Security Control: Secure Design/Threat Modeling

How to Implement:

  • Do threat modeling early (STRIDE/PASTA) focusing on authentication, authorization, business logic.
  • Use secure design patterns / paved-road libraries (ASVS controls).
  • Define security user stories and acceptance criteria; bake security into CI/CD gates.
  • Test: design review checklists, architecture threat model sign-off.
A05:2021 — Security Misconfiguration

Security Control: Configuration & Environment Hardening

How to Implement:

  • Use immutable infra and IaC (Terraform/CloudFormation) with secure baselines.
  • Remove debug endpoints; disable directory listing; enforce secure headers.
  • Harden default accounts, disable unused services, ensure secure defaults.
  • Test: automated config scanning (benchmarks, CIS), periodic config drift checks, prod hardening checklist
A06:2021 — Vulnerable and Outdated Components

Security Control: Component/Dependency Hygiene

How to Implement:

  • Maintain SBOM; enforce approved dependency list; use latest patched versions
  • Use dependency-scanning in CI (OSS analyzers, SCA tools), block builds on critical CVEs.
  • Minimize libraries & remove unused packages; apply runtime protections.
  • Test: SCA reports, dependency freshness dashboard, vulnerability SLA for fixes.
A07:2021 — Identification and Authentication Failures

Security Control: Authentication & Session Management

How to Implement:

  • Use proven auth frameworks, avoid DIY auth; enforce MFA for sensitive flows
  • Protect session identifiers: Secure, HttpOnly, SameSite cookies; rotate and expire tokens.
  • Implement brute-force protections, account lockouts, and adaptive auth.
  • Test: credential stuffing simulations, session fixation checks, token expiry tests.
A08:2021 — Software and Data Integrity Failures

Security Control: Integrity & Supply Chain Protections

How to Implement:

  • Verify integrity of code & dependencies (signed artifacts, reproducible builds.
  • Protect CI/CD pipelines and secret injection points; enforce least privilege for build agents.
  • Use runtime integrity checks (binary signing, checksums).
  • Test: pipeline threat modeling, sign/verify workflows, supply-chain security scans.
A09:2021 — Security Logging and Monitoring Failures

Security Control: Logging, monitoring & detection

How to Implement:

  • Centralize logs (SIEM) and store relevant security context (no sensitive data in logs
  • Implement alerts for suspicious patterns (auth failures, privilege escalations, mass downloads).
  • Ensure log integrity and retention; test alerting paths and run playbooks.
  • Test: blue/purple team exercises, alert tuning, log-source coverage checks.
A10:2021 — Server-Side Request Forgery (SSRF)

Security Control: Server-side Request Forgery/External Calls

How to Implement:

  • Do not fetch arbitrary URLs from user input; validate and restrict to allowlists
  • Use network egress controls (proxy, deny internal network access for app).
  • Inspect and sanitize redirects and URL inputs; isolate components that make outbound requests.
  • Test: SSRF test cases, internal host scanning from app context, egress policy verification.