Katalog CWE

CWE-328 · Słabość

Use of Weak Hash

Abstrakcja
Bazowa
Status
Szkic
Dodano
19 lipca 2006
Ostatnia zmiana
11 grudnia 2025

Podatności CVE z tą słabościąPełny wpis na cwe.mitre.org ↗

Opis

The product uses an algorithm that produces a digest (output value) that does not meet security expectations for a hash function that allows an adversary to reasonably determine the original input (preimage attack), find another input that can produce the same hash (2nd preimage attack), or find multiple inputs that evaluate to the same hash (birthday attack).

A hash function is defined as an algorithm that maps arbitrarily sized data into a fixed-sized digest (output) such that the following properties hold:

1. The algorithm is not invertible (also called "one-way" or "not reversible")

1. The algorithm is deterministic; the same input produces the same digest every time

Building on this definition, a cryptographic hash function must also ensure that a malicious actor cannot leverage the hash function to have a reasonable chance of success at determining any of the following:

1. the original input (preimage attack), given only the digest

1. another input that can produce the same digest (2nd preimage attack), given the original input

1. a set of two or more inputs that evaluate to the same digest (birthday attack), given the actor can arbitrarily choose the inputs to be hashed and can do so a reasonable amount of times

What is regarded as "reasonable" varies by context and threat model, but in general, "reasonable" could cover any attack that is more efficient than brute force (i.e., on average, attempting half of all possible combinations). Note that some attacks might be more efficient than brute force but are still not regarded as achievable in the real world.

Any algorithm that does not meet the above conditions will generally be considered weak for general use in hashing.

In addition to algorithmic weaknesses, a hash function can be made weak by using the hash in a security context that breaks its security guarantees. For example, using a hash function without a salt for storing passwords (that are sufficiently short) could enable an adversary to create a "rainbow table" [REF-637] to recover the password under certain conditions; this attack works against such hash functions as MD5, SHA-1, and SHA-2.

Skutki

  • Access Control

    Bypass Protection Mechanism

Zapobieganie

  • 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.

    Skuteczność: High

Przykłady podatności

Słabość nadrzędna

Słabości podrzędne

Kiedy powstaje

Dotyczy

Not Language-Specific, ICS/OT

Uwagi

Since CWE 4.4, various cryptography-related entries including CWE-328 have been slated for extensive research, analysis, and community consultation to define consistent terminology, improve relationships, and reduce overlap or duplication. As of CWE 4.6, this work is still ongoing.

Źródła

  1. MD5 considered harmful today — Alexander Sotirov et al.
  2. The Art of Software Security Assessment — Mark Dowd, John McDonald, Justin Schuh, Chapter 2, "Common Vulnerabilities of Integrity", Page 47, Addison Wesley, 2006
  3. bcrypt — Johnny Shelley
  4. Tarsnap - The scrypt key derivation function and encryption utility — Colin Percival
  5. RFC2898 - PKCS #5: Password-Based Cryptography Specification Version 2.0 — B. Kaliski, 5.2 PBKDF2, 2000
  6. How To Safely Store A Password — Coda Hale, 2010
  7. How Companies Can Beef Up Password Security (interview with Thomas H. Ptacek) — Brian Krebs, 2012
  8. Password security: past, present, future — Solar Designer, 2012
  9. Our password hashing has no clothes — Troy Hunt, 2012
  10. Should we really use bcrypt/scrypt? — Joshbw, 2012
  11. Rainbow table — Wikipedia, 2009
  12. Cryptanalysis of SHA-1 — Bruce Schneier, 2005
  13. At death's door for years, widely used SHA1 function is now dead — Dan Goodin, Ars Technica, 2017
  14. OT:ICEFALL: The legacy of "insecure by design" and its implications for certifications and risk management — Forescout Vedere Labs, 2022
  15. dmi_jtag.sv — 2021
  16. fix cwe_1205 in dmi_jtag.sv — 2021

Wpis z katalogu CWE 4.20.