How to fix: External stylesheet without SRI
A CSS stylesheet loaded from a third-party CDN does not have a Subresource Integrity hash. Note: SRI is impractical for continuously-updated third-party CSS (Google Fonts, Bootstrap CDN, and similar font/framework providers), which is why most production sites, including security-conscious ones, don't use it for those; it's most actionable for pinned, versioned stylesheet includes.
Why it matters
A compromised CDN stylesheet can inject CSS-based data exfiltration techniques, CSS keyloggers, or modify the visual appearance of the page to enable phishing, without any JavaScript. This is a narrower attack surface than a compromised script, which can achieve arbitrary code execution.
SRI must be applied to all external CSS resources.
How to fix it
- 1Generate hash: openssl dgst -sha384 -binary style.css | openssl base64 -A
- 2Add integrity and crossorigin to the link element
Code examples
Stylesheet with SRI
<link
rel="stylesheet"
href="https://cdn.example.com/styles.min.css"
integrity="sha384-COMPUTED_HASH"
crossorigin="anonymous"
/>References
Detected automatically by VulnRadar. The check id is sri-stylesheet-missing, stable across every scan so you can filter or diff on it.
More headers checks
Questions
- How severe is External stylesheet without SRI?
- VulnRadar rates this low severity in the headers 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 sri-stylesheet-missing, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does External stylesheet without SRI 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.