Your website can be changed without anyone touching it. 178 brands just found out how.

· · Security

Your website runs code from companies you have never audited. The analytics tag, the A/B testing tool, the chat widget, the tag manager: each one loads fresh from its supplier every time a visitor arrives, and each supplier can change what your visitors' browsers run without you deploying anything. We covered the general shape of this risk in the code on your website you did not write.

On 16 November it happened at a scale that is hard to ignore. Attackers wrote their own code into Optimizely, a tool large companies use to test different versions of their web pages, and that code ran on the sites of 178 organisations for roughly 17 hours.

What happened

Optimizely's testing product works by having each customer's site load a small file, called a snippet, from Optimizely's servers. The snippet includes an optional box of custom code that the customer writes in their Optimizely dashboard and that runs on every page. The attacker wrote a few lines into that box on customer projects. Everything else in the file was untouched, and it was still served from Optimizely's own trusted address.

Report URI, a company that monitors what scripts do in visitors' browsers, checked 1,611 Optimizely snippets and found 188 infected, belonging to 178 organisations. It says the real number is likely higher. Its list includes names UK readers will know well: the BBC, O2, Virgin Media O2, TalkTalk, ASOS, Admiral, Equifax UK, interactive investor, and tombola. Optimizely's own website and login page carried the code too.

Report URI's timeline puts the first injection at 04:21 UTC on 16 November and a mass clean-up between roughly 20:40 and 21:10 UTC. During the day the attacker rebuilt the malicious script 26 times, and one company's snippet was cleaned and then re-infected while the attack was running.

Optimizely told BleepingComputer that an unauthorised party exploited a vulnerability in the sign-up flow for its Experimentation accounts and used it "to add malicious JavaScript to some customer projects". The company says it has fixed the flaw, removed the injected code, and "ended active sessions, revoked tokens, and reset access for affected user accounts". Its incident notice says it has added protections to stop unauthorised code being delivered. It has not yet explained how a sign-up flaw gave one outsider write access to so many unrelated customers.

What visitors were exposed to

Every visitor received the same script. Report URI and the independent researcher behind Amirul Cyber, who separately captured CNN, Zoom, the BBC, and Virgin Media O2 pages loading it, describe four parts:

  • Wallet address swapping. Any cryptocurrency address on the page, in a form, or on the clipboard was replaced with the attacker's. Report URI traced about $7,040 to the attacker's wallets by the evening.
  • Card skimming. From 13:43 UTC, card numbers, expiry dates, and security codes typed into a site's own form fields were sent to the attacker. Cards entered in a payment provider's hosted field, such as Stripe or Adyen, were out of its reach.
  • Cookie and screenshot theft. When it swapped an address near wallet or payment wording, it also sent the page address, readable cookies, and a screenshot.
  • iPhone and iPad attacks. Older versions of iOS were sent known exploit kits, code that tries to take over the device itself. Report URI says iOS 18.7.3 and 26.3 or later are patched, which is worth passing on to colleagues.

What this means for a business your size

You probably do not use Optimizely. That is not the point. The affected sites' own code and servers were never touched. They had trusted a supplier, and the supplier's customer accounts turned out to be the weak spot. It is the same pattern as Master of Malt, where the way in was an app plugged into the shop rather than the shop itself.

It happened again within days. Security firm Guardio found a card stealer on the subscription checkouts of about 80 US newspapers, including the Boston Herald and the Denver Post, for about a week from 13 November. None of the newspapers changed their own pages. Someone added one line to the card form that payment processor Payway hosts inside a checkout built on Naviga's subscription software, and every paper using it served the stealer. It sent card numbers, expiry dates, and security codes over WebRTC, the connection browsers use for video calls, which Guardio notes a Content Security Policy does not control. Readers who paid with Apple Pay, Google Pay, or PayPal were not affected.

If code like this runs on your checkout, the problem lands on you. The cards and personal details belong to your customers, you chose to load the script, and under UK GDPR you decide whether the breach must be reported to the Information Commissioner's Office within 72 hours. If you take card payments, the card industry's security standard, PCI DSS, already expects the scripts on your payment pages to be authorised, checked for integrity, and monitored for changes.

What to do

List every third-party script your site loads, and who can change it. For each one, note which supplier serves it and which of your colleagues or agencies have logins that can edit it. Tools that let you paste custom code, such as testing tools and tag managers, deserve the closest look. Delete anything nobody can explain.

Ask each supplier how their customer accounts are protected. By Optimizely's account, the way in was a flaw in how customer accounts are created, not a break-in at any customer. Ask whether every account needs two-step verification (a code from your phone after the password), and how quickly they would tell you if the scripts in your account changed.

Turn on a Content Security Policy, and understand its limits. A Content Security Policy is a list your site sends to browsers naming the places code may load from and data may be sent to. It cannot stop a trusted supplier's own address serving bad code, so allowing Optimizely's domain did nothing here. What it can do is block the next step. Of the affected organisations whose policies Report URI checked, 68 had no policy at all and only 24 blocked the malicious script. Another 17 stopped the stolen data leaving because they limited where pages could send it. Two settings let the attack through: one that trusts anything a trusted script loads, and one Optimizely's own documentation asks customers to allow. Turn on its reporting too, so browsers tell you when a page tries to reach an address you have never seen.

Do not expect subresource integrity to cover this. Subresource integrity pins a script to a fingerprint, so a changed file will not run. Testing tools and tag managers change constantly by design, so they cannot be pinned without breaking them.

Keep card entry off your own pages. Use your payment provider's hosted page or hosted card fields, and keep marketing scripts off checkout and login pages altogether. A hosted form still belongs to your checkout, as the newspapers found, so ask your provider how changes to it are controlled and how quickly it would tell you.

If you use Optimizely, read Optimizely's notice, open every project's custom JavaScript and every experiment's custom code, and look for anything you did not write. Review who and what can edit the account, including API tokens, and rotate credentials. If your own forms take card details, treat cards entered on 16 November as potentially exposed and talk to your payment provider.

How Steelwise can help

Working out which suppliers can change what runs on your website, and setting a Content Security Policy that blocks what it can without breaking your pages, is a short, defined piece of work. Get in touch if you would like a second pair of eyes on yours.

Further reading

← All filings