Description
The storage of passwords in a recoverable format makes them subject to password reuse attacks by malicious users. In fact, it should be noted that recoverable encrypted passwords provide no significant benefit over plaintext passwords since they are subject not only to reuse by malicious attackers but also by malicious insiders. If a system administrator can recover a password directly, or use a brute force search on the available information, the administrator can use the password on other accounts.
Potential Impact
Confidentiality, Access Control
Gain Privileges or Assume Identity
Access Control
Gain Privileges or Assume Identity
Demonstrative Examples
int VerifyAdmin(char *password) {if (strcmp(compress(password), compressed_password)) {printf("Incorrect Password!\n");return(0);}printf("Entering Diagnostic Mode...\n");return(1);}int VerifyAdmin(String password) {if (passwd.Equals(compress(password), compressed_password)) {return(0);}
//Diagnostic Mode
return(1);}# Java Web App ResourceBundle properties file
...webapp.ldap.username=secretUsernamewebapp.ldap.password=secretPassword......<connectionStrings><add name="ud_DEV" connectionString="connectDB=uDB; uid=db2admin; pwd=password; dbalias=uDB;" providerName="System.Data.Odbc" /></connectionStrings>...Mitigations & Prevention
Use strong, non-reversible encryption to protect stored passwords.
Detection Methods
- Automated Static Analysis High — Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then sea
Real-World CVE Examples
| CVE ID | Description |
|---|---|
| CVE-2022-30018 | A messaging platform serializes all elements of User/Group objects, making private information available to adversaries |
Related Weaknesses
Taxonomy Mappings
- CLASP: — Storing passwords in a recoverable format
- Software Fault Patterns: SFP23 — Exposed Data
Frequently Asked Questions
What is CWE-257?
CWE-257 (Storing Passwords in a Recoverable Format) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. The storage of passwords in a recoverable format makes them subject to password reuse attacks by malicious users. In fact, it should be noted that recoverable encrypted passwords provide no significan...
How can CWE-257 be exploited?
Attackers can exploit CWE-257 (Storing Passwords in a Recoverable Format) to gain privileges or assume identity. This weakness is typically introduced during the Architecture and Design phase of software development.
How do I prevent CWE-257?
Key mitigations include: Use strong, non-reversible encryption to protect stored passwords.
What is the severity of CWE-257?
CWE-257 is classified as a Base-level weakness (Medium abstraction). It has been observed in 1 real-world CVEs.