Description
The product stores a password in plaintext within resources such as memory or files.
Potential Impact
Access Control
Gain Privileges or Assume Identity
Demonstrative Examples
...Properties prop = new Properties();prop.load(new FileInputStream("config.properties"));String password = prop.getProperty("password");DriverManager.getConnection(url, usr, password);......String password = regKey.GetValue(passKey).toString();NetworkCredential netCred = new NetworkCredential(username,password,domain);...# 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
Avoid storing passwords in easily accessible locations.
Consider storing cryptographic hashes of passwords as an alternative to storing in plaintext.
A programmer might attempt to remedy the password management problem by obscuring the password with an encoding function, such as base 64 encoding, but this effort does not adequately protect the password because the encoding can be detected and decoded easily.
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-30275 | Remote Terminal Unit (RTU) uses a driver that relies on a password stored in plaintext. |
Related Weaknesses
Taxonomy Mappings
- 7 Pernicious Kingdoms: — Password Management
- Software Fault Patterns: SFP23 — Exposed Data
- ISA/IEC 62443: Part 4-2 — Req CR 1.5
- ISA/IEC 62443: Part 3-3 — Req SR 1.5
Frequently Asked Questions
What is CWE-256?
CWE-256 (Plaintext Storage of a Password) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. The product stores a password in plaintext within resources such as memory or files.
How can CWE-256 be exploited?
Attackers can exploit CWE-256 (Plaintext Storage of a Password) to gain privileges or assume identity. This weakness is typically introduced during the Architecture and Design, Architecture and Design phase of software development.
How do I prevent CWE-256?
Key mitigations include: Avoid storing passwords in easily accessible locations.
What is the severity of CWE-256?
CWE-256 is classified as a Base-level weakness (Medium abstraction). It has been observed in 1 real-world CVEs.