1 CDN Script Tampering Without SRI
Content Delivery Networks (CDNs) distribute libraries like jQuery, Bootstrap, and analytics scripts. If a CDN is compromised or you load a script from an untrusted source, malicious code can run on your users' browsers.
The attack scenario:
- Your page loads:
<script src="https://cdn.example.com/jquery-3.6.0.min.js"></script> - Attacker compromises the CDN or performs a MITM attack
- Malicious version of jQuery is served
- All visitors execute the attacker's code with full browser privileges
This is not theoretical — cdnjs, unpkg, and npm have all had incidents. The 2022 Polyfill.io supply chain attack compromised a widely-used CDN script.
Without SRI, you have no way to detect if the CDN serves a different file than expected.