---
title: "CWE-328: Use of Weak Hash"
url: https://radicalnotion.ai/cwe/cwe-328
type: cwe
description: "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)."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-328: Use of Weak Hash

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 93
- **Of those, in CISA KEV:** 0
- **New in 2026:** 45
- **CWE catalog version:** 4.21

## Description

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:

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

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:

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

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

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.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | COMMISSION: This weakness refers to an incorrect design related to an architectural security tactic. |

## Applicable platforms

**Languages:** Go (Undetermined)

**Technologies:** ICS/OT (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control | Bypass Protection Mechanism | - |

## Potential mitigations

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

Effectiveness: High

## Detection methods

### Automated Static Analysis

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

Effectiveness: High

## Demonstrative examples

### Example 1

In both of these examples, a user is logged in if their given password matches a stored password:

Bad code:

```c
unsigned char *check_passwd(char *plaintext) {
    ctext = simple_digest("sha1",plaintext,strlen(plaintext), ... );
    //Login if hash matches stored hash
    if (equal(ctext, secret_password())) {
        login_user();
    }
}
```

Bad code:

```java
String plainText = new String(plainTextIn);
MessageDigest encer = MessageDigest.getInstance("SHA");
encer.update(plainTextIn);
byte[] digest = password.digest();
//Login if hash matches stored hash
if (equal(digest,secret_password())) {
    login_user();
}
```

This code relies exclusively on a password mechanism (CWE-309) using only one factor of authentication (CWE-308). If an attacker can steal or guess a user's password, they are given full access to their account. Note this code also uses SHA-1, which is a weak hash (CWE-328). It also does not use a salt (CWE-759).

### Example 2

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.

At least one OT product used weak hashes.

### Example 3

The example code below is taken from the JTAG access control mechanism of the Hack@DAC'21 buggy OpenPiton SoC \[REF-1360\]. Access to JTAG allows users to access sensitive information in the system. Hence, access to JTAG is controlled using cryptographic authentication of the users. In this example (see the vulnerable code source), the password checker uses HMAC-SHA256 for authentication. It takes a 512-bit secret message from the user, hashes it using HMAC, and compares its output with the expected output to determine the authenticity of the user.

Bad code:

```systemverilog
...
logic [31:0] data_d, data_q
logic [512-1:0] pass_data;
...
    Write: begin
        ...
            if (pass_mode) begin
                pass_data = { {60{8'h00}}, data_d};
                state_d = PassChk;
                pass_mode = 1'b0;
            ...
    end
...
```

Good code:

```systemverilog
...
logic [512-1:0] data_d, data_q
logic [512-1:0] pass_data;
...
    Write: begin
        ...
            if (pass_mode) begin
                pass_data = data_d;
                state_d = PassChk;
                pass_mode = 1'b0;
            ...
    end
...
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2022-30320 | Programmable Logic Controller (PLC) uses a protocol with a cryptographically insecure hashing algorithm for passwords. |
| CVE-2005-4900 | SHA-1 algorithm is not collision-resistant. |
| CVE-2020-25685 | DNS product uses a weak hash (CRC32 or SHA-1) of the query name, allowing attacker to forge responses by computing domain names with the same hash. |
| CVE-2012-6707 | blogging product uses MD5-based algorithm for passwords. |
| CVE-2019-14855 | forging of certificate signatures using SHA-1 collisions. |
| CVE-2017-15999 | mobile app for backup sends SHA-1 hash of password in cleartext. |
| CVE-2006-4068 | Hard-coded hashed values for username and password contained in client-side script, allowing brute-force offline attacks. |

## Real CVEs with this weakness (sample of 12 of 93)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-51996 | - | critical | 9.8 | - | No | 2026-09-24 |
| CVE-2026-36182 | - | critical | 9.8 | - | No | 2026-06-04 |
| CVE-2025-41652 | Weidmueller: Authentication Bypass Vulnerability in Industrial Ethernet Switches | critical | 9.8 | - | No | 2025-05-27 |
| CVE-2025-27595 | Weak hashing alghrythm | critical | 9.8 | - | No | 2025-03-14 |
| CVE-2022-45141 | samba: Samba AD DC using Heimdal can be forced to issue rc4-hmac encrypted Kerberos tickets | critical | 9.8 | - | No | 2023-03-06 |
| CVE-2023-0452 | Use of Weak Hash in Econolite EOS | critical | 9.8 | - | No | 2023-01-26 |
| CVE-2004-2761 | MD5: MD5 Message-Digest Algorithm is not collision resistant | critical | 9.8 | - | No | 2009-01-05 |
| CVE-2020-37168 | Ecommerce Systempay 1.0 Production Key Brute Force | critical | 9.3 | - | No | 2026-05-13 |
| CVE-2024-54143 | openwrt/asu allows build artifact poisoning via truncated SHA-256 hash and command injection | critical | 9.3 | - | No | 2024-12-06 |
| CVE-2026-97468 | Apache CXF: Authentication bypass via weak cache keys for validated STS tokens | critical | 9.1 | - | No | 2026-10-09 |
| CVE-2023-46233 | crypto-js PBKDF2 1,000 times weaker than specified in 1993 and 1.3M times weaker than current standard | critical | 9.1 | - | No | 2023-10-25 |
| CVE-2023-46133 | crypto-es PBKDF2 1,000 times weaker than specified in 1993 and 1.3M times weaker than current standard | critical | 9.1 | - | No | 2023-10-25 |

## Related attack patterns (CAPEC)

- [CAPEC-461](https://radicalnotion.ai/capec/capec-461): Web Services API Signature Forgery Leveraging Hash Function Extension Weakness
- [CAPEC-68](https://radicalnotion.ai/capec/capec-68): Subvert Code-signing Facilities

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-326](https://radicalnotion.ai/cwe/cwe-326) | Inadequate Encryption Strength |
| Parent | [CWE-327](https://radicalnotion.ai/cwe/cwe-327) | Use of a Broken or Risky Cryptographic Algorithm |
| Child | [CWE-916](https://radicalnotion.ai/cwe/cwe-916) | Use of Password Hash With Insufficient Computational Effort |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Reversible One-Way Hash | - | - |
| OWASP Golang Secure Coding Practices Guide | Cryptographic Practices | - | - |

## Frequently asked questions

### What is CWE-328?

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

### What CVEs are caused by CWE-328?

93 recorded CVEs are attributed to CWE-328, including CVE-2026-51996, CVE-2026-36182 and CVE-2025-41652.

### Is CWE-328 part of the OWASP Top 10?

CWE-328 maps to OWASP Golang Secure Coding Practices Guide: Cryptographic Practices in the OWASP security taxonomy.

### How do you prevent CWE-328?

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.

### How is CWE-328 detected?

Automated Static Analysis: 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.)

### What are the consequences of CWE-328?

Exploiting CWE-328 can lead to: Bypass Protection Mechanism.

### Is CWE-328 actively exploited?

93 recorded CVEs are caused by CWE-328; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/328.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-328). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
