Skip to Content (Press Enter)
Is your Statamic site hiding the pain like Harold? Find out

What the Optimizely attack means for third-party scripts on your website

A testing tool added for marketing runs with the same access as your own code. Here's how to keep that list short and controlled.

Posted by Stephen Meehan in Web Development, News.

High-angle monochrome photo of a hand holding a smartphone displaying a glowing blue skull and crossbones icon.

Third-party scripts are the code a website loads from another company's server, and on 16 November 2026 one of them served malware to visitors of 178 organisations. The BBC, Zoom, CNN, HSBC, Salesforce and GitLab were on the list. So were UK names such as Virgin Media, O2, ASOS, Admiral and Betfred.

None of those websites were hacked. Each had added the same A/B testing tool, Optimizely, which shows visitors different versions of a page to see which performs better. An attacker found a way to change what that tool sent to their visitors.

Harold's smile is hiding a lot. What's your Statamic site hiding? Missed updates and known vulnerabilities don't show on the page. My free Statamic health check finds them from your website's address, and regular Statamic maintenance stops them building up.

What happened in the Optimizely attack?

The Optimizely attack worked through the snippet each customer adds to their pages. The snippet loads from Optimizely's content delivery network (CDN) and includes an optional field called Project JavaScript, custom code that runs on every page.

An attacker added their own code to that field in customer projects. Optimizely's status page says they used a vulnerability in its account signup flow to impersonate users on customer accounts. The snippets still came from Optimizely's own servers.

Scott Helme of the security company Report URI checked 1,611 Optimizely snippets and found the code in 188, belonging to 178 organisations. He expects the real number is higher. Every infected file was clean again by the end of the day.

The code swapped cryptocurrency wallet addresses for the attacker's, copied card details typed into a site's own payment forms, and sent cookies and screenshots back to the attacker. Brian Krebs reported that the attacker rebuilt it 26 times during the day, adding features as they went.

On older iPhones and iPads the code also loaded exploit kits, which attack known vulnerabilities in out-of-date versions of iOS. SecurityWeek reported that no one had shown a device was compromised. By Report URI's figures, about $7,000 in cryptocurrency reached the attacker's wallets.

Why third-party scripts get the same access as your own code

Third-party scripts run with the same access as the code your developer wrote. Once a page loads one, the browser can't tell them apart. The script can read what visitors type into forms, change links and text on the page, and send data to any server the site doesn't block.

Analytics, tag managers, chat widgets, heatmaps, cookie banners, advertising pixels and testing tools all work this way. Each one adds a company whose security is now part of yours. When a script changes on the vendor's server, it never passes through your code review, your updates or your hosting.

Every script you load from another company runs with the same access as your own code, and it can change without you knowing.

Would a Content Security Policy have stopped the Optimizely attack?

A Content Security Policy (CSP) stopped most of the Optimizely attack on the sites that had a strict one. A CSP is a header your site sends that tells the browser which servers scripts may load from, and where the page may send data.

Report URI checked the policies of the affected organisations. 68 had no CSP at all, and 50 had one that let the attack run. Another 17 stopped the stolen data leaving but not the address swapping. Only 24, about 15%, blocked the malicious code.

Allowing Optimizely's domain made no difference, because the code came from there. What protected those 24 sites was a short list of allowed servers that didn't include the attacker's. Two common settings undid that. 'strict-dynamic' trusts any script that a trusted script adds.

'unsafe-eval' let a backup copy of the code run on HSBC's site, even though its policy blocked the main file. Report URI notes that Optimizely's own documentation tells customers to allow it.

This is a cut-down version of the policy on my Statamic health check. Scripts load only from this site and Plausible, my analytics, and the page can only send data to the same places.

Content-Security-Policy: default-src 'self'; script-src 'self' https://plausible.io; connect-src 'self' https://plausible.io; object-src 'none'; base-uri 'self'; form-action 'self'

Google Tag Manager and the cookie banner aren't on that page, which is what makes a policy this strict possible. With a tag manager, every new tool has to be added to the policy before it works, so many sites leave theirs loose or skip it.

Start with the Content-Security-Policy-Report-Only header instead. It reports what would have been blocked without blocking anything, so you can see everything your pages load before you enforce it. MDN's CSP guide covers every setting.

How to reduce the risk from third-party scripts

  1. List every script your pages load, and who added it. Check your tag manager too, because scripts can go in there without a developer.

  2. Remove the ones you no longer use. A testing tool from a campaign that ended two years ago still runs on every page.

  3. Keep scripts off the pages that matter most. Checkout, login and contact forms rarely need a heatmap or a testing tool.

  4. Let your payment provider host the card fields. Card details typed into fields hosted by Stripe, Adyen and similar providers were out of the Optimizely code's reach. Card details typed into a site's own forms weren't.

  5. Limit who can change each tool. Turn on two-factor sign-in and remove old users and access tokens. That wouldn't have stopped this attack, but a stolen password is an easier way in.

What does the Optimizely attack mean for a Statamic site?

Statamic doesn't add third-party scripts to your pages itself. Every one on your site was put there by someone, in a template or through a tag manager, so the list is easy to find.

Updates don't cover those scripts. Website maintenance keeps Statamic, its add-ons and the server patched, but a script from another company's server changes on their schedule. Reviewing that list usually sits with whoever runs your tag manager.

If you're planning a new Statamic website, that's the easiest point to decide which scripts each page needs. Starting with a strict policy is easier than adding one to a finished site full of tags.

Treat every script you add as a company you're trusting with your visitors. Keep the list short, keep scripts away from your forms and checkout, and know who can change them.

Posted by Stephen Meehan in Web Development, News. Published . Updated .