CWE-257 is about storing passwords in a recoverable format. Recoverable means someone can get the original password back, whether by decrypting it or by searching.
MITRE is blunt about it: recoverable encrypted passwords provide no significant benefit over plaintext passwords. They are exposed to reuse by malicious attackers and by malicious insiders. If a system administrator can recover a password directly, or brute force it from the available information, that administrator can try it on the user's other accounts.
How it happens
The team wants to avoid plaintext, so it encrypts passwords with a key held by the application. Or it encodes them. Or it stores a reversible token. The application can decrypt them, usually because someone wanted a "forgot password" email that reveals the old password.
That feature is the tell. If the system can show a user their password, the system keeps it in a form that anyone with the key can also read.
What an attacker gains
The record lists confidentiality and access control. Revealed passwords may be reused elsewhere to impersonate users, and users' passwords may be revealed.
MITRE's observed example is CVE-2022-30018: a messaging platform serialized all elements of User and Group objects, making private information available to adversaries.
How to find it
MITRE lists automated static analysis. Also check manually:
- Look for decrypt calls on password fields.
- Test whether the password reset flow ever reveals or emails the current password.
- Inspect what your user and group objects serialize in API responses and logs.
How to fix it
The mitigation in the record, in Architecture and Design: use strong, non reversible encryption to protect stored passwords. In practice that means storing a salted one way hash made with a slow password hashing function, and verifying by hashing the submitted value and comparing. Reset flows should issue a new password or a one time link, never reveal the old one.
Reset flows give it away
A quick way to tell whether a system stores passwords in a recoverable form is to look at its password reset. If the "forgot password" feature emails or displays the current password, the password is stored in a form the system can read back.
A sound reset flow never needs the old password. It proves the user's identity by another route, then lets the user set a new password. The new one is hashed and the old one is gone for good.
The same logic applies to administrators. MITRE points out that if an administrator can recover a password directly, or brute force it from the stored data, the administrator can try it against the user's other accounts. A one way hash removes that option. Only the user knows the password, and that is the property you want.
Quick check
Why is encrypting a password not enough?
Because the application, or anyone with the key, can decrypt it. MITRE says recoverable encrypted passwords give no significant benefit over plaintext.