CWE-309: Use of Password System for Primary Authentication
Official CWE-309 CWE context with Glexia analysis, remediation guidance, related CVEs, and ATT&CK context.
Glexia's Take
CWE-309: Use of Password System for Primary Authentication
Use of Password System for Primary Authentication represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Executive Impact
- Access Control: Bypass Protection Mechanism,Gain Privileges or Assume Identity: A password authentication mechanism error will almost always result in attackers being authorized as valid users.
Developer Pattern
CWE-309 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.
Confidence
high confidence from CWE-309, 4.20.
Official CWE Definition
CWE-309: Use of Password System for Primary Authentication
The use of password systems as the primary means of authentication may be subject to several flaws or shortcomings, each reducing the effectiveness of the mechanism.
Developer And Remediation Guidance
How teams prevent and detect this weakness
Causes
- In both of these examples, a user is logged in if their given password matches a stored password: This code relies exclusively on a password mechanism (CWE-309) using only one factor of authentication (CWE-308). If an attacker can steal or guess a user's password, they are given full access to their account. Note this code also uses SHA-1, which is a weak hash (CWE-328). It also does not use a salt (CWE-759).
Remediation
- Architecture and Design: [object Object]
- Architecture and Design: Use a zero-knowledge password protocol, such as SRP.
- Architecture and Design: Ensure that passwords are stored safely and are not reversible.
- Architecture and Design: Implement password aging functionality that requires passwords be changed after a certain point.
- Architecture and Design: Use a mechanism for determining the strength of a password and notify the user of weak password use.
- Architecture and Design: Inform the user of why password protections are in place, how they work to protect data integrity, and why it is important to heed their warnings.
Detection
- Code review
- SAST
- DAST
- Focused regression tests
Mappings
Related CVEs, CWEs, and ATT&CK context
Related CWEs
ATT&CK Relevance
ATT&CK relevance is shown only when reviewed or responsibly inferred.