In 2024 a widely embedded JavaScript service turned hostile without a single line of code changing on the websites that used it, because the domain those sites trusted had been sold. polyfill.io served small compatibility scripts to older browsers, and sites loaded it with one script tag pointing at cdn.polyfill.io. After the domain and project changed hands in February 2024, the service began injecting code that redirected some mobile visitors to scam and betting sites. This guide sets out a dated timeline from official and primary sources, explains how the compromise worked at a defensive level, and covers the controls that contain this class of attack: script inventory, Subresource Integrity, self-hosting and Content Security Policy. It is written for web developers, AppSec teams and the people who own third-party script risk. For the wider discipline, see the Client-Side Security Guide.
Key takeaways
- A domain is a dependency. Every site that embedded cdn.polyfill.io delegated script execution to whoever controlled that domain, and that control changed hands through an ordinary sale.
- Warnings came months before the attack. Fastly and Cloudflare publicly advised users to move off polyfill.io at the end of February 2024; malicious injection was reported on 25 June 2024.
- Dynamic scripts cannot be pinned. polyfill.io built a different bundle per browser from the User-Agent header, so Subresource Integrity could not be applied: removal or self-hosting were the only reliable fixes.
- Conditional payloads defeat spot checks. Sansec reported the injected code ran only on mobile devices, at certain hours, and skipped visitors with admin cookies, so site owners testing their own pages were unlikely to see it.
- Infrastructure providers can contain, but not fix. CDN rewrites, ad platform enforcement and the registrar placing the domain on hold reduced harm; the lasting fix was each site removing the reference.
What happened
polyfill.io was an open source service that, in the words of the project README, "reads the User-Agent header of each request and returns polyfill that are suitable for the requesting browser". Sites added it so that modern JavaScript features worked in older browsers. Because the response was assembled per request, sites loaded it live from the service's CDN domain rather than shipping a fixed file.
According to Cloudflare, the polyfill.io domain was sold in February 2024 to Funnull, which Cloudflare described as a relatively unknown company. Sansec reported that the buyer acquired both the domain and the project's GitHub account. On 25 June 2024 Sansec published research showing that the service was injecting malicious code into sites that embedded cdn.polyfill.io, and Cloudflare stated that on that date the service was used to inject code that, under certain circumstances, redirected users to other websites.
On 29 May 2025 the US Treasury's Office of Foreign Assets Control (OFAC) sanctioned Funnull Technology Inc., a Philippines-based company it said provides infrastructure for websites used in virtual currency investment scams. The Treasury release states that in 2024 Funnull bought a repository of code used by web developers and altered it to redirect visitors of legitimate websites to scam and online gambling sites. The release does not name polyfill.io, so treat the connection as a strong match described by the official record rather than a named finding.
Timeline
Dates below come from the sources listed in Standards and references. Where a source gives only a month, so does the table.
| Date | Event | Source |
|---|---|---|
| June 2023 | Earliest known use, per Sansec, of additional domains by the same actor to spread malware | Sansec |
| February 2024 | polyfill.io domain and GitHub account sold to a new owner (Funnull) | Cloudflare; Sansec |
| 28 February 2024 | Fastly community post states polyfill.io "has recently changed ownership" and offers polyfill-fastly.io and polyfill-fastly.net as drop-in replacements, recommending self-hosting or removal | Fastly community |
| 29 February 2024 | Cloudflare publishes a mirror on cdnjs (cdnjs.cloudflare.com/polyfill/) and warns that sites linking to polyfill.io now rely on the new owner to keep the project secure | Cloudflare |
| 8 June 2024 | Earliest matching malicious files seen by Cloudflare's Page Shield (15:23:51 UTC) | Cloudflare |
| 25 June 2024 | Sansec publishes research on malicious injection; Google begins blocking Google Ads for ecommerce sites using polyfill.io, per Sansec | Sansec; Cloudflare |
| 26 June 2024 | Cloudflare announces automatic rewriting of polyfill.io links to its cdnjs mirror, on by default for Free plan sites | Cloudflare |
| 27 June 2024 | Cloudflare real-time rewriting active; the registrar later places the domain on hold, which Sansec says removed the immediate risk | Sansec |
| 28 June 2024 | Sansec flags eight further CDN-style domains it links to the same operator | Sansec |
| 29 May 2025 | OFAC sanctions Funnull Technology Inc., citing the 2024 purchase and alteration of a developer code repository | US Treasury |
How the compromise worked
No website was breached in the usual sense. Each site still served exactly the HTML its owners had written. The attack sat one hop away, in the script the browser was told to fetch. This is ATT&CK T1195.002 Compromise Software Supply Chain delivered to visitors as T1189 Drive-by Compromise, with the infrastructure obtained by purchase, which ATT&CK models as T1583.001 Acquire Infrastructure: Domains.
- Trust by name: a script tag pointing at cdn.polyfill.io trusts whoever answers for that hostname. Registrar records, DNS and TLS certificates all moved legitimately with the sale, so nothing looked wrong at the network layer.
- Per-request generation: because the service built bundles from HTTP headers, Sansec noted it could vary the payload by visitor, and there was no single file to hash or compare.
- Selective activation: Sansec's decoded sample redirected only mobile user agents, excluded desktop platforms, ran only in certain hours with randomised probability, skipped execution when admin cookies were present, and delayed itself when common analytics tools were detected.
- Look-alike infrastructure: Cloudflare and Sansec both listed a look-alike analytics domain (googie-anaiytics.com) used to load the second stage, which then redirected to betting and scam sites.
The selective activation is the defensive lesson. A developer loading their own site from a desktop browser while logged in would have seen nothing. Only continuous, independent monitoring of what scripts actually load and change, from realistic client profiles, catches this behaviour. The MITRE ATT&CK T1189 Drive-by Compromise guide covers the visitor-side technique in more depth.
Impact
Published counts vary with method and date, so use them as order-of-magnitude figures. Sansec reported more than 100,000 sites embedding the library via cdn.polyfill.io. Cloudflare cited estimates of use on nearly 4% of all websites. The direct harm reported was redirection of mobile visitors to scam and betting sites; the reported code did not target payment pages specifically, but the same position in the page could have read form fields or altered checkout content, which is why the incident matters to anyone in PCI DSS scope.
| Party | Impact | Response described in sources |
|---|---|---|
| Site visitors (mobile) | Redirected to scam and betting sites at certain times | Browser and threat feed blocking of the domain, per Cloudflare |
| Website owners | Unwanted code ran under their origin; reputational and possible compliance exposure | Remove the tag, replace with a self-hosted build or a trusted mirror |
| Ecommerce advertisers | Google Ads blocked for ecommerce sites using polyfill.io, per Sansec | Remove the reference to restore ads |
| CDN and edge providers | Customers exposed through their sites | Mirrors (cdnjs, polyfill-fastly.io) in February; Cloudflare automatic link rewriting from 26 June 2024 |
| Registrar | Domain used for malicious hosting | Domain placed on hold, per Sansec |
Cloudflare chose to rewrite links rather than block the domain outright, because a block could cause widespread outages on sites that depended on the script. That trade-off shows why third-party script decisions belong to the site owner: an intermediary can reduce harm, but only the owner can remove the dependency safely.
Controls that help (SRI, self-hosting, CSP)
The Subresource Integrity (SRI) Guide and the Content Security Policy Guide cover each control in full. The table shows how each would have performed against polyfill.io specifically.
| Control | What it does | Against polyfill.io | Trade-off |
|---|---|---|---|
| Remove the dependency | Drops the script altogether | Fully effective; the original creator and Fastly both advised that modern browsers rarely need it | Needs a browser support check |
| Self-host a fixed build | Serve a reviewed copy from your own origin | Fully effective; code changes only through your release process | You own updates and vulnerability tracking |
| Subresource Integrity (integrity attribute) | Browser refuses a file whose hash does not match | Not usable: the bundle varied per browser, so no stable hash existed | Only works for static, versioned files; needs crossorigin and CORS |
| CSP script-src allowlist | Limits which origins can load scripts | Allowing cdn.polyfill.io still permitted the first script; a tight allowlist would have blocked the second-stage look-alike domain | Host allowlists trust whole domains; nonces, hashes and strict-dynamic are stronger |
| CSP report-only and reporting | Reports violations without blocking | Would have surfaced unexpected script origins from real visitor browsers | Report volume needs triage |
| Integrity-Policy header | Blocks listed resource types that lack integrity metadata | Forces every script to carry a hash, so a dynamic third-party script fails closed | Newer browser feature; roll out in report mode first |
| Script change monitoring | Detects new or altered scripts on key pages | Effective only if run from mobile profiles and varied times, given selective activation | Tooling and tuning cost |
Decision guidance: if a third-party script is static and versioned, pin it with SRI and a precise CSP. If it is generated per request, as polyfill.io was, you cannot pin it, so self-host or remove it. If you must load a dynamic third-party script for business reasons, isolate it (for example in a sandboxed iframe on a separate origin) and monitor it continuously. Small organisations with a handful of sites can usually remove or self-host everything in a sprint; large estates need an inventory first, because the hard part is finding every tag across templates, CMS plugins and tag managers.
Lessons for third-party scripts
- Ownership change is a security event: treat a sale, transfer or maintainer change on any domain, package or project you load as a trigger to review it, exactly as you would a new supplier. The February 2024 warnings were public and specific; organisations that acted on them were not exposed in June.
- Inventory before control: you cannot remove a tag you do not know about. Build a script inventory from the browser side (CSP reports, crawlers, synthetic tests) as well as from source code, because tags arrive through tag managers and plugins. See the Google Tag Manager Security guide.
- Prefer build-time over run-time dependencies: a library bundled at build time passes through software composition analysis and code review; a live CDN reference bypasses both. See the Software Composition Analysis (SCA) Guide.
- Floating versions carry the same risk: the Lottie Player npm compromise later in 2024 reached sites that loaded the player from public CDNs using the latest tag, while sites that pinned a version or used SRI were not exposed to the malicious releases.
- Abandoned and sold domains: the same logic applies to domains you once owned or referenced. See the Subdomain Takeover and Dangling DNS Guide.
- Test like the attacker filters: monitoring that runs only from a logged-in desktop session will miss code that skips admins and desktops.
Common failure patterns
- Warnings left unread: the change of ownership was public for four months, but no owner was tracking third-party script notices.
- Allowlisting the CDN and calling it done: a CSP that lists a third-party host trusts everything that host serves, including after a sale.
- Assuming SRI covers everything: teams added integrity attributes where they could and missed that dynamic services cannot carry them.
- Relying on the intermediary: sites behind a CDN that rewrote the link were protected only while that rewrite applied; sites with their own CSP header, or on other providers, were not rewritten.
- Removing the tag from the main template only: legacy microsites, landing pages and email-linked pages kept the reference.
Detection and measurement
To find exposure, search source repositories, CMS templates, tag manager containers and crawled HTML for the strings polyfill.io, bootcdn.net, bootcss.com, staticfile.net, staticfile.org and the other domains Sansec flagged, then block those hostnames in egress filtering and secure web gateways for your own users. Review CSP violation reports for script origins outside your allowlist. Track these measures:
- Script inventory coverage: percentage of public sites with a current, owner-assigned list of every third-party script.
- Pinned or self-hosted share: percentage of third-party scripts on payment and login pages that are self-hosted or carry an SRI hash.
- CSP enforcement rate: percentage of sites with an enforced (not report-only) script-src policy.
- Time to act on supplier notices: days from a public ownership or compromise notice to removal or replacement across all sites.
- Unexpected script alerts: count and mean time to triage of new script origins seen in CSP reports or monitoring.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| MITRE ATT&CK v20 | T1195.002 Compromise Software Supply Chain; T1189 Drive-by Compromise; T1583.001 Acquire Infrastructure: Domains | Supply chain delivery to visitors through a purchased domain |
| NIST CSF 2.0 | ID.AM-02; GV.SC-07; PR.PS-01 | Software inventory, supplier risk monitoring, configuration management |
| NIST SP 800-53 Rev 5 | CM-8; SA-9; SI-7; SR-3; SR-11 | Component inventory, external services, integrity, supply chain controls, component authenticity |
| OWASP ASVS 5.0 | V3.6.1; V3.4.3 | Externally hosted assets only when static, versioned and protected by SRI; Content Security Policy |
| PCI DSS v4.0.1 | Requirements 6.4.3 and 11.6.1 | Payment page script authorisation, integrity and inventory; change and tamper detection |
Practitioner checklist
- Search all code, templates, tag managers and crawled pages for polyfill.io and the related domains Sansec flagged, and remove or replace every reference.
- Build and maintain an owner-assigned inventory of every third-party script, starting with payment and login pages.
- Self-host or remove any third-party script that is generated per request and cannot carry an SRI hash.
- Add SRI and crossorigin attributes to every static third-party script and stylesheet you keep.
- Deploy CSP in report-only mode, then enforce a script-src policy based on nonces or hashes.
- Subscribe an owner to ownership and security notices for each script, package and CDN you load, and treat a sale or maintainer change as a review trigger.
- Run script change monitoring from mobile profiles and at varied times, not only from a logged-in desktop.
- Block known malicious script domains at the web gateway for your own staff.
Standards and references
- US Department of the Treasury: OFAC sanctions on Funnull Technology Inc. (press release sb0149)
- Cloudflare: Automatically replacing polyfill.io links with Cloudflare's mirror for a safer Internet
- Cloudflare: Polyfill.io now available on cdnjs, reduce your supply chain risk
- Fastly Community: New options for Polyfill.io users
- Sansec: Polyfill supply chain attack research
- GitHub: polyfill-service project README
- W3C: Subresource Integrity
- W3C: Content Security Policy Level 3
Related NHI Mgmt Group resources: Client-Side Security Guide · CDN Security Guide · Software Supply Chain Security Guide · Top 10 Supply Chain Attacks · Web Skimming Incident Playbook