CWE-521 Base Draft

Weak Password Requirements

This vulnerability occurs when an application fails to enforce strong password policies, making user accounts easier to compromise through guessing or automated attacks.

Definition

What is CWE-521?

This vulnerability occurs when an application fails to enforce strong password policies, making user accounts easier to compromise through guessing or automated attacks.
Passwords are the most common form of user authentication, acting as a memorized secret to verify identity. If password rules are too weak—like allowing short, simple, or common passwords—attackers can quickly guess or brute-force them, leading to unauthorized account access. The required strength depends on what the system protects; a social media account needs different safeguards than a banking application. Implementing effective password requirements is a critical security control. Developers must establish and enforce policies that mandate sufficient length, complexity, and uniqueness, while also considering user experience through secure alternatives like password managers. Getting this balance right is essential for protecting user accounts and maintaining trust in the authentication system.
Real-world impact

Real-world CVEs caused by CWE-521

  • key server application does not require strong passwords

How attackers exploit it

Step-by-step attacker path

  1. 1

    Identify a code path that handles untrusted input without validation.

  2. 2

    Craft a payload that exercises the unsafe behavior — injection, traversal, overflow, or logic abuse.

  3. 3

    Deliver the payload through a normal request and observe the application's reaction.

  4. 4

    Iterate until the response leaks data, executes attacker code, or escalates privileges.

Vulnerable code example

Vulnerable pseudo

MITRE has not published a code example for this CWE. The pattern below is illustrative — see Resources for canonical references.

Vulnerable pseudo
// Example pattern — see MITRE for the canonical references.
function handleRequest(input) {
  // Untrusted input flows directly into the sensitive sink.
  return executeUnsafe(input);
}
Secure code example

Secure pseudo

Secure pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
  const safe = validateAndEscape(input);
  return executeWithGuards(safe);
}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Prevention checklist

How to prevent CWE-521

  • Architecture and Design A product's design should require adherance to an appropriate password policy. Specific password requirements depend strongly on contextual factors, but it is recommended to contain the following attributes: - Enforcement of a minimum and maximum length - Restrictions against password reuse - Restrictions against using common passwords - Restrictions against using contextual string in the password (e.g., user id, app name) Depending on the threat model, the password policy may include several additional attributes. - Complex passwords requiring mixed character sets (alpha, numeric, special, mixed case) - Increasing the range of characters makes the password harder to crack and may be appropriate for systems relying on single factor authentication. - Unfortunately, a complex password may be difficult to memorize, encouraging a user to select a short password or to incorrectly manage the password (write it down). - Another disadvantage of this approach is that it often does not result in a significant increases in overal password complexity due to people's predictable usage of various symbols. 1. Large Minimum Length (encouraging passphrases instead of passwords) - Increasing the number of characters makes the password harder to crack and may be appropriate for systems relying on single factor authentication. - A disadvantage of this approach is that selecting a good passphrase is not easy and poor passwords can still be generated. Some prompting may be needed to encourage long un-predictable passwords. 1. Randomly Chosen Secrets - Generating a password for the user can help make sure that length and complexity requirements are met, and can result in secure passwords being used. - A disadvantage of this approach is that the resulting password or passpharse may be too difficult to memorize, encouraging them to be written down. See NIST 800-63B [REF-1053] for further information on password requirements.
  • Architecture and Design Consider a second authentication factor beyond the password, which prevents the password from being a single point of failure. See CWE-308 for further information.
  • Implementation Consider implementing a password complexity meter to inform users when a chosen password meets the required attributes.
  • Implementation Previously, "password expiration" was widely advocated as a defense-in-depth approach to minimize the risk of weak passwords, and it has become a common practice. Password expiration requires a password to be changed within a fixed time window (such as every 90 days). However, this approach has significant limitations in the current threat landscape, and its utility has been reduced in light of the adoption of related protection mechanisms (such as password complexity and computational effort), along with the recognition that regular password changes often caused users to generate more predictable passwords. As a result, this is now a Discouraged Common Practice [REF-1488] [REF-1489], especially as the sole factor in protecting passwords. It is still strongly encouraged to force password changes in case of evidence of compromise, but this is not the same as a forced "expiration" on an arbitrary time frame.
Detection signals

How to detect CWE-521

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 searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Plexicus auto-fix

Plexicus auto-detects CWE-521 and opens a fix PR in under 60 seconds.

Codex Remedium scans every commit, identifies this exact weakness, and ships a reviewer-ready pull request with the patch. No tickets. No hand-offs.

Frequently asked questions

Frequently asked questions

What is CWE-521?

This vulnerability occurs when an application fails to enforce strong password policies, making user accounts easier to compromise through guessing or automated attacks.

How serious is CWE-521?

MITRE has not published a likelihood-of-exploit rating for this weakness. Treat it as medium-impact until your threat model proves otherwise.

What languages or platforms are affected by CWE-521?

MITRE lists the following affected platforms: Not Technology-Specific.

How can I prevent CWE-521?

A product's design should require adherance to an appropriate password policy. Specific password requirements depend strongly on contextual factors, but it is recommended to contain the following attributes: - Enforcement of a minimum and maximum length - Restrictions against password reuse - Restrictions against using common passwords - Restrictions against using contextual string in the password (e.g., user id, app name) Depending on the threat model, the password policy may include several…

How does Plexicus detect and fix CWE-521?

Plexicus's SAST engine matches the data-flow signature for CWE-521 on every commit. When a match is found, our Codex Remedium agent opens a fix PR with the corrected code, tests, and a one-line summary for the reviewer.

Where can I learn more about CWE-521?

MITRE publishes the canonical definition at https://cwe.mitre.org/data/definitions/521.html. You can also reference OWASP and NIST documentation for adjacent guidance.

Ready when you are

Don't Let Security
Weigh You Down.

Stop choosing between AI velocity and security debt. Plexicus is the only platform that runs Vibe Coding Security and ASPM in parallel — one workflow, every codebase.