Polyfill.io supply chain attack hits 100,000+ websites — all you need to know (2024)

In a significant supply chain attack, over 100,000 websites using Polyfill[.]io, a popular JavaScript CDN service, were compromised.

Earlier this year, a Chinese company called Funnull took over the ownership of the polyfill[.]io domain. What followed was the CDN delivering malicious JavaScript code which was automatically deployed on websites that embedded scripts from cdn.polyfill[.]io. The code would redirect mobile visitors of a website to scam sites.

As a result of the fall out from this attack, Google has informed advertisers about possible impacts on their landing pages that might be contaminated with malicious scripts, whereas safe mirrors of Polyfill have been setup by Fastly and Cloudflare.

We break down what this incident means for npm developers and packages relying on the Polyfill CDN.

Understanding the Polyfill.io Compromise

In February 2024, Andrew Betts, the original developer of the polyfill service warned users against using polyfill[.]io as a precaution—months before there was any indication, knowledge of, foul play involved.

"If your website uses http://polyfill.io, remove it IMMEDIATELY," wrote Betts. "I created the polyfill service project but I have never owned the domain name and I have had no influence over its sale."

"No website today requires any of the polyfills."

Sansec researchers discovered this week that ever since the domain changed hands, it has been "injectingmalwareon mobile devices via any site that embeds cdn.polyfill[.]io." and raised the alarm bells for everyone.

Although technology leaders like Cloudflare, Fastly, and Google have all stepped in to thwart the threat, it's not yet over. Google started alerting advertisers that, as a result of this attack, their landing pages contain the malicious code that could send visitors away from the intended site without the website owner knowing about it. Cloudflare and Fastly setup safer mirrors of the Polyfill service.

Given how widespread this is, we don't expect to understand the real impact of this supply chain attack for many weeks. Attacks like these, however, can be quite devastating. For example, it can be used to plant backdoors that could allow the threat actor(s) to remotely access an infected device—similar to what we saw with the compromise of IRS-authorised tax filing service eFile.com that was caught delivering malicious JavaScript.

Cryptocurrency theft, mining, and credit card skimming are key characteristics of successful Magecart-style attacks that often involve delivering malicious JavaScript via otherwise legitimate websites or CDNs that have been quietly compromised.

npm libraries that still use unsafe Polyfill.io CDN

As Mozilla explains it, "A polyfill is a piece of code (usually JavaScript on the Web) used to provide modern functionality on older browsers that do not natively support it."

Several npm packages designed to offer the polyfill functionality continue to embed code from the 'cdn.polyfill[.]io' service. For example, looking at the 'create-polyfill-service-url' package, we can see it uses the service as the default provider for polyfill:

Polyfill.io supply chain attack hits 100,000+ websites — all you need to know (1)

Similar behavior is exhibited by other libraries, like 'dynamic-polyfill' that fetch code from the CDN:

Polyfill.io supply chain attack hits 100,000+ websites — all you need to know (2)

Although the polyfill[.]io domain is, at the time of writing, redirecting to Cloudflare's mirror, we can not conclude that the threat from this domain is over yet, given that the DNS entries could be manipulated in the future to resume the attack.

Out of caution, the Sonatype Security Research team has and continues to categorize several npm packages under sonatype-2024-2304 as 'Potentially Unwanted Application(s)' or PUAs.

Users of Sonatype Lifecycle and Sonatype Repository Firewall will notice that open source packages that rely on the risky polyfill[.]io domain will gradually start flagging a security alert.

We understand it may not be practical to identify and flag every single library from every registry that uses or has in the past used the 'cdn.polyfill[.]io service. Our teams are actively reviewing the ongoing incident and will discretionarily modify our package blocklists while bearing in mind that some applications could have a legitimate need for these packages and that their software builds should continue to run smoothly.

Polyfill.io supply chain attack hits 100,000+ websites — all you need to know (3)

Mitigation and Response

In response to the Polyfill.io compromise, security experts recommend several measures to mitigate the risks associated with JavaScript supply chain attacks:

  1. Regular Audits and Monitoring: Conduct regular security audits and monitor third-party services for unusual activity. Early detection can help prevent widespread damage.
  2. Content Security Policy (CSP): Implementing a robust CSP can help restrict the sources from which scripts can be loaded, reducing the risk of malicious code execution.
  3. Subresource Integrity (SRI): Use SRI to ensure that third-party scripts have not been tampered with. This security feature allows browsers to verify that a fetched resource matches the expected hash.
  4. Dependency Management: Maintain strict control over dependencies (a feature of Sonatype Nexus Repository) and avoid unnecessary third-party scripts. Regularly update and review dependencies to ensure they are secure.

Future of Supply Chain Security

The Polyfill.io attack is a stark reminder of the evolving threat landscape in web development and is a wake up call. As the use of third-party services continues to grow, so does the need for robust supply chain security practices. It highlights the urgent need for improved supply chain security measures and greater vigilance in monitoring third-party services Developers and organizations must prioritize security at every stage of the development process to mitigate risks associated with third-party dependencies.

Investing in advanced threat detection systems, educating developers on secure coding practices, and fostering a culture of security awareness are crucial steps in enhancing supply chain security. Additionally, collaboration between security researchers, developers, and service providers is essential to identify and address vulnerabilities promptly.

Polyfill.io supply chain attack hits 100,000+ websites — all you need to know (4)

Written by Ax Sharma

Ax is a Staff Security Researcher & Malware Analyst at Sonatype with a penchant for open source software. His works and expert analyses have frequently been featured by leading media outlets including the BBC. Ax's expertise lies in security vulnerability research, reverse engineering, and cybercrime investigations. He has a passion for educating a wide range of audiences through writing and vlogs.

Explore All Posts by Ax Sharma

Tags

vulnerabilities Nexus Firewall npm Javascript supply chain

Polyfill.io supply chain attack hits 100,000+ websites — all you need to know (2024)

FAQs

Is polyfill.io safe? ›

The recent discovery of a website supply chain attack using the cdn.polyfill.io domain has left many websites vulnerable to malicious code injection. Once a trusted resource for adding JavaScript polyfills to websites, the domain has recently become the epicenter of a significant website supply chain attack.

What is polyfill.io used for? ›

Polyfill was a popular JavaScript open source library used to support compatibility with older browsers. The domain polyfill.io, that was hosting this package, was acquired by a new owner in Feb, 2024. After the ownership change this domain was caught injecting malware on mobile devices.

Who uses polyfills? ›

“The polyfill.js is a popular open source library to support older browsers. 100K+ sites embed it using the cdn.polyfill.io domain. Notable users are JSTOR, Intuit and World Economic Forum. However, in February this year, a Chinese company bought the domain and the Github account.

What is a polyfill in JavaScript? ›

A polyfill in JavaScript is a script that adds modern features to older browsers that do not natively support them. To use it, include the polyfill script in your HTML or install it via a package manager, ensuring compatibility with older environments.

Is Babel polyfill deprecated? ›

This package has been deprecated in favor of separate inclusion of required parts of core-js and regenerator-runtime . See our website @babel/polyfill for more information. See our website @babel/polyfill for more information or the issues associated with this package.

What does polyfill do? ›

Polyfills allow web developers to use an API regardless of whether or not it is supported by a browser, and usually with minimal overhead. Typically they first check if a browser supports an API, and use it if available, otherwise using their own implementation.

Which browser is compatible with polyfill? ›

Polyfills work by detecting whether a certain feature is supported by the browser. If the feature is not supported, the polyfill code is executed to provide an alternative implementation. This allows the developer to use the feature as if it were natively supported, regardless of the browser's capabilities.

Do I need polyfill? ›

The reason why polyfills are not used exclusively is for better functionality and better performance. Native implementations of APIs can do more and are faster than polyfills. Other times, polyfills are used to address issues where browsers implement the same features in different ways.

What is another name for polyfill? ›

What is another word for Polyfilla?
spacklefiller
Polyfillmulti-purpose filler
filling pastefilling putty

Why do we need polyfills? ›

The Need for Polyfills

Browser Compatibility: The latest features of a programming language or web platform may not be supported by all browsers and environments, which can cause compatibility problems for developers. Polyfills aid in ensuring that the code functions consistently on various browsers and gadgets.

What is the difference between Babel and polyfill? ›

What Are the Differences Between Babel and Polyfills? To avoid confusion, let's make it clear what Babel and polyfills can each cover. The only thing Babel can do is to convert ES6+ syntax to ES5, if there aren't any plugins. The thing polyfills can do is inject a snippet code to support web APIs.

What is a polyfill in HTML? ›

Polyfill, or even Polyfilla, is any code component that makes cutting-edge HTML, CSS or JavaScript functions available in older browsers that inherently lack support. In most cases, a polyfill is written in JavaScript.

What does polyfill feel like? ›

If you were to Goldilocks-it and jump back and forth between the two, you might notice that the Poly Fill's texture is slightly spongier than the classic loft of the Feather Down, but again it's very subtle.

What does a polyfill mod do? ›

Polyfill has become the go-to for removing unwanted acoustics from your keyboard. Hollowness, tinniness or high pitched frequencies can all be reduced or eliminated with the use of this fantastic filler. Just place some in the bottom of your case in the desired locations, seal it up and you are good to go.

What is polyfill stuffing used for? ›

Polyester fiberfill is a synthetic fiber used for stuffing pillows and other soft objects such as stuffed animals. It is also used in audio speakers for its acoustic properties. It is commonly sold under the trademark name Poly-Fil, or un-trademarked as polyfill.

References

Top Articles
Latest Posts
Article information

Author: Aron Pacocha

Last Updated:

Views: 6365

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Aron Pacocha

Birthday: 1999-08-12

Address: 3808 Moen Corner, Gorczanyport, FL 67364-2074

Phone: +393457723392

Job: Retail Consultant

Hobby: Jewelry making, Cooking, Gaming, Reading, Juggling, Cabaret, Origami

Introduction: My name is Aron Pacocha, I am a happy, tasty, innocent, proud, talented, courageous, magnificent person who loves writing and wants to share my knowledge and understanding with you.