CWE-916 Base Incomplet

Use of Password Hash With Insufficient Computational Effort

This vulnerability occurs when a system protects passwords by hashing them, but uses a hashing algorithm that is too fast or computationally cheap. This makes it easy for attackers to crack the…

Définition

What is CWE-916?

This vulnerability occurs when a system protects passwords by hashing them, but uses a hashing algorithm that is too fast or computationally cheap. This makes it easy for attackers to crack the stored password hashes using brute-force methods.
Storing password hashes instead of plaintext passwords is a fundamental security practice, but not all hashes are created equal. Fast, efficient cryptographic hashes like MD5 or SHA-1 are designed for speed, which becomes a major weakness for password storage. If an attacker steals these hashes (e.g., via a database breach), they can use powerful, parallel computing (like GPUs or cloud clusters) to test billions of password guesses per second, rapidly recovering user credentials. To resist these attacks, a password hashing scheme must be deliberately slow, memory-intensive, and include a unique salt for each password. Effective password hashing requires a combination of computational cost (key stretching), memory-hard operations, and salting to significantly slow down an attacker's offline cracking attempts. While SAST tools can detect the use of weak hash functions, Plexicus uses AI to analyze your codebase for these patterns and provides automated, context-aware remediation guidance, helping you upgrade to robust algorithms like Argon2, bcrypt, or scrypt efficiently. This shifts the security balance, making cracking attempts prohibitively expensive and time-consuming for attackers.
Impact réel

Real-world CVEs caused by CWE-916

  • Router does not use a salt with a hash, making it easier to crack passwords.

  • Router does not use a salt with a hash, making it easier to crack passwords.

  • Blogging software uses a hard-coded salt when calculating a password hash.

  • Database server uses the username for a salt when encrypting passwords, simplifying brute force attacks.

  • Server uses a constant salt when encrypting passwords, simplifying brute force attacks.

  • chain: product generates predictable MD5 hashes using a constant value combined with username, allowing authentication bypass.

Comment les attaquants l'exploitent

Parcours de l'attaquant étape par étape

  1. 1

    In this example, a new user provides a new username and password to create an account. The program hashes the new user's password then stores it in a database.

  2. 2

    While it is good to avoid storing a cleartext password, the program does not provide a salt to the hashing function, thus increasing the chances of an attacker being able to reverse the hash and discover the original password if the database is compromised.

  3. 3

    Fixing this is as simple as providing a salt to the hashing function on initialization:

  4. 4

    Note that regardless of the usage of a salt, the md5 hash is no longer considered secure, so this example still exhibits CWE-327.

Exemple de code vulnérable

Vulnerable Python

In this example, a new user provides a new username and password to create an account. The program hashes the new user's password then stores it in a database.

Vulnérable Python
def storePassword(userName,Password):
  	hasher = hashlib.new('md5')
  	hasher.update(Password)
  	hashedPassword = hasher.digest()
```
# UpdateUserLogin returns True on success, False otherwise* 
  	return updateUserLogin(userName,hashedPassword)
Exemple de code sécurisé

Secure Python

Fixing this is as simple as providing a salt to the hashing function on initialization:

Sécurisé Python
def storePassword(userName,Password):
  	hasher = hashlib.new('md5',b'SaltGoesHere')
  	hasher.update(Password)
  	hashedPassword = hasher.digest()
```
# UpdateUserLogin returns True on success, False otherwise* 
  	return updateUserLogin(userName,hashedPassword)
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Liste de contrôle de prévention

How to prevent CWE-916

  • Architecture and Design Use an adaptive hash function that can be configured to change the amount of computational effort needed to compute the hash, such as the number of iterations ("stretching") or the amount of memory required. Some hash functions perform salting automatically. These functions can significantly increase the overhead for a brute force attack compared to intentionally-fast functions such as MD5. For example, rainbow table attacks can become infeasible due to the high computing overhead. Finally, since computing power gets faster and cheaper over time, the technique can be reconfigured to increase the workload without forcing an entire replacement of the algorithm in use. Some hash functions that have one or more of these desired properties include bcrypt [REF-291], scrypt [REF-292], and PBKDF2 [REF-293]. While there is active debate about which of these is the most effective, they are all stronger than using salts with hash functions with very little computing overhead. Note that using these functions can have an impact on performance, so they require special consideration to avoid denial-of-service attacks. However, their configurability provides finer control over how much CPU and memory is used, so it could be adjusted to suit the environment's needs.
  • Implementation / Architecture and Design When using industry-approved techniques, use them correctly. Don't cut corners by skipping resource-intensive steps (CWE-325). These steps are often essential for preventing common attacks.
Signaux de détection

How to detect CWE-916

Automated Static Analysis - Binary or Bytecode SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Bytecode Weakness Analysis - including disassembler + source code weakness analysis Binary Weakness Analysis - including disassembler + source code weakness analysis

Manual Static Analysis - Binary or Bytecode SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies

Manual Static Analysis - Source Code High

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Highly cost effective: ``` Focused Manual Spotcheck - Focused manual analysis of source Manual Source Code Review (not inspections)

Automated Static Analysis - Source Code High

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Highly cost effective: ``` Source code Weakness Analyzer Context-configured Source Code Weakness Analyzer

Automated Static Analysis SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Configuration Checker

Architecture or Design Review High

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Highly cost effective: ``` Formal Methods / Correct-By-Construction ``` Cost effective for partial coverage: ``` Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Correction automatique Plexicus

Plexicus détecte automatiquement CWE-916 et ouvre une PR de correction en moins de 60 secondes.

Codex Remedium analyse chaque commit, identifie cette faiblesse précise et livre une pull request prête à être relue avec le correctif. Pas de tickets. Pas de transferts.

Questions fréquentes

Frequently asked questions

Qu'est-ce que CWE-916 ?

This vulnerability occurs when a system protects passwords by hashing them, but uses a hashing algorithm that is too fast or computationally cheap. This makes it easy for attackers to crack the stored password hashes using brute-force methods.

Quelle est la gravité de CWE-916 ?

MITRE n'a pas publié de note de probabilité d'exploitation pour cette faiblesse. Traitez-la comme un impact moyen jusqu'à ce que votre modèle de menace prouve le contraire.

Quels langages ou plateformes sont affectés par CWE-916 ?

MITRE n'a pas spécifié les plateformes affectées pour ce CWE — il peut s'appliquer à la plupart des stacks applicatives.

Comment puis-je prévenir CWE-916 ?

Use an adaptive hash function that can be configured to change the amount of computational effort needed to compute the hash, such as the number of iterations ("stretching") or the amount of memory required. Some hash functions perform salting automatically. These functions can significantly increase the overhead for a brute force attack compared to intentionally-fast functions such as MD5. For example, rainbow table attacks can become infeasible due to the high computing overhead. Finally,…

Comment Plexicus détecte et corrige CWE-916 ?

Le moteur SAST de Plexicus reconnaît la signature de flux de données de CWE-916 à chaque commit. Lorsqu'une correspondance est trouvée, notre agent Codex Remedium ouvre une PR de correction avec le code corrigé, les tests et un résumé d'une ligne pour le relecteur.

Où puis-je en savoir plus sur CWE-916 ?

MITRE publie la définition canonique à https://cwe.mitre.org/data/definitions/916.html. Vous pouvez également consulter la documentation OWASP et NIST pour des conseils adjacents.

Prêt quand vous l'êtes

Arrêtez de payer par développeur.
Commencez à fermer la boucle.

Plexicus est l'ASPM natif IA qui scanne, filtre, corrige, penteste et explique — de façon autonome. Développeurs illimités, dépôts illimités, actions IA à usage équitable. Vrai niveau gratuit, €269/mo annuel quand vous êtes prêt.