Safeguard
Application Security•

ASVS 5.0 V11.4.1: Stop Using MD5 for Crypto

ASVS V11.4.1 allows only approved hashes for signatures, HMAC, KDFs and random bit generation, and bans MD5 for any cryptographic purpose. Find and replace it.

Safeguard Security Team
2 min read

ASVS 5.0 V11.4.1 (Level 1) requires that only approved hash functions are used for general cryptographic purposes: digital signatures, HMAC, key derivation and random bit generation. Disallowed functions, MD5 above all, must not be used for any cryptographic purpose.

Why it matters

MD5 collisions are cheap to produce, and SHA-1 collisions are practical too. A signature or integrity check built on them can be forged. The risk is rarely in the obvious place; it is the old helper function that fingerprints uploads or signs a callback URL.

How to implement it

Use SHA-256, SHA-384, SHA-512 or SHA-3 as the general purpose family. For message authentication, use HMAC with one of those:

import hmac, hashlib
tag = hmac.new(key, msg, hashlib.sha256).hexdigest()
ok = hmac.compare_digest(tag, received)

For passwords, a plain hash is the wrong tool at any strength; see V11.4.2.

Try it yourself

Click through it at your own pace, or open it full screen.

How to test it

Search for md5, MD5, sha1, createHash('md5') and MessageDigest.getInstance("MD5"). For each hit, decide if it is a cryptographic use. If it is, replace it. If it is a pure cache key with no security role, document that and prefer a modern hash anyway so scanners stay quiet.

Common mistakes

  • Calling a signature check "just a checksum"
  • Using SHA-256 alone to derive keys from passwords
  • Keeping MD5 because an old API demands it, with no compensating control

Quick check

Is MD5 allowed for HMAC under V11.4.1?

No. It must not be used for any cryptographic purpose.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.