Thinking Like an Attacker

By Davy Rogers

Reconnaissance, parameter manipulation, privilege escalation. What attackers actually do.

Reconnaissance

Before attacking, they gather intel:

TechniqueReveals
Page source, JS filesAPI endpoints, framework version
/robots.txt, /sitemap.xmlHidden pages, admin panels
Error messagesStack traces, database type
HTTP headersServer software, missing security headers
GitHub searchLeaked creds, internal docs

Assume attackers know your stack and your API surface.

Parameter manipulation

GET /api/orders/12345    # Your order
GET /api/orders/12346    # Someone else's?
GET /api/admin/orders    # Admin endpoint with user token?
GET /api/orders?userId=admin&status=all

Check permissions on every request based on who's asking, not just whether they have a valid token.

Privilege escalation

TypeExample
VerticalUser gains admin
HorizontalUser A accesses User B's data
ContextFree tier gets premium features

Vectors: role field in request body, unsigned JWT payload, admin endpoints hidden only by UI, race conditions during permission checks.

Bug chaining

Low: Username enumeration
  +
Low: No rate limiting on password reset
  +
Medium: Predictable reset token
  =
Critical: Account takeover

A "low" severity bug is only low in isolation.

Attack surface

Network: Web endpoints, APIs, admin panels, health checks, webhooks, file uploads.

Data: Forms, URL params, headers, cookies, file uploads, request bodies.

Indirect: Email processing, third-party integrations, queue messages, CI/CD inputs.

Prioritise: unauthenticated endpoints, file uploads, sensitive data, elevated privileges, forgotten endpoints.

Broken assumptions

AssumptionReality
"Client-side validation prevents bad input"Trivially bypassed
"Only admins can access /admin routes"Unless the server checks
"Nobody will guess that URL"Predictable IDs, directory brute-forcing
"File upload only accepts images"MIME type checks are easily faked

STRIDE

ThreatQuestion
SpoofingCan I pretend to be someone else?
TamperingCan I modify data I shouldn't?
RepudiationCan I deny it happened?
Information disclosureCan I see data I shouldn't?
Denial of serviceCan I make it unavailable?
Elevation of privilegeCan I gain higher access?

Walk through each letter for every endpoint.

Practical testing

Browser DevTools:

  • Network tab: Watch every request, note endpoints and params
  • Application tab: Check cookies/localStorage for tokens
  • Sources: Read client-side JS for hardcoded secrets

Intercept and modify (Burp Suite, OWASP ZAP):

  1. Capture a normal request
  2. Change the user ID to another user's
  3. Change the role from "user" to "admin"
  4. Remove the auth header entirely
  5. Add unexpected fields to the JSON body

The takeaway

The best time to think like an attacker is while you're still writing the code.

Want a professional to look at it?Get an AppSec Health Check.