Skip to content

VNX-929: Broken hash algorithm (MD5, MD2, MD4, SHA-1) in Java or Kotlin

CWE-929 is an OWASP Top Ten 2013 category with no code shape of its own; this rule reports the concrete Java/Kotlin signal it was generated for, a collision-broken digest: MessageDigest.getInstance("MD5"/"MD2"/"MD4"/"SHA-1"/"SHA1"/"SHA"), with the argument possibly on the next line, the same name passed through a String constant assigned in the same file or as commons-codec MessageDigestAlgorithms.MD2/MD5/SHA_1, Apache commons-codec DigestUtils.md5/md5Hex/sha1/sha1Hex/sha/shaHex/md2 (and getMd5Digest/getSha1Digest), Spring DigestUtils.md5Digest/md5DigestAsHex, and Guava Hashing.md5()/Hashing.sha1(). Not reported: SHA-2 and SHA-3 digests, algorithm names in comments and strings, and digests whose surrounding code names a non-security purpose (an ETag, checksum, CRC, cache key, fingerprint, de-duplication, a Gravatar URL or the RFC 6455 WebSocket accept key). In a .java file only MD2 and MD4 are reported here: an MD5 or SHA-1 digest in Java is reported by VNX-CRYPTO-001 (MD5) and VNX-CRYPTO-002 (SHA-1), or by VNX-327 when it protects a password or token, which read every Java shape this rule reads. Kotlin, which those rules do not read, keeps all four algorithms here.

Updated 02 Nov 2026Checked against cli@de9b52a
Field Value
Rule ID VNX-929
Severity Medium
SARIF level warning
Kind sast
Languages Java, Kotlin
CWE CWE-929
CAPEC CAPEC-66
ATT&CK T1190
CWSS vector CWSS:1.0/TI:M/AP:RU/AL:S/IC:N/FC:LT/RP:RU/RL:S/AV:L/AS:N/IN:A/SC:A/BI:M/DI:H/EX:M/EC:N/P:C
Tags weak-hash-mobile crypto cwe-929
Source internal/sast/rules/vnx-929.rego

Overview

CWE-929 is an OWASP Top Ten 2013 category with no code shape of its own; this rule reports the concrete Java/Kotlin signal it was generated for, a collision-broken digest: MessageDigest.getInstance(“MD5”/“MD2”/“MD4”/“SHA-1”/“SHA1”/“SHA”), the same name passed through a String constant assigned in the same file, Apache commons-codec DigestUtils.md5/md5Hex/sha1/sha1Hex/sha/shaHex/md2 (and getMd5Digest/getSha1Digest), and Guava Hashing.md5()/Hashing.sha1(). Not reported: SHA-2 and SHA-3 digests, algorithm names in comments and strings, and digests whose surrounding code names a non-security purpose (an ETag, checksum, CRC, cache key, fingerprint, de-duplication or the RFC 6455 WebSocket accept key). In a .java file this rule reports only MD2 and MD4. An MD5 or SHA-1 digest in Java is reported by VNX-CRYPTO-001 (MD5) and VNX-CRYPTO-002 (SHA-1), or by VNX-327 when it protects a password or token, so the same line is not reported twice. Kotlin, which those rules do not read, keeps all four algorithms here.

Why This Matters

MD5 and SHA-1 collisions can be produced cheaply, and both are fast enough to brute-force passwords at billions of guesses a second. A token, signature or password hash built on them gives far less protection than it appears to.

What Gets Flagged

// Java
MessageDigest md2 = MessageDigest.getInstance("MD2");
MessageDigest md4 = MessageDigest.getInstance("MD4");
// Kotlin
val md = MessageDigest.getInstance("MD5")
fun token(user: String) = DigestUtils.sha1Hex(user + System.nanoTime())

What Is Not Flagged

// Java MD5 and SHA-1: reported by VNX-CRYPTO-001, VNX-CRYPTO-002 or VNX-327
MessageDigest md5 = MessageDigest.getInstance("MD5");
MessageDigest md = MessageDigest.getInstance("SHA-256");
// ETag for a static asset, not a security use
String etag = DigestUtils.md5Hex(body);

Remediation

  1. Use SHA-256 or SHA-3 for integrity and signatures.
  2. Use a password KDF (Argon2, bcrypt, scrypt or PBKDF2) for passwords.
  3. Where MD5 or SHA-1 is required for a non-security purpose, name it (an ETag or checksum variable) so the intent is clear.
  4. For a confirmed false positive, add a vulnetix-ignore: VNX-929 comment on the line.

References

Suppressing this rule

Put a nosec comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file’s language (#, //, -- or ;):

# nosec vnx-929
// nosec vnx-929

Or record an ignore rule: vulnetix ignore add --rule vnx-929 --reason "...". See Suppressing findings.

Edit this pageSources: cli/internal/sast/rules/vnx-929.rego, cli/internal/sast/docs/vnx-929.md
esc
↑ ↓ move↵ openSearches in your browser. A key like autonomy.max or a code like threshold_required jumps straight to it.