Skip to content

[ Anolilab — Article / Security ]

What the Optimizely hack means for your third-party scripts

On 16 November 2026 Optimizely served malicious code for 178 organisations. Why CSP allowlists did not help, and how to secure the scripts on your own site.

Article by
Daniel Bannert · Founder · Anolilab

In short

This can happen on any website that loads someone else's JavaScript: A/B testing, analytics, chat widgets, tag managers. On 16 November 2026 Optimizely served malicious code through its own CDN to the visitors of 178 organisations. A CSP that only allowed the vendor's domain did not help. A strict script-src rule did. What you can do now: list every script and who can edit it, secure your vendor accounts, keep payment and login pages free of third-party scripts, roll out a strict CSP with reporting, and monitor your scripts for changes.

This article is for founders and for people in marketing and product who run third-party scripts on their website. The topic concerns you even if you do not use Optimizely: the same attacker had already used other vendors' scripts in the days before.

What happened on 16 November 2026

Optimizely Web Experimentation is an A/B testing tool. The website embeds a snippet, a small JavaScript file from cdn.optimizely.com, and the marketing team changes tests in a dashboard without touching the site's code. The snippet also contains a field called "Project JavaScript": custom code the customer writes in the dashboard, which runs on every page.

That field is what an attacker overwrote for many customers. According to Optimizely's initial report (17 November 2026, corrected on 18 November), they used a flaw in the account signup flow. It let them act as existing admin users in customer accounts without knowing their passwords. The account and project IDs they needed are in the public snippet, and they guessed employees' email addresses by trying variations of names. Optimizely gives the exposure window as 07:51 to 22:24 UTC on 16 November. The flaw was closed at 16:10 UTC, and at 16:53 UTC the impersonated accounts' sessions were ended and their tokens revoked.

Security researcher Scott Helme analysed the incident at Report URI (November 2026). Of 1,611 Optimizely snippets checked, 188 contained the malicious code. They belonged to 178 organisations, including the BBC, CNN, Zoom, IKEA and HSBC. Helme expects the real number to be higher. By his observation, all affected files had been clean since 23:11 UTC on 16 November.

According to Report URI, the payload was rebuilt 26 times during the day. It swapped cryptocurrency addresses on the page for the attacker's, read card numbers from forms, sent readable cookies and screenshots to an outside server, and tried to load exploits on iPhones and iPads running older iOS versions. Card fields inside embedded payment iframes, for example from Stripe or Adyen, were out of its reach, according to Optimizely.

Optimizely was not the attacker's only route. Report URI describes an earlier wave from 13 to 16 November, in which the same loader reached other websites through scripts from Kissmetrics, StorifyMe and Minute Media. The analysis by Safeguard (November 2026) reaches the same conclusion: one attacker working through several third-party script vendors.

Why a CSP that allows the vendor's domain did not help

A Content Security Policy (CSP) is an HTTP header your website uses to tell the browser which scripts it may run. The simplest form is a list of allowed domains, such as "scripts from my own domain and from cdn.optimizely.com".

That list only checks where a file comes from, not what it contains. The malicious code came from the real file on the real server, with Optimizely's real certificate. Helme puts it this way: the CDN served exactly what it was given, so allowing cdn.optimizely.com was never going to help. Customers who served the snippet from their own domain were affected too, because the content came from the same project in the dashboard.

A CSP could only catch the next step: the snippet loaded the actual payload from an outside domain. Report URI checked the CSP of 256 hosts belonging to the affected organisations:

ResultHosts
No CSP68
CSP allowed the payload and the data theft50
CSP blocked the data theft, not the code17
CSP blocked the payload24

Source: Report URI, November 2026. The four groups add up to 159 of the 256 hosts.

The 24 protected sites had a strict script-src rule. Two settings undermined the protection elsewhere. 'strict-dynamic' allows any script that an already allowed script loads, including the payload the snippet loaded. Optimizely recommends 'strict-dynamic' in its CSP guide (as of November 2026). And 'unsafe-eval' allows text to be run as code. For that case the attacker had put a copy of the payload straight into the snippet: at HSBC the CSP blocked the outside file, but the embedded copy still ran.

The 17 sites in the third row had restricted connect-src, the destinations the page may send data to. Cards, cookies and screenshots did not get out. That did not stop the crypto address swap, because it happens inside the page.

Why Subresource Integrity does not fit snippets like this

Subresource Integrity (SRI) is the second technique people often mention. You put a hash of the expected file into the <script> tag, and the browser only loads the file if its contents match exactly (MDN). Any change to the file, wanted or not, breaks the hash.

For a fixed version of a library, that is exactly right. An A/B testing snippet, however, changes every time your team starts or edits a test. That is why Safeguard writes that SRI does not suit dynamic snippets, because the file is meant to change. With SRI, the browser would block the snippet after the next change in the dashboard, whether your team or an attacker made it. The same goes for tag managers and many chat widgets.

What actually helps

No single measure would have prevented everything. Together, they limit what an attacker can do on your site.

Know what runs on your site and who can change it

Keeping track is harder than it sounds: a tag manager loads more scripts, and each of those can load others. For every script, write down who added it, which pages it runs on, and who can change code in the vendor account.

Secure your vendor accounts

Your Optimizely account is write access to your website. Treat it that way. Turn on two-factor login or single sign-on through your own identity provider, give admin rights only to the people who really need to change code, and remove former employees and agencies. Safeguard also recommends allowing code changes only after approval by a second person, where the vendor supports it.

For context: your own 2FA would not have helped against this attack, because the flaw was in Optimizely's signup flow. It does protect against the obvious way into an account, a stolen or guessed password. And fewer admin accounts mean fewer targets.

Keep payment and login pages free of third-party scripts

This is the most effective measure, and it costs little. In its report, Optimizely itself recommends removing the snippet from pages with payment or crypto input that are not running a test. On checkout, login and account pages you usually need no A/B test, no chat and no tag manager. Also have card details entered in your payment provider's iframe fields rather than in your own form: according to Optimizely, the payload could not reach those fields.

Set a strict CSP with nonces or hashes

A strict CSP does not allow scripts by domain, only with a nonce (a random value your server generates for every response and writes into each of your own <script> tags) or with the hash of a known script. That is how Google describes it in its guide to strict CSP. The guide also recommends 'strict-dynamic', because it is what makes third-party scripts workable in the first place. The Optimizely case shows the price: whatever an allowed script loads is allowed as well.

My suggestion: on pages with marketing scripts, use the CSP those scripts can live with, but at least restrict connect-src and leave out 'unsafe-eval'. On payment and login pages, set a strict CSP without 'strict-dynamic' and without third-party scripts. An example for a checkout page:

CSP for a checkout page (example)
Content-Security-Policy-Report-Only:
  script-src 'nonce-RANDOM_VALUE_PER_RESPONSE' https://js.stripe.com;
  frame-src https://js.stripe.com;
  connect-src 'self' https://api.stripe.com;
  form-action 'self';
  object-src 'none';
  base-uri 'none';
  report-to csp
Reporting-Endpoints: csp="https://your-company.com/csp-reports"

In the real header the directives sit on a single line; they are wrapped here for readability. Your payment provider's documentation lists the exact Stripe domains you need. Start with Content-Security-Policy-Report-Only: the browser blocks nothing yet but reports every violation. Only when the reports show nothing but expected entries do you switch to Content-Security-Policy.

Read your CSP reports

With report-to, the browser sends every violation to an address you choose (MDN, as of November 2026). On 16 November, a report about a blocked script from an unknown domain could have been the first warning. In its report, Optimizely advises affected customers to review exactly these reports for the exposure window. That only works if they were being collected beforehand.

Load fewer scripts

Every script you remove is one vendor fewer whose accounts, staff and mistakes you have to carry. Once a quarter, check which tests are still running, which analytics tool anyone actually reads, and whether the chat is still used. Third-party scripts also cost loading time; more on that in the article on Core Web Vitals.

Self-host where the content is fixed

A library in a fixed version can be served from your own server and secured with SRI. Then the code only changes when you update it. With Optimizely, self-hosting did not help, because the snippet is generated from the project in the dashboard. Self-hosting only helps when you control the content yourself.

Monitor your scripts for changes

Fetch the third-party scripts on your most important pages regularly and compare the content with the last version. New domains, or eval or atob in a snippet your team did not change, are a warning sign. There are ready-made services for this. A simple script that downloads the files every hour and compares a hash is enough to start with. Also check the change history in the vendor's dashboard, if it has one.

Checklist for your website

  1. List every third-party script

    Open your most important pages with the developer tools, "Network" tab, "JS" filter. Note every outside domain, including the ones the tag manager loads.

  2. Find out who can edit each script

    Who has an account with the vendor, and who can change code there? Remove former employees and agencies.

  3. Turn on 2FA or SSO with every vendor

    For all accounts with write access. Where a second-person approval exists, use it for code changes.

  4. Check payment, login and account pages

    Remove every script there that the page does not need to work. Card details only in the payment provider's iframe fields.

  5. Roll out a CSP in report-only mode

    Start with the sensitive pages. No 'unsafe-eval', keep connect-src and form-action narrow, collect reports with report-to.

  6. Enforce the CSP

    When the reports show only expected entries, switch to Content-Security-Policy and keep reading the reports.
  7. Monitor script contents

    Compare a hash or diff of the third-party scripts regularly, and check the vendor's change history.
  8. Clean up once a quarter

    Every script without a current use goes.

If you use Optimizely Web Experimentation, also check the "Project JavaScript" field and the code of every experiment for 1688360.cc, atob( and anything nobody on your team wrote. That is Report URI's recommendation. RH-ISAC (November 2026) has compiled further indicators.

What about data protection?

If a third-party script on your site grabs your customers' card details or cookies, that can be a personal data breach. Under Art. 33 GDPR you must report such a breach to the supervisory authority without undue delay and, where feasible, within 72 hours, unless it is unlikely to result in a risk to the people affected. In its report, Optimizely also advises customers to check with their own legal advisers whether notification duties apply. Check with your data protection officer whether that is the case for you. Not legal advice.

If you would rather not check this yourself

You can work through the checklist above yourself with some time. It gets harder when nobody on the team knows exactly what the tag manager loads, or when the CSP depends on a framework that does not easily support nonces.

In a technical audit, one of the things I check is your website's third-party scripts: which ones load, what they load in turn, who can change them, and which CSP fits your site. For code written by AI, it is also worth looking at the typical gaps in AI-generated code.

[ Anolilab — Blog ]

More hands-on writing on AI, web development and infrastructure.

Related articles.

[ Anolilab — Contact ]

Tell me what you're building. I'll tell you how I can help.

Let's talk.

Quick response.
If you're ready to create and collaborate, I'd love to hear from you.
Clear next steps.
After the consultation, I'll give you a detailed plan.
Alternatively, you can email me directly at hello@anolilab.com