CWE-1391

Use of Weak Credentials. [Improper-Access-Control]

Required inputs: IR

The product uses weak credentials (such as a default key or hard-coded password) that can be calculated, derived, reused, or guessed by an attacker.

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

critical_routines_pattern

critical_routines_pattern : typing.Pattern[str] = 'authenticate'

Routines with a fully qualified name matching this pattern are considered as taking credentials for parameters
 

key_detection_pattern

key_detection_pattern : typing.Pattern[str] = 'BEGIN (.*) PRIVATE KEY'

Regex pattern used to detect the ASCII armor of private keys in string literals
 

suspect_detection_pattern

suspect_detection_pattern : typing.Pattern[str] = 'password'

Objects with identifiers including the pattern are considered suspects for holding credentials