Website Supply Chain Attack: How a Trusted Website Can Become a Malware Threat Without Being Hacked Directly

A website can serve malware to its visitors while its own servers stay untouched. It happens when a script the site loads from another company changes what it does.

That’s a website supply chain attack, and two cases show the scale. On November 16, 2026, malicious JavaScript reached visitors of 178 organizations through Optimizely, an A/B testing tool. In 2024, more than 100,000 sites carried altered code from the polyfill.io service.

Why the browser can’t tell the difference

A web page isn’t one file. The browser assembles it from the site’s own code plus scripts from analytics tools, testing tools, ad networks and content delivery networks, and it runs them all with the same standing. A contributed piece from Report URI in The Hacker News says a third-party script can read the page, read form fields as people type, read cookies and local storage, and send requests anywhere.

Optimizely shows why that matters. The poisoned file still came from cdn.optimizely.com with Optimizely’s certificate, a host every affected site already trusted. Cyber Kendra notes that browsers and most security allowlists treated it as legitimate. Nothing about the file looked wrong to the browser. Report URI checked 1,611 Optimizely scripts and found 188 infected, and the injection ran for roughly 17 hours on November 16 before a mass clean-up, Cyber Kendra reports.

How a trusted script goes bad

Sometimes the vendor itself is the door. Optimizely told BleepingComputer that an unauthorized party exploited a flaw in its Experimentation account signup flow and added code to some customer projects. The attacker wrote a short loader into a field called Project JavaScript, where customers keep custom code that runs on every page, and left the rest of each file alone. The same actor had already pushed an injector through scripts from Kissmetrics, StorifyMe and Minute Media between November 13 and 16, Report URI found. The sites, sectors and payload are covered in more detail in our breakdown of the Optimizely malware attack on 178 websites.

Sometimes a service changes hands. Polyfill.io supplied small compatibility fixes for old browsers. In February 2024 a company called Funnull bought the domain and its GitHub account, and sites that embedded the script then pulled code straight from the new owner, BleepingComputer reported.

Sansec saw the modified script send mobile visitors to scam sites through a fake Google Analytics domain. Google began warning advertisers and disapproving ads whose landing pages carried the code, and it said Bootcss, Bootcdn and Staticfile had caused similar redirects. The original project developer had already said no website needs the library’s polyfills today, so dropping the tag would have removed the exposure.

Sometimes nobody sells anything and the owner just walks away. The Hacker News piece describes a content delivery network that was wound down years ago. In July 2025 someone registered its expired domain and set up wildcard DNS, so any hostname under it now points to infrastructure that person controls, while thousands of pages still call it. The piece says those sites hadn’t been hacked at all. They had handed a script tag to an outsider years earlier and never revisited the choice.

Why scanners and audits miss it

Your servers are clean, so server-side tools report clean. The same Hacker News piece points out that static analysis and dependency scanning look at what an organization builds and ships, and a third-party script is neither. The visitor’s browser fetches it live from a server the organization doesn’t run, and the response can vary by geography, user agent, referrer, time of day and session.

Polyfill showed what that allows. Sansec found the code only activated on specific mobile devices at specific hours, and it skipped users it recognized as admins. A site owner checking from an office desktop had little chance of seeing it.

A clean file today doesn’t prove it was clean on the day, Cyber Kendra notes. Report URI makes a related point: for almost every site, nobody can say what code a third-party script contained last week.

What helps, and where each fix falls short

Subresource Integrity (SRI) is the browser’s built-in answer. You put a hash of the file in the script tag, and the browser blocks anything that doesn’t match.

It only suits files that stay the same. A service that pushes updates to one URL would break a fixed hash with every release, which is why one government-wide analytics program says in its FAQ that it publishes no SRI hash for its hosted script. CentralCSP adds that scripts loaded by other scripts carry no integrity attribute at all.

A Content Security Policy (CSP) limits which hosts a page may load scripts from and send data to. After the Optimizely incident, Report URI checked the affected organizations’ policies: 68 had none, and 24 had one that blocked the payload. Allowing the vendor’s own host didn’t help, since the code came from that host. A strict script-src list did help, and a tight connect-src stopped card and cookie theft even where the script ran.

Two settings undercut the policy. The keyword ‘strict-dynamic’ trusts anything the vendor’s snippet inserts, and ‘unsafe-eval’, which Optimizely’s documentation tells customers to allow, let an embedded copy of the payload run at HSBC even though the download was blocked.

For polyfill.io the fix was blunter: remove the tag. Cloudflare and Fastly set up mirrors for anyone who still wanted the library.

What visitors can do

You can’t audit a site’s scripts from the outside, so the advice is about damage control. After the Optimizely incident, Report URI told people who had visited affected sites to update iPhones and iPads to iOS 18.7.3 or later, or 26.3 or later, to check any crypto transfer they made, and to watch card statements. The full list of affected sites and what the script could steal is in the earlier article.

How to check your own site, step by step

Work through these in order.

  1. List the scripts you load. View the page source. Every external script tag should carry integrity and crossorigin attributes, so any that don’t are candidates. Scripts that load other scripts won’t show up here, which is what step 2 catches.
  2. Run a CSP in report-only mode. It blocks nothing and changes no behavior, it only reports what a policy would have blocked. Collect reports for about a week and build your inventory from them, as the Hacker News piece suggests.
  3. Remove what nobody can justify. For payment pages, PCI DSS 6.4.3 asks for a written justification for each script.
  4. Pin and hash what stays static. Use a versioned URL, never a “latest” one, then add integrity and crossorigin=”anonymous” to the tag. MDN’s command for the hash is cat FILENAME.js | openssl dgst -sha384 -binary | openssl base64 -A, as quoted by Smashing Magazine.
  5. Enforce the policy. List only the hosts you need in script-src, restrict connect-src, and avoid ‘unsafe-eval’ where you can, per Report URI’s findings.
  6. Watch for changes. PCI DSS 11.6.1 requires detecting and alerting on unauthorized changes to payment page scripts and security headers. Both requirements have been mandatory since March 31, 2025.
  7. Lock the vendor accounts. Review who and what can write to any dashboard that puts code on your pages, and rotate credentials and tokens. That was Report URI’s advice to Optimizely customers.

If I had one afternoon, I’d run step 2 first and read the report before touching anything else. The Hacker News piece says the list of what executes in visitors’ browsers is rarely the list anyone expected.

Facebook Comments Box

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like