Diagnostic playbook
Broken access control via client-controlled cookies and hardcoded token checks
Web / Broken Access Control
Knowledge identity
Definition and taxonomy
Summary
Access-control decisions are based on client-controllable values: a user_id cookie (spoofable) or a hardcoded literal token value in a GET parameter, allowing access to any object.
Severity rationale
Demonstrated reading any user's profile (including by user_id enumeration) by manipulating a user_id cookie (low) or supplying the literal hardcoded token value 'user_token' (medium). High level uses a server-side session ownership check and was mitigated. All reads were of seeded lab profile data.
Aliases
Cookie-based authorization, hardcoded token bypass, object reference via cookie
Standards
CWE-639,CWE-798 CAPEC-104 A01:2021-Broken Access Control
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
1. First Signal
What should make an agent suspicious
Symptoms
Setting a user_id cookie to a target id reveals that user's profile; adding token=user_token grants access at medium; the user_role cookie value is reflected and trusted as the role.
Prerequisites
Authorized lab session. The endpoint derives identity/authorization from client-supplied cookies or a predictable token value.
2. Recognition Logic
How to recognize this next time
If a profile/object endpoint reads identity from a cookie or a GET token, try changing those client-controlled values. If authorization compares against a fixed string (token == 'user_token'), the value is public knowledge. Prefer session-derived identity on the server.
3. Diagnostic Procedure
Safe checks, in order
- Confirm authorized scope. 2. Test access without any cookie/token. 3. Set the user_id cookie to a target id and retry. 4. Try the literal token value if the source suggests a string comparison. 5. At higher levels, confirm a server-side session check blocks the same requests. 6. Record which values are client-controlled.
4. Proof
Evidence
DVWA bac: low with Cookie user_id=2 returned Gordon Brown's profile and role cookie reflected 'Current Role: admin'; medium with token=user_token returned Gordon Brown's profile while no-token returned Access denied; high with user_id=2 returned 'Access denied' (session check) while own id worked.
5. Controls
Negative checks
At low, no cookie -> access denied; at medium, no token -> access denied; at high, other-user access denied by session ownership (mitigated control).
6. Avoid Bad Memory
False positives and traps
Reflecting a role cookie in the UI is not proof of privilege escalation by itself, but combined with missing enforcement it is a control weakness.
7. Why It Matters
Impact
Any authenticated user can read arbitrary users' profiles and spoof roles when the control is client-side; full object disclosure.
8. Why It Happened
Root cause
Authorization trusts client-controlled cookies and a hardcoded literal token instead of server-side session identity; high level fixes it by using the session user_id.
9. Fix
Remediation and prevention
Always derive the current user from the server session; never trust client cookies or hardcoded tokens for authorization. Enforce object ownership server-side. Use unpredictable tokens only as CSRF, not authorization.
10. Re-test
Verification steps
- After fix, spoofed user_id cookies and token=user_token must be denied. 2. Confirm role comes from the server. 3. Regression tests on cookie/token manipulation.
Reference
Tools and sources
Tools used
curl with cookie/query manipulation, docker exec for read-only source review
References
OWASP Broken Access Control; CWE-639; CWE-798
Intelligence
Products and history
Technologies
PHP, cookies, GET parameters
Affected products / versions
DVWA (Damn Vulnerable Web Application) current master
History
First documented in DVWA bac module in the 2026-08 benchmark run.
Exploit knowledge
Variants and references
Attack surface
action/user_id GET parameters plus user_id and user_role cookies on the bac profile page
Exploit maturity
proof-of-concept
Known variants
user_id cookie spoof (low), literal token comparison (medium), client-controlled role cookie (low user_role=admin), server-side session ownership check (high - mitigated)
Defensive signatures
Access decisions reading user_id/user_role from cookies, comparison against a literal string constant for authorization, responses revealing another user's profile when a cookie or token value changes
Reproduction commands
Low (user_id cookie IDOR): curl -s -b $JAR --cookie "user_id=2" "http://127.0.0.1:4280/vulnerabilities/bac/?action=view&user_id=2" # Gordon Brown profile Medium (hardcoded token): curl -s -b $JAR "http://127.0.0.1:4280/vulnerabilities/bac/?action=view&user_id=2&token=user_token" # Gordon Brown profile High (mitigated): curl -s -b $JAR "http://127.0.0.1:4280/vulnerabilities/bac/?action=view&user_id=2" # Access denied (session check)
Exploit references
No external references stored; all evidence from the authorized local lab.
Case provenance