Injection (SQL, command, LDAP, NoSQL)
How it works: User input is concatenated into a query string or shell command, so the input can terminate the intended syntax and inject attacker-controlled statements.
Fix pattern: Parameterized queries / prepared statements. Never string-concatenate user input into SQL. For shells, pass arguments as an array, not via a shell string.
Broken authentication
How it works: Guessable passwords, missing MFA, session fixation, long-lived tokens without revocation, credential stuffing.
Fix pattern: Memory-hard KDF for passwords, MFA, short access-token TTLs with refresh-token rotation, rate limiting on login, device fingerprinting for high-risk flows.
Sensitive data exposure
How it works: Secrets in source control, unencrypted PII at rest, overly verbose errors, tokens in URLs (which log everywhere).
Fix pattern: Secrets in a vault / KMS, encryption at rest + TLS in transit, strip PII from logs at emit time, never put tokens in query strings.
XML / deserialization attacks
How it works: Unsafe deserializers (pickle, Java ObjectInputStream, certain YAML loaders) execute code from untrusted input. XXE lets external entities exfiltrate files.
Fix pattern: Never deserialize untrusted data with unsafe loaders. Use safe loaders (yaml.safe_load, JSON). Disable DTDs / external entities in XML parsers.
Broken access control
How it works: Users access resources they should not — horizontal (other tenants' data) or vertical (admin endpoints from a regular user).
Fix pattern: Authorize at the boundary of every resource, not just at the login page. Never trust client-sent role claims; derive authorization from server-side identity.
Security misconfiguration
How it works: Default credentials left in place, debug endpoints exposed, open CORS, unnecessary services enabled, missing security headers.
Fix pattern: Harden defaults, minimize surface area, enable security headers (CSP, HSTS, X-Frame-Options), review third-party integration configs.
XSS — Cross-Site Scripting
How it works: User-controlled content rendered to other users without sanitization — attacker scripts run in the victim's browser with the victim's cookies.
Fix pattern: Context-aware output encoding (different rules for HTML body, attribute, JS, URL). Content Security Policy as defense-in-depth. Template engines that escape by default.
CSRF — Cross-Site Request Forgery
How it works: A malicious site tricks a victim's browser into sending an authenticated request to your site using the victim's existing session cookie.
Fix pattern: SameSite=Lax or Strict cookies; anti-CSRF tokens for state-changing requests; require a custom header (browsers do not send custom headers cross-origin without preflight).
SSRF — Server-Side Request Forgery
How it works: User-controlled URL causes your server to make a request — to internal metadata services, private networks, or sensitive endpoints behind your firewall.
Fix pattern: Allow-list of domains; explicit block of private IP ranges (127.0.0.0/8, 169.254.0.0/16, 10/8, 172.16/12, 192.168/16); DNS rebinding protection; no redirects to internal IPs.
Vulnerable / outdated components
How it works: A library with a known CVE in your dependency tree — direct or transitive.
Fix pattern: Automated dependency scanning; monitor security advisories for your stack; pin versions and renew them on a schedule. Know your transitive deps — many vulns live four layers deep.
Insufficient logging & monitoring
How it works: Attacks go undetected because auth failures, access-control denials, and suspicious patterns are not logged or alerted on.
Fix pattern: Log every auth decision (success AND failure) with context; alert on bursts of failures; separate audit logs from application logs; retain for the window your incident response needs.