Description
Obscuring a password with a trivial encoding does not protect the password.
Password management issues occur when a password is stored in plaintext in an application's properties or configuration file. A programmer can 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.
Potential Impact
Access Control
Gain Privileges or Assume Identity
Demonstrative Examples
...Properties prop = new Properties();prop.load(new FileInputStream("config.properties"));String password = Base64.decode(prop.getProperty("password"));DriverManager.getConnection(url, usr, password);......string value = regKey.GetValue(passKey).ToString();byte[] decVal = Convert.FromBase64String(value);NetworkCredential netCred = newNetworkCredential(username,decVal.toString(),domain);...Mitigations & Prevention
Passwords should be encrypted with keys that are at least 128 bits in length for adequate security.
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-45099 | network attached storage (NAS) product uses weak encoding for a password |
Related Weaknesses
Taxonomy Mappings
- 7 Pernicious Kingdoms: — Password Management: Weak Cryptography
- OWASP Top Ten 2004: A8 — Insecure Storage
Frequently Asked Questions
What is CWE-261?
CWE-261 (Weak Encoding for Password) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. Obscuring a password with a trivial encoding does not protect the password.
How can CWE-261 be exploited?
Attackers can exploit CWE-261 (Weak Encoding for Password) 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-261?
Key mitigations include: Passwords should be encrypted with keys that are at least 128 bits in length for adequate security.
What is the severity of CWE-261?
CWE-261 is classified as a Base-level weakness (Medium abstraction). It has been observed in 1 real-world CVEs.