Skip to main content
HighContentOWASP A02:2021CWE-327

How to fix: Deprecated Cipher or Hash Algorithm in Page Code

Weak or broken cryptographic algorithms in client-side JavaScript.

Why it matters

Weak cryptography provides a false sense of security. MD5/SHA-1 can be forged, DES/RC4 broken, Math.random() is predictable.

Cryptographic algorithms become weak as computing power increases. MD5 collisions can be generated in seconds.

How to fix it

  1. 1Replace MD5/SHA-1 with SHA-256 or SHA-3.
  2. 2Replace DES/RC4 with AES-256-GCM.
  3. 3Use crypto.getRandomValues() instead of Math.random().
  4. 4Use the SubtleCrypto API.

Code examples

Web Crypto API

JavaScript
// BAD: Math.random().toString(36);
// GOOD:
const array = new Uint8Array(32);
crypto.getRandomValues(array);
const token = Array.from(array, b => b.toString(16).padStart(2, '0')).join('');

References

Detected automatically by VulnRadar. The check id is weak-crypto, stable across every scan so you can filter or diff on it.

See every content check

Questions

How severe is Deprecated Cipher or Hash Algorithm in Page Code?
VulnRadar rates this high severity in the content category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id weak-crypto, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Deprecated Cipher or Hash Algorithm in Page Code map to?
It maps to CWE-327. In the OWASP Top 10 it falls under A02:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for deprecated cipher or hash algorithm in page code

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Deprecated Cipher or Hash Algorithm in Page Code | VulnRadar