Polyfill.io: How a Trusted Script Became an Attack in 2024
By Laís Peixoto
Growth Marketer, Proteside
Published · 5 min read

The polyfill.io attack, disclosed in June 2024, exposed a classic risk in the script supply chain: a domain used by more than 100,000 sites, according to Sansec, changed hands and began serving malicious code. Sites that kept loading the service did not have to change their own code to be exposed.
The polyfill.io attack, disclosed in June 2024, exposed a classic risk in the script supply chain: a domain used by more than 100,000 sites, according to Sansec, changed hands and began serving malicious code. Sites that kept loading the service did not have to change their own code to be exposed. The case shows why approving a vendor once is not enough.
What happened
Polyfill.io was a free service that delivered compatibility code for older browsers. All it took was one line on the page pointing to the service's address.
- February 2024. According to Sansec, a Chinese company bought the domain and the project's GitHub account; BleepingComputer identified it as Funnull. On February 28, a notice on the Fastly forum reported the change of ownership and suggested using a replacement, hosting your own copy or removing the service.
- The creator stepped away. Andrew Betts, who created the project, said he never owned the domain or had any influence over the sale, and recommended removing it from sites, according to Simon Willison's blog.
- June 25, 2024. Sansec revealed that the domain was injecting malicious code into mobile phones visiting the sites that loaded it, redirecting visitors to a betting site through a domain that imitated Google Analytics.
- June 27. The registrar Namecheap suspended the domain, according to Sansec and Censys.
- July 2. Censys still counted 384,773 servers with pages referencing the malicious address.
The numbers measure different things: Sansec refers to sites that loaded the script; Censys, to servers that still referenced it after the suspension.
Why it was hard to notice
According to Sansec, the code only acted on certain phones and at certain times, did not show up for anyone who appeared to be an administrator and delayed execution when it detected traffic analysis tools. It was also generated on the fly, based on the data the browser sent on each visit.
In practice, this defeats the most common check: the owner opens the page, sees nothing strange and moves on. The attack hid precisely from the people looking after the site.
What the case teaches
In the documented case, polyfill.io redirected visitors; no evidence is presented here of card theft by this campaign. Scripts running on the main page, however, can tamper with visible content, replace a QR code or read data in accessible fields. That is not the same as directly accessing the inside of a payment iframe isolated on another origin. This is the power described in compromised plugins, themes and third-party scripts.
The PCI Security Standards Council guidance on payment page security, from March 2025, starts from the same observation: third-party scripts can change without the store's knowledge. For the environments where they apply, requirement 6.4.3 covers the authorization, justification and integrity of payment page scripts, and 11.6.1 covers detecting unauthorized changes to the page and to the relevant HTTP headers received by the browser, at least weekly or at a frequency defined by risk analysis. Validation criteria vary, including in the SAQ A revised in 2025. See the details in what PCI DSS 6.4.3 and 11.6.1 require.
What to do
- Remove what you don't need. The creator himself said current browsers no longer need polyfill.io.
- Consider hosting a fixed, audited version. This removes the dependency on the external domain, but your own file can still be compromised through an intrusion, an improper release or infrastructure changes. Apply change control, reviews and monitoring.
- Use Subresource Integrity (SRI) where it fits. The browser compares the fingerprint (hash) of the external file with the authorized value; if they differ, it does not run the resource. This is useful for static libraries. It is not practical for responses that vary by browser, and blocking alone does not replace operational alerts.
- Limit the origins. Content Security Policy is a list, sent to the browser, of the addresses from which the page may load scripts. It is one of the examples the PCI SSC cites.
- Monitor the page as the customer sees it. See how to monitor changes to your checkout.
- Keep the inventory up to date. Approving the vendor is not approving today's version. See third-party scripts on the payment page.
The original service returned different files depending on the browser, so a single static SRI hash was not a practical solution for the traditional dynamic integration. For static libraries or frozen versions, SRI can be adopted. Combine it with inventory, CSP, dependency review and page monitoring.
How to check whether your site still calls polyfill.io
Search for cdn.polyfill.io and for old references to the service in the application code, the theme, the tag manager and the browser's network responses. Don't rely only on searching local files: plugins and third parties can inject references at runtime. If you find a call, identify its source, remove it, test the site and confirm in production that there are no new requests to the domain.
Don't just swap the address for another similar service. Before adopting an alternative, document the need, the fixed version, who maintains it and how integrity will be checked.
Frequently asked questions
What was the polyfill.io attack?
A JavaScript supply chain attack in 2024. The domain of a free script changed hands and began redirecting mobile visitors to betting sites.
Is my site still at risk if it used polyfill.io?
The domain was suspended on June 27, 2024, but a forgotten reference in the code remains a weak spot. Remove any call to the old address.
Does SRI solve the third-party script problem?
Only partly. It works for fixed files, not for scripts that change frequently, and it does not alert you when it blocks something, according to the PCI SSC.
In short
Trusting a script means trusting whoever controls its address tomorrow. To understand script controls and how they fit into PCI validation, see the PCI DSS compliance solution and the concept of payment page integrity. Proteside works at the moment of payment: it checks, in the payer's browser, whether the card form, the QR code and the other data displayed are the ones the store issued, blocks any mismatch before confirmation and records the evidence.


