SRI uses SHA-384 or stronger
Why it matters
Subresource Integrity hashes cryptographically verify that a resource loaded from a CDN has not been tampered with. SHA-256 is technically valid but weaker than the W3C-recommended minimum of SHA-384 — collision attacks on SHA-256 are within the theoretical reach of well-resourced adversaries, and the W3C explicitly recommends SHA-384 for SRI. CWE-345 (Insufficient Verification of Data Authenticity) and CWE-494 (Download of Code Without Integrity Check) both apply when hash strength is below recommended minimums. OWASP A08 (Software and Data Integrity Failures) flags weak or absent integrity verification as a supply chain risk.
Severity rationale
Medium because SHA-256-only SRI hashes are technically valid but below the W3C recommended strength floor, creating a marginal but unnecessary gap in supply chain integrity verification.
Remediation
Upgrade all SRI hashes from SHA-256 to SHA-384. Regenerate hashes using OpenSSL or a trusted SRI hash generator.
<!-- Before: SHA-256 only (below W3C recommended minimum) -->
<script src="https://cdn.example.com/lib.js"
integrity="sha256-abc123..."
crossorigin="anonymous"></script>
<!-- After: SHA-384 (W3C recommended minimum) -->
<script src="https://cdn.example.com/lib.js"
integrity="sha384-xyz789..."
crossorigin="anonymous"></script>
Generate SHA-384 hashes: openssl dgst -sha384 -binary lib.js | openssl base64 -A. You can also specify both algorithms (sha384-... sha512-...) for belt-and-suspenders verification — the browser uses the strongest supported hash.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Security Headers II Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-345 — Insufficient Verification of Data Authenticity
- cwe · CWE-494 — Download of Code Without Integrity Check
- owasp:2021 · A08
- soc2:2017 · CC6.8 — Prevention and detection of unauthorized or malicious software
Taxons
History
- 2026-04-18·v1.0.0·Initial import from security-headers-ii·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.8) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2