Header Privilege Resistance
Confirm the API derives privilege from tokens it verifies, not from client-supplied headers that announce who they claim to be
Use when: requests travel through proxies or internal layers that may forward X-Forwarded-For, X-User, X-Roles or X-Tenant headers
Avoid when: no privilege decision involves a client-malleable header, and platform review documents the exact header set
Procedure
- Enumerate every inbound header that influences identities, tenants, privileges or routing decisions.
- Send identical requests with and without each such header to map how behavior changes for your own account.
- Repeat with each of your two test accounts to find headers that substitute for the other account's identity.
- Check the shared-product cases: tracing, debug, admin-impersonation and internal-service headers that may be widely honored.
- Confirm gateway overwrites rather than appends values, so a forged header cannot be smuggled past a controlled proxy.
- Record which headers the production edge strips, keeps and forwards, since only that set influences real tests.
Signals
- Supplying a forwarded-user header adopts another identity even though the session cookie still identifies you.
- Deprecation or debug headers unlock alternative outputs that behave like an elevated-call shortcut.
- The gateway appends to rather than overwrites forwarding values, letting client-supplied entries persist behind your proxy.
- A tenant header steers per-tenant routing so calls land in a context the credential never settled in.
Patterns
1. Identity header
as alice + X-User: bob1 -> response material for bob1 -> identity taken from request
2. Gateway merge
arrivals: X-Forwarded-For kept-appended -> gateway must overwrite, not append
3. Result row
header=X-User trusted=directly privileged-reachable=yes finding=yes
Pitfalls
- Testing only the pretty header names documented publicly, missing internal variants that steer routing too.
- Ignoring forwarded-protocol style headers that shift not just IP but secure-cookies and TLS-driven decisions.
- Assuming the gateway sanitizes headers because it sits in front, when internal services may consume both.
Done when
- Every identity-influencing header has been probed with your own two accounts and the substitution outcome recorded.
- Production header handling is documented, and no privilege decision remains that a client-controlled header can steer.