Diagnostic playbook
Client-side-only token control fully derivable from exposed JavaScript
Web / Client-Side Security / Authentication
Knowledge identity
Definition and taxonomy
Summary
A security decision relies on a token that is generated and validated using algorithms entirely exposed in client-side JavaScript; an attacker can compute valid tokens without running the page.
Severity rationale
Demonstrated that the server-side token check can be satisfied by computing the token directly from the exposed client-side algorithm (rot13+md5, string reverse, sha256 chains), without executing the page. Impact is low because the token gates a benign challenge phrase; in a real app, a client-side-only gate (e.g., client-side authorization) is trivially bypassable.
Aliases
Weak client-side token, client-side authorization bypass, obfuscation is not security
Standards
CWE-602 CAPEC-6 A01:2021-Broken Access Control
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
1. First Signal
What should make an agent suspicious
Symptoms
Submitting the known phrase plus a token computed from the exposed JS returns success; a wrong token returns 'Invalid token'; the token algorithm is visible in page/JS source.
Prerequisites
Authorized lab session. Client-side JS computes a value that the server later verifies; algorithm readable or reverse-engineerable.
2. Recognition Logic
How to recognize this next time
If a page loads JS that computes a token from a known input and the server checks that token, read the JS, reproduce the computation in a local script, and submit the computed token. Obfuscation/minification does not make the logic secret.
3. Diagnostic Procedure
Safe checks, in order
- Confirm authorized scope. 2. Identify the token-generation JS. 3. Reproduce the algorithm locally (rot13/md5/reverse/sha256). 4. Submit phrase=success with the computed token. 5. Negative control: wrong token is rejected. 6. Record the algorithm and proof.
4. Proof
Evidence
DVWA javascript: low token md5(str_rot13('success'))=38581812b435834ebf84ebcc2c6424d6 -> 'Well done!'; medium token strrev('XXsuccessXX')=XXsseccusXX -> 'Well done!'; high token sha256 chain -> 'Well done!'. Wrong token -> 'Invalid token'.
5. Controls
Negative checks
A wrong token (wrongtoken123) returned 'Invalid token', confirming the server does validate the value - but the value is fully computable client-side.
6. Avoid Bad Memory
False positives and traps
A visible token is not a vulnerability unless the server relies on it as a security boundary; the boundary here is the challenge gate only.
7. Why It Matters
Impact
Any client-side-only security control (authorization, gating) can be bypassed by computing the value locally; low impact here because the gate is a benign challenge.
8. Why It Happened
Root cause
Security-relevant validation depends on a value whose generation logic is fully exposed client-side; the server merely re-checks the same derivable value.
9. Fix
Remediation and prevention
Move security decisions server-side. Use server-generated, per-session, unpredictable tokens. Treat client-side checks as UX only, never as a security boundary.
10. Re-test
Verification steps
- After fix, confirm a client-computed token is not accepted. 2. Confirm the server issues random tokens. 3. Regression test that client-side computation cannot satisfy the server.
Reference
Tools and sources
Tools used
curl for submissions, python3 for reproducing the token algorithms, docker exec for read-only source review
References
OWASP Client-Side JavaScript; CWE-602
Intelligence
Products and history
Technologies
JavaScript, PHP, MD5, SHA-256
Affected products / versions
DVWA (Damn Vulnerable Web Application) current master
History
First documented in DVWA javascript module in the 2026-08 benchmark run.
Exploit knowledge
Variants and references
Attack surface
phrase/token form; token validation logic in exposed JS files (low.php inline, medium.js, high.js)
Exploit maturity
proof-of-concept
Known variants
rot13+MD5 token (low), string reverse token (medium), multi-step SHA-256 token (high), any client-side validation relying on visible/obfuscatable logic
Defensive signatures
Forms with hidden token fields whose generation logic lives in client-side JS, server responses verifying tokens computed from known inputs, obfuscated client JS that still reveals the algorithm
Reproduction commands
Low token = md5(str_rot13('success')): python3 -c "import hashlib;print(hashlib.md5(b'fhpprff').hexdigest())" curl -s -b $JAR -d 'phrase=success&token=38581812b435834ebf84ebcc2c6424d6&send=Submit' http://127.0.0.1:4280/vulnerabilities/javascript/ # Well done! Medium token = strrev('XXsuccessXX'): curl -s -b $JAR -d 'phrase=success&token=XXsseccusXX&send=Submit' http://127.0.0.1:4280/vulnerabilities/javascript/ High token = sha256(sha256('XX'+strrev('success'))+'ZZ'): curl -s -b $JAR -d 'phrase=success&token=<computed>&send=Submit' http://127.0.0.1:4280/vulnerabilities/javascript/
Exploit references
No external references stored; all evidence from the authorized local lab.
Case provenance