Diagnostic playbook
CSRF on password change (no token; weak Referer check)
Web / Cross-Site Request Forgery
Knowledge identity
Definition and taxonomy
Summary
A state-changing action (password change) is issued over GET with no CSRF token, or protected only by a Referer header check that can be bypassed by controlling the Referer value.
Severity rationale
Demonstrated password-change request succeeding with no CSRF token (low) and with only a spoofable Referer check (medium). A crafted page in a victim browser could change the victim's password. High level adds a validated session token and is mitigated. Password was restored to the seeded value immediately after testing.
Aliases
CSRF, session riding
Standards
CWE-352 CAPEC-62 A01:2021-Broken Access Control
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L
1. First Signal
What should make an agent suspicious
Symptoms
Changing the password succeeds with no token; adding/removing a Referer header toggles acceptance at medium; a non-matching token blocks the change at high.
Prerequisites
Authorized lab session. Victim session cookie in the jar. State-changing action reachable without a validated anti-CSRF token.
2. Recognition Logic
How to recognize this next time
If a GET endpoint changes state and accepts requests without a token, it is CSRF-prone. If the only defense is a Referer check, verify it can be satisfied or bypassed (header control). Token-validated endpoints (high) are mitigated.
3. Diagnostic Procedure
Safe checks, in order
- Confirm authorized scope. 2. Change the password with no token and confirm the change. 3. Restore the password immediately. 4. At medium, test with and without a Referer and with a Referer containing the host. 5. At high, fetch a fresh token and confirm a valid token changes the password while a missing/wrong token is blocked. 6. Never leave the lab password modified.
4. Proof
Evidence
DVWA csrf: low changed password with no token; medium blocked without Referer but accepted with Referer http://127.0.0.1:4280/evil; high required a matching session token (fresh token succeeded, no-token blocked). Password restored to seeded MD5 after each cell.
5. Controls
Negative checks
At medium, a request without Referer was rejected; at high, a request without a valid token was rejected.
6. Avoid Bad Memory
False positives and traps
A Referer check that passes for any host substring is weak but not proof of full bypass in a real browser (attacker cannot usually set the victim's Referer). Token presence without validation is not real protection.
7. Why It Matters
Impact
Forced password change on an authenticated victim, leading to account takeover by the attacker choosing the new password.
8. Why It Happened
Root cause
Missing anti-CSRF token on state-changing action; medium relies on a Referer check that trusts a string match and can be bypassed with header control.
9. Fix
Remediation and prevention
Add a validated per-session CSRF token (as high does). Use SameSite cookies. Reject state changes over GET. Check Origin instead of Referer.
10. Re-test
Verification steps
- After fix, submit the change without a token and confirm rejection. 2. Confirm a valid token works. 3. Confirm the change is POST-only. 4. Add regression test.
Reference
Tools and sources
Tools used
curl for requests, docker exec for read-only source review and DB hash verification
References
OWASP CSRF Prevention Cheat Sheet; CWE-352; CAPEC-62
Intelligence
Products and history
Technologies
PHP, Apache
Affected products / versions
DVWA (Damn Vulnerable Web Application) current master
History
First documented in DVWA csrf module in the 2026-08 benchmark run. Password restored after each test.
Exploit knowledge
Variants and references
Attack surface
GET-based password change endpoint (/vulnerabilities/csrf/ with password_new, password_conf, Change)
Exploit maturity
proof-of-concept
Known variants
GET-based CSRF with no token (low), Referer-header check bypass (medium), JSON body with custom user_token header (high path), token-validated CSRF (mitigated)
Defensive signatures
State-changing GET requests, password change without a token parameter, Referer header controlling authorization outcome, responses varying with presence/absence of Referer
Reproduction commands
Low (no token, GET): curl -s -b $JAR "http://127.0.0.1:4280/vulnerabilities/csrf/?password_new=testpass123&password_conf=testpass123&Change=Change" # Password Changed Medium (Referer check): curl -s -b $JAR -e "http://127.0.0.1:4280/evil" "http://127.0.0.1:4280/vulnerabilities/csrf/?password_new=testpass123&password_conf=testpass123&Change=Change" # Password Changed Always restore afterwards: set password back to the seeded value.
Exploit references
No external references stored; all evidence from the authorized local lab.
Case provenance