CWE-1391¶
Use of Weak Credentials. [Improper-Access-Control]
Required inputs: IR
By design, authentication protocols try to ensure that attackers must perform brute force attacks if they do not know the credentials such as a key or password. However, when these credentials are easily predictable or even fixed (as with default or hard-coded passwords and keys), then the attacker can defeat the mechanism without relying on brute force.
Credentials may be weak for different reasons, such as:
- Hard-coded (i.e., static and unchangeable by the administrator)
- Default (i.e., the same static value across different deployments/installations, but able to be changed by the administrator)
- Predictable (i.e., generated in a way that produces unique credentials across deployments/installations, but can still be guessed with reasonable efficiency)
Even if a new, unique credential is intended to be generated for each product installation, if the generation is predictable, then that may also simplify guessing attacks.
Demonstrative Examples
Example 1
In 2022, the OT:ICEFALL study examined products by 10 different Operational Technology (OT) vendors. The researchers reported 56 vulnerabilities and said that the products were "insecure by design" [REF-1283]. If exploited, these vulnerabilities often allowed adversaries to change how the products operated, ranging from denial of service to changing the code that the products executed. Since these products were often used in industries such as power, electrical, water, and others, there could even be safety implications.
Multiple OT products used weak credentials.
Excerpts from CWE [https://cwe.mitre.org], Copyright (C) 2006-2026, the MITRE Corporation. See section 9.4. "3rd-Party Licenses" in the documentation for full details.Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
assignment |
Assigning a literal to a variable holding a password. |
None |
False |
comparison |
Comparing a literal to a password. |
None |
False |
key |
The string literal might include a private key. |
None |
False |
parameter |
Passing a literal to a password parameter. |
None |
False |
return |
Returning a literal as a password. |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
critical_routines_pattern¶
critical_routines_pattern : typing.Pattern[str] = 'authenticate'
key_detection_pattern¶
key_detection_pattern : typing.Pattern[str] = 'BEGIN (.*) PRIVATE KEY'
suspect_detection_pattern¶
suspect_detection_pattern : typing.Pattern[str] = 'password'