How to fix: Subresource Integrity hash uses an unsupported algorithm
A script or link element carries an integrity attribute with an unrecognised hash prefix. None of its prefixes is sha256, sha384 or sha512, the only algorithms Subresource Integrity defines.
Why it matters
A browser that recognises no algorithm in the integrity attribute treats the metadata as unusable and loads the resource with no verification at all. The element looks protected in the markup and is not, so a CDN compromise or an on-path substitution goes through exactly as if the attribute had never been written.
The usual causes are an sha1- or md5- prefix copied from an older integrity scheme, or a bare base64 digest with no prefix. This is the quietest kind of SRI failure: there is no console error in most browsers, the resource loads normally, and a reviewer reading the HTML sees an integrity attribute and moves on. Regenerating the hash with sha384 is the whole fix.
How to fix it
- 1Regenerate the digest with sha384 (or sha512) and replace the attribute value, prefix included.
- 2Keep the crossorigin attribute alongside it, since SRI on a cross-origin resource needs a CORS-enabled fetch.
- 3Add a build step that generates integrity attributes rather than writing them by hand.
Code examples
Generate a correct hash
curl -s https://cdn.example.com/lib.js \
| openssl dgst -sha384 -binary \
| openssl base64 -AThe attribute it produces
<script
src="https://cdn.example.com/lib.js"
integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
crossorigin="anonymous"></script>References
Detected automatically by VulnRadar. The check id is supply-chain-sri-weak-hash-algorithm, stable across every scan so you can filter or diff on it.
More supply chain checks
- Mediumnpm/yarn Lock File Exposed
- MediumPython Requirements File Exposed
- MediumRuby Gemfile or Gemfile.lock Exposed
- MediumExternal CDN Script Without SRI Hash
- HighHTTP Script Loaded on HTTPS Page
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
Questions
- How severe is Subresource Integrity hash uses an unsupported algorithm?
- VulnRadar rates this medium severity in the supply chain 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 supply-chain-sri-weak-hash-algorithm, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Subresource Integrity hash uses an unsupported algorithm map to?
- It maps to CWE-353. In the OWASP Top 10 it falls under A08: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.