For about sixteen hours on Monday 16 November, if you visited the website of the BBC, or Zoom, or HSBC, or IKEA, or any of roughly 174 other large organisations, your browser may have quietly run code that none of those organisations wrote, reviewed or intended to serve. The code looked for cryptocurrency wallet addresses and swapped them for the attacker's. Later in the day it learned to read card numbers out of payment forms. On Apple devices running older software it reached for a pair of exploit kits. And it did all of this from inside pages that were, by every ordinary measure, exactly the pages those companies meant to publish.
None of them had been breached. Their servers were untouched, their own code unchanged, their passwords uncompromised. What had happened was both simpler and harder to defend against: a company they all trusted to run JavaScript on their pages, the experimentation vendor Optimizely, had been manipulated into serving hostile code under its own name, and every site that embedded Optimizely's script embedded the hostile code along with it. The script they had trusted on Friday changed its mind on Monday, and the trust carried the change through without a murmur.
I have written before about the supplier underneath the supplier, and about where I chose to trust and where I didn't. This is the same lesson arriving by a different door, and it is worth walking through carefully, because the Optimizely incident is close to a perfect illustration of a risk that most organisations carry, cannot see, and have quietly decided not to think about.
What Optimizely is, and why it was on your page
Optimizely sells web experimentation software: the A/B testing that lets a marketing team try two versions of a headline, or move a button, and measure which performs better, without waiting on an engineering release. To do that, it needs to change the page after it loads, which means it needs to run JavaScript in the visitor's browser. So the customer pastes a small snippet into their site's template, and from then on every page load fetches Optimizely's script from Optimizely's content delivery network and runs it with the full privileges of the page itself.
That is not a flaw. It is how a great deal of the modern web works. Analytics, tag managers, consent banners, chat widgets, fonts, advertising, session-replay tools and testing platforms are all, overwhelmingly, third-party JavaScript loaded at run time from somebody else's server and executed inside your origin. Each one can read the page, read the forms, read the non-protected cookies, and change anything it likes. The convenience is enormous and the trust is almost total. The visitor sees your domain in the address bar and assumes everything on the page is yours. Very often, most of it is not.
The security researcher Scott Helme, who runs the monitoring service Report URI and who found and documented this incident in close to real time, put the lesson in a single line: trusted JavaScript doesn't always remain trustworthy. That is the whole of it, and the rest of this piece is really just an unpacking of that sentence.
How it happened
Optimizely lets its customers add their own custom JavaScript to a project, in a field the product calls Project JavaScript, which then runs on every page carrying that project's snippet. On 16 November, an attacker wrote malicious code into the Project JavaScript field of a great many unrelated customer projects at once, and left everything else about each snippet untouched.
The consequence is the part worth dwelling on. When a visitor's browser fetched the Optimizely script, Optimizely's content delivery network served exactly what it was supposed to serve, signed with Optimizely's own certificate, from Optimizely's own domain. As Helme was careful to state, this was not a CDN cache-poisoning attack; the delivery network served precisely what it had been given. The poison was in the content before it ever reached the edge. Nothing a customer could have inspected about the connection, the certificate or the hostname would have looked wrong, because nothing about them was wrong. The code was authentic. It was simply malicious.
How the attacker gained the write access to reach across so many separate customers' projects is the question that still has no satisfying answer. Optimizely's own statement attributes the incident to a vulnerability an unauthorised party exploited; a spokesperson later placed that flaw in the account sign-up flow of its Experimentation product, and the campaign has since been catalogued under the name OPTIMJACK. What Optimizely has not publicly explained is how a weakness in sign-up translated into write access across the projects of unrelated, established customers. Until it does, I would treat the precise mechanism as unknown rather than fill the gap with a guess, and I would note only that a single flaw which yields cross-tenant write access is the specific nightmare of every multi-tenant software-as-a-service platform, and the specific reason their customers should never assume one tenant's trust boundary is another's.
What the code did
The payload was not subtle in its aims, though it was patient in its construction; Helme watched the attacker rebuild it twenty-six times over the course of the day, adding capabilities as they went.
It began as a cryptocurrency clipper. It watched for wallet addresses on the page, in form fields, in the clipboard and in outgoing requests, and substituted the attacker's own addresses, so that a visitor copying an address to send funds would send them to the wrong place. By the evening, Helme could trace a little over seven thousand dollars already moved into the attacker's wallets, which is a modest sum and almost beside the point; the mechanism, not the morning's takings, is what matters.
In the early afternoon the attacker added a card skimmer. It watched for card numbers entered into a site's own payment fields, recognised them by their structure, and sent them to a collection point. Card details typed into a properly isolated third-party payment frame, the kind a hosted checkout provides, were beyond its reach; card details typed directly into a merchant's own form were not. It also, in certain payment and wallet contexts, lifted the page address, the cookies not marked HttpOnly, and screenshots of the page.
And on Apple devices it attempted something more serious, loading exploit chains, named by researchers as Coruna and DarkSword, aimed at iPhones and iPads running older versions of iOS. Those particular holes were closed by Apple in 18.7.3 and in 26.3, so a visitor on current software was not exposed to that element; a visitor who had let their updates slide was.
I will not reproduce the internals here, and there is no need to. The point for a defender is not how the skimmer recognised a card. The point is that it ran at all, on hundreds of reputable sites, because it arrived wearing the credentials of a supplier those sites had already waved through.
The timeline
Times are UTC, and the compressed shape of the day is itself part of the story.
04:21. The first injection Helme observed. A BBC snippet began loading code from an earlier attacker domain associated with the same actor.
05:23. The primary payload domain used for most of the day was registered. Fresh infrastructure, stood up that morning.
08:28. The first widely recorded request to that domain, from the BBC's site.
11:20 onwards. The campaign spread across customers through the day; Zoom's snippet was modified mid-morning.
13:43. The card skimmer was added to the payload.
Late afternoon. Additional hosts and the iOS exploit element were added; the final version of the payload went live shortly before 18:00.
19:24 to 19:59. Report URI's sweep of the Optimizely snippets it monitors found 186 of 1,611 carrying the malicious code.
20:40 to 21:10. Mass clean-up, as Optimizely removed the injected code and customers pulled it.
21:52. Of the snippets Report URI tracked, a single one remained infected, belonging to TalkTalk.
The exposure window, for most affected sites, was on the order of sixteen hours, the bulk of it before the attacker's infrastructure was pulled and the injected code removed late that evening UTC. Much of the early activity fell in the small hours of the American morning, where many of the affected companies are headquartered, and a great many of the people responsible for those sites will have learned that their pages served malware only after the fact, from the reporting that followed.
Who was caught, and who wasn't
Across the snippets he examined, Helme counted 188 infected out of 1,611 checked, belonging to 178 organisations, and was explicit that the true number was likely higher, since he could only see the snippets his own service already monitored. The named victims read like a directory of the blue-chip web: the BBC, CNN, Zoom, Salesforce, GitLab, IKEA, HSBC, Equifax, Air France-KLM, the hardware-wallet maker Ledger, the streaming service Peacock, and TalkTalk among them. Banking and finance was the single largest affected sector, followed by technology and software, then retail.
That list should put to rest a comforting idea, which is that this sort of thing happens to organisations that were careless. These are among the most heavily resourced security teams in the world, and they were caught not through any failure of their own perimeter but through a supplier's. The question the incident poses is not were they careless. It is what could any of them have done differently, and here the answer is genuinely instructive, because a minority of them had in fact done it.
Helme crawled the sites of 256 affected organisations to see what their Content Security Policy — the browser-level control that lets a site declare which sources of script and which destinations for data it will permit — would have done against the attack. The results are the most useful numbers in the whole affair. Sixty-eight had no Content Security Policy at all. Fifty had one that permitted both the malicious payload to load and the stolen data to leave. Seventeen let the payload run but would have blocked it from sending data out. And twenty-four, around fifteen per cent, had a policy restrictive enough to stop the payload from running in the first place.
Fifteen per cent is not a triumph. But it is the difference between the companies for whom this was a non-event and the companies for whom it was an incident, and the difference was a piece of configuration that costs nothing but attention. It is worth saying plainly that merely allowing Optimizely's domain in the policy, which every affected site that used Optimizely necessarily did, offered no protection whatever, because the malicious code came from Optimizely's domain. What helped was a tight policy on where data was allowed to go, so that even a trusted script could not quietly ship card numbers to a freshly registered domain in Asia. The lesson there is subtle and important: controlling what your suppliers' code can do, and especially where it can send things, matters more than controlling which suppliers you admit.
Why the usual answer doesn't quite work
The instinctive technical fix for "a script I load might change" is Subresource Integrity, a mechanism that lets a site pin the exact cryptographic hash of a script it expects and refuse to run anything that doesn't match. For a static library it is excellent, and I recommend it without reservation. For something like Optimizely it is close to useless, because the whole purpose of an experimentation platform is that its script legitimately changes whenever the marketing team changes an experiment. You cannot pin the hash of a thing that is designed to vary. That is precisely the category of supplier that is hardest to defend against: the one whose job is to change your pages, in real time, from their infrastructure, which means the one you have handed a standing, open-ended licence to alter what your visitors see.
This is the uncomfortable centre of the supply-chain problem, and it is why I keep returning to it. The defences that work are the ones that assume the supplier's code is potentially hostile and constrain what it can do, rather than the ones that try to verify the supplier's code is unchanged. A Content Security Policy that narrowly limits where data may be sent is such a defence. Isolating payment entry into a dedicated frame the marketing tags cannot reach is another. Monitoring your own live pages for the scripts and the outbound connections they actually make, rather than the ones you believe they make, is a third, and is how this incident was caught at all. Every one of those treats the third-party script as a guest to be watched, not a colleague to be trusted.
What to do
For anyone running Optimizely Web Experimentation, the immediate list is short and you have almost certainly been contacted already, but in order: inspect the Project JavaScript field of every project, not merely the served snippet, for anything you did not put there; review and rotate the account's users, API tokens and integrations, since the access route is not fully explained and prudence says assume it was yours; treat any card details entered into your own forms on 16 November as exposed and act accordingly; and rotate session tokens held in cookies that were not marked HttpOnly. Optimizely says it has fixed the vulnerability, removed the injected code from affected projects, and secured affected user accounts, which is the right set of actions, but the verification is yours to do, not theirs to assert.
For everyone else, which is to say every organisation running anybody's third-party JavaScript, the incident is an invitation to do three things that have nothing to do with Optimizely. The first is to find out what you actually run. Most organisations cannot produce an accurate list of the third-party scripts on their own checkout page, let alone the fourth-party scripts those load in turn, and you cannot govern what you cannot enumerate. The second is to deploy a Content Security Policy, even in report-only mode to begin with, and to pay particular attention to restricting where data may be sent rather than only which scripts may load. The third is to get payment entry off the shared page and into an isolated frame, so that the one category of data whose theft is immediately monetisable is out of reach of the marketing estate entirely. None of this is expensive. All of it is a matter of deciding that the convenience of run-time third-party code carries a cost you are going to manage rather than ignore.
For boards
Three questions, none of which needs a technical answer.
Do we know every third party whose code runs inside our customers' browsers on our site, and who owns that list? If no single person can produce it, that is the finding, and it is the same gap that sat under all 178 organisations.
If a supplier we trust served malicious code tomorrow under its own name, what on our side would notice, and how long would it run before someone did? For most of the companies caught on 16 November the honest answer was sixteen hours.
Where a customer types a card number or a password on our site, is anyone else's code able to read that field — and if so, why? The fix for payment data specifically is well understood and largely free, and the incident is a good occasion to ask why it has not been done.
The closing observation
It would be easy to read this as a story about Optimizely, and to conclude that the answer is to trust Optimizely less, or to choose a different vendor, or to demand better of the one you have. Some of that is fair; a platform that can be induced to write one unauthorised party's code into hundreds of unrelated customers' projects has a serious problem to explain, and its customers are entitled to the explanation. But to stop there is to miss the shape of the thing. Every organisation caught that day had made the same reasonable decision that every organisation makes, which is to let a useful supplier run code inside its pages and to assume that code would stay what it was. The decision was reasonable. The assumption was the flaw.
I do not think the lesson is to trust no one, which is neither possible nor useful on the modern web. The lesson is the one I keep arriving at from every direction: trust is a thing you extend deliberately, to a named party, for a specific purpose, with a boundary around what it can do and a way of noticing when it does something else. The sites that came through 16 November untouched were not the ones that trusted Optimizely less. They were the ones that had drawn the boundary in advance, so that when the trusted script changed its mind, the page it was running inside had already decided how far it was allowed to go.