CWE一覧に戻る
CWE-328

弱いハッシュの使用

Use of Weak Hash
脆弱性 レビュー中
JA

この製品は、敵が元の入力を合理的に決定すること(前画像攻撃)、同じハッシュを生成できる別の入力を見つけること(第2前画像攻撃)、または同じハッシュに評価される複数の入力を見つけること(誕生日攻撃)を可能にするハッシュ関数のセキュリティの期待値を満たさないダイジェスト(出力値)を生成するアルゴリズムを使用しています。

ハッシュ関数は、任意サイズのデータを固定サイズのダイジェスト(出力)にマップするアルゴリズムとして定義される:

この定義に基づき、暗号化ハッシュ関数は、悪意のある行為者がハッシュ関数を利用して以下のいずれかを決定することに合理的な成功確率を持つことができないことも保証しなければならない:

何を「合理的」と見なすかは文脈や脅威モデルによって異なるが、一般的に「合理的」であれば、ブルートフォース(すなわち、平均して、可能な組み合わせの半分を試みること)よりも効率的な攻撃をカバーすることができる。ブルートフォースよりも効率的であっても、現実世界では達成可能とはみなされない攻撃もあることに注意。

上記の条件を満たさないアルゴリズムは、一般的にハッシュにおける一般的な使用には弱いとみなされる。

アルゴリズム的な弱さに加えて、ハッシュ関数は、そのセキュリティ保証を破るようなセキュリティコンテキストでハッシュを使用することによって弱くすることができる。例えば、(十分に短い)パスワードを保存するためにソルトなしでハッシュ関数を使用すると、ある条件下でパスワードを復元するために敵が「レインボーテーブル」[REF-637]を作成することを可能にする可能性がある;この攻撃はMD5、SHA-1、SHA-2などのハッシュ関数に対して機能する。

EN

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:

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:

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.

Scope: Access Control / Impact: Bypass Protection Mechanism
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.
MITRE公式ページ — CWE-328