Diagnostic playbook
API versioning leaks sensitive fields (v1 returns password hashes)
Web / API Security / Information Disclosure
Knowledge identity
Definition and taxonomy
Summary
Older API versions remain reachable and return sensitive fields (password hashes) that newer versions omit, allowing authenticated callers to harvest credential material.
Severity rationale
Demonstrated retrieving SHA-256 password hashes for all API users by calling the v1 version of the user endpoint, while v2 omits them. This is sensitive data exposure via un-versioned/deprecated API endpoints in the authorized lab.
Aliases
API versioning disclosure, legacy API exposure
Standards
CWE-200 CAPEC-116 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
v2 returns {id,name,level} while v1 returns the same plus password; changing the version segment changes the fields returned.
Prerequisites
Authorized authenticated session; legacy API version still routed.
2. Recognition Logic
How to recognize this next time
If an API is versioned, probe lower version numbers for deprecated behavior and extra fields. Compare responses across versions to spot field differences.
3. Diagnostic Procedure
Safe checks, in order
- Confirm authorized scope. 2. Call the documented v2 endpoint. 3. Try v1 (and v0/v3) versions. 4. Compare the JSON fields returned. 5. Record which versions expose sensitive fields.
4. Proof
Evidence
DVWA api low: v1/user/ returned password hashes (e.g. 1c8bfe8f... for tony); v2/user/ returned only id/name/level.
5. Controls
Negative checks
v2 did not include the password field (control); only authenticated users can call the endpoint.
6. Avoid Bad Memory
False positives and traps
Extra fields in a response are only a finding if they are sensitive and reachable by unintended callers.
7. Why It Matters
Impact
Harvesting password hashes enables offline cracking and account takeover.
8. Why It Happened
Root cause
Legacy API version still served with no additional authorization or field filtering; versioning used to widen output fields without access control.
9. Fix
Remediation and prevention
Retire or restrict legacy API versions; never include secrets in API responses; treat versions as code paths with the same authorization and field filtering.
10. Re-test
Verification steps
- After fix, confirm v1 is disabled or returns the same fields as v2. 2. Confirm no endpoint returns hashes. 3. Regression tests across versions.
Reference
Tools and sources
Tools used
curl, docker exec for read-only source review
References
OWASP API Security - Broken Object Level Authorization; CWE-200
Intelligence
Products and history
Technologies
PHP, REST API, JSON
Affected products / versions
DVWA (Damn Vulnerable Web Application) current master
History
First documented in DVWA api module in the 2026-08 benchmark run.
Exploit knowledge
Variants and references
Attack surface
Versioned REST user endpoints /vulnerabilities/api/v{1,2}/user/
Exploit maturity
proof-of-concept
Known variants
Deprecated versions left online, differential responses between versions revealing fields, enumerable version numbers
Defensive signatures
Multiple versioned endpoints responding differently, an older version returning extra sensitive fields, API docs listing legacy paths
Reproduction commands
curl -s -b $JAR http://127.0.0.1:4280/vulnerabilities/api/v1/user/ # includes "password" hashes curl -s -b $JAR http://127.0.0.1:4280/vulnerabilities/api/v2/user/ # no password field
Exploit references
No external references stored; all evidence from the authorized local lab.
Case provenance