Password Returned in Application Responses
The application sends a user's current password, or its hash, back in pages or API responses, where it can be read from the browser, caches, logs or intercepting tools.
| Severity | Medium |
| CVSS 3.1 | 5.9 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N Open in the calculator |
| CVSS 4.0 | 8.2 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-201: Insertion of Sensitive Information Into Sent Data |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1552 Unsecured Credentials, T1078 Valid Accounts |
| Category | Information Disclosure |
Description
The application includes a stored password, or the password hash, in data it returns to the browser or API client. Typical examples are a profile or settings page that pre-fills a password field with the user's current password (visible in the page source even though the field is masked), an API that serialises the whole user record including the password or hash field, an administration page or user listing that shows other users' passwords, and registration or account responses that echo the password back.
Anyone who can read the response can obtain the password: an attacker exploiting cross-site scripting, someone using a shared computer where the page is cached or kept in history, a proxy, monitoring tool or log that records response bodies, or a person reading the page source over the user's shoulder. The password gives full access to the account and, because passwords are often reused, possibly to the user's accounts elsewhere, and where responses expose other users' passwords or hashes, for example in an administration view or a user API, the impact is much greater. A returned hash is less directly useful, but it can be cracked offline, while a password returned in readable form also shows that it is stored in plain text or a reversible form, which is a separate and more serious finding.
The weakness is identified by reviewing responses in an intercepting proxy for password or hash values, including in hidden fields, JavaScript variables and JSON properties that the user interface does not display, and in the responses to other users' and administrators' views of an account.
Remediation
Never send stored passwords or password hashes to a client:
- Remove password and hash fields from every response. Build responses from explicit allowlists of fields, using response models, data transfer objects or serialiser settings that exclude credential fields, rather than serialising whole database records.
- Render password fields empty. A page for changing the password should ask for the current and new passwords, never display the existing one.
- Do not echo submitted passwords in confirmation pages, responses or emails.
- Store passwords only as salted hashes from a dedicated password hashing function, so that no feature is able to return the original value.
- Send
Cache-Control: no-storeon authentication and account pages, and make sure logging and monitoring tools do not record request or response bodies that carry credentials.
If passwords have appeared in responses that may have been cached or logged, ask the affected users to change them. Confirm the fix by reviewing the affected pages and API responses again and checking that no password or hash value appears.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.