Optimizely Script Injection: Who Can Change Your Live Code?
At 04:21 UTC on Monday, researchers saw the first malicious code in BBC's Optimizely snippet. The snippet still loaded from Optimizely's own CDN, with Optimizely's own certificate, the same way it always had. By 13:43 UTC, the attacker had added a card skimmer.
Nothing about the delivery looked wrong. The code inside it was the problem.
What happened in the Optimizely attack?
On November 16, 2026, an attacker exploited a vulnerability in Optimizely's web experimentation platform and wrote malicious code into the "Project JavaScript" field of customer projects. Optimizely's snippet delivers that field's code to the visitors of the sites that load it. So the attacker didn't have to break into CNN or Zoom. They changed one field per project, and the vendor's own delivery did the rest.
Scott Helme's team at Report URI checked 1,611 Optimizely snippets and found the malicious code in 188 of them, belonging to 178 organizations. CNN, BBC, Zoom, Salesforce, GitLab, IKEA, HSBC and Equifax were on the list. Banks and financial firms made up the largest group, at 32. The researchers say the real number is likely higher.
What the code did depended on the visitor. The Hacker News lays out the payloads: a crypto clipper that swapped wallet addresses, a card skimmer added in the afternoon, theft of cookies and screenshots, and delivery of iOS exploit kits.
Optimizely says it has fixed the vulnerability and removed the injected code from affected projects. Its notice doesn't say how the flaw worked.
Helme summed up the lesson in one line: "trusted JavaScript doesn't always remain trustworthy."
Would self-hosting the script have stopped it?
This was the first question we asked ourselves. We serve our JavaScript from our own application. We don't load it from a third-party CDN. So would that have protected a site in this attack?
The answer depends on what you mean by self-hosting.
The malicious code wasn't a CDN compromise. Nobody tampered with a file sitting on a server somewhere. The snippets "were still served from cdn.optimizely.com with the vendor's own certificate." Every check a browser or a security policy could make on the source said this was legitimate Optimizely code, because it was. That's also why a Content Security Policy that allowed Optimizely's domain offered no protection. The malware came from the allowed domain.
And some sites served the Optimizely snippet from their own domain. They were affected too. The Hacker News explains why: the content comes from the same project. Moving the file to your own server didn't change who could edit what was in it.
So the useful question for any script on your site is who can change it after you ship.
When the JavaScript is part of our application, it changes when we release a new version of our application. When the JavaScript is a vendor snippet backed by a vendor dashboard, it changes when anyone with write access to that dashboard changes it. That includes the vendor's own staff, the vendor's own bugs, and, on Monday, an attacker who found a flaw in the vendor's platform.
Small sites were not safer here either. Any site whose project was touched got the code, whatever its size. The attack followed the projects, not the traffic.
Why do companies let a vendor script change their live site?
Because that's what these tools are for.
A web experimentation tool exists so a marketing or product team can change what a live page does without waiting for an engineering release. Swap a headline, test a button color, run a promotion on Friday. The entire value of the product is that the change skips the release process. That's the efficiency people are buying.
The release process they're skipping is the one engineering built to catch problems. Code review, testing, a deliberate decision about what goes to production. Engineering applies all of that to its own code and then, on the same page, runs a script whose contents change from a dashboard nobody on the engineering team reviews.
We understand why teams make that trade. Waiting on a release cycle to change a headline is frustrating. But the trade is bigger than it looks. You didn't just let marketing change a headline. You let anything that can write to that project put code in front of your customers, on any page that loads the snippet, with your domain in the address bar.
That's the same tradeoff any delivery team makes between speed and durability. Moving fast is a fine choice when you know what you're giving up.
How Zenpo handles third-party code
We take the opposite position, and we take it on purpose.
We curate every NPM and NuGet package we use. A package goes into our software because someone on our team chose it, not because a tool pulled it in.
We don't automate package updates. When a new version of a package comes out, it doesn't flow into our build on its own. Someone decides to take it.
We review every version upgrade. Even a minor version bump gets reviewed. Code that someone else wrote is still code that runs in our product, and our customers hold us responsible for it either way.
We serve our JavaScript from our own application. What runs in a visitor's browser is what we built and released.
That's more work than letting a bot open pull requests for every update and merging them when the build goes green. We know it. Automated updates exist for efficiency's sake, the same reason web experimentation tools exist. And both carry the same risk: something you didn't review can end up running in your product, under your name.
None of this would have patched Optimizely's vulnerability. Nothing a customer did could have. What it does is keep the list of people who can change our production code short, and keep every change on that list visible to us before it ships.
What should you check after the Optimizely attack?
If you run Optimizely, the researchers have published specific steps. Report URI recommends inspecting your Project JavaScript and experiment code for unknown scripts, rotating credentials for every user, API token and integration that can write to the account, and treating cards entered on Monday as possibly exposed. StepSecurity recommends checking every snippet you serve and asking Optimizely which of your projects changed.
The broader lessons apply to any script your site loads from a vendor.
Deploy a strict Content Security Policy with both script-src and connect-src. Only 24 of the affected organizations had a policy strict enough to block this attack. Sixty-eight had none at all. Allowing a vendor's domain is not enough, because a policy that only checks where code comes from can't tell you what the code does. The connect-src directive limits where code on your page can send data, and that's the part that stops a skimmer from getting the card numbers out.
Keep third-party tags off your checkout pages. A payment page doesn't need an A/B test.
Put card entry in your payment provider's iframe. The skimmer in this attack couldn't read cards entered in a cross-origin payment iframe. Help Net Security reports that card details typed into a separate provider's payment fields "were out of its reach."
Find out who can write to your tag managers and experimentation tools. Treat that list the same way you treat the list of people who can deploy to production, because on Monday it was the same list. If your governance covers the code engineering ships but not the code marketing publishes from a dashboard, you've governed half the page.
Then go through every script on your site and write down who can change it without a release. Do it this week, while Monday is still fresh.