Start with a Teardown Book a 20-min fit call
Vendors

A trusted script on your site served malware. Check yours

If your website loads JavaScript from an analytics, testing, chat or marketing vendor, that vendor's security is now part of yours. In mid-November 2026 an attacker got into Optimizely's web experimentation product and planted malicious code in customer projects, which then ran on those customers' own sites. Most startups cannot prevent a vendor breach, but you can limit what a hijacked script can reach: keep third-party scripts off login and payment pages, list every script you load, and lock down who can edit them.

The incident is a clean example of a risk I find in almost every teardown, so it is worth walking through what happened and what a small team should actually do this week.

What happened, briefly

Optimizely disclosed on 16 November 2026 that an attacker had abused a flaw in its account signup flow to impersonate users on targeted customer accounts and insert JavaScript into those customers' web experimentation projects. Because customers' pages load that project code from Optimizely's servers, the injected code ran on the customers' sites with no change on their side. Security researcher Scott Helme of Report URI reported finding malicious code in 188 of the snippets he checked, across 178 organizations, including some very large brands (Help Net Security, Krebs on Security). Reported payloads included a card skimmer and a crypto wallet address swapper.

Optimizely says it fixed the flaw, removed the injected code and notified affected customers. The details are still being reported, so treat the specifics above as what was public at the time of writing.

The lesson is not about one vendor. It is that a script tag pointing at a vendor is a standing permission for that vendor, and anyone who compromises it, to run code on your pages.

Why this matters more for a startup than you think

A large company has a security team that, in theory, reviews every tag. At a startup, scripts arrive one at a time:

  • Marketing adds a testing tool and an ad pixel through a tag manager.
  • Sales adds a chat widget and a visitor-identification script.
  • Product adds session recording and analytics.
  • An agency built the marketing site and added three more nobody remembers.

Each was a reasonable decision. Together they mean a dozen companies can run code on your site, and nobody owns the list. When I do a technical teardown, the count of third-party scripts on a startup's main site is often in double digits, and usually more than the founders guessed.

What a hijacked script can do

Code running on your page can read what the user types and sees on that page, including form fields, and can change what the page shows. On a blog page that is mostly a reputation problem. On a login page it can capture passwords. On a checkout page it can capture card details. On your logged-in app it can read customer data on screen and act as the user.

So the question is not "do we trust this vendor". It is "which of our pages does this vendor's code run on".

The five things to do this week

None of these needs a security hire. Most are a few hours of an engineer's time.

1. Make the list

Open your main site, your app and your checkout in a browser with developer tools open and record every script loaded from a domain you do not own. Do the same through your tag manager, because tags can load more scripts. For each, write down the vendor, who asked for it, which pages it runs on and whether anyone still uses it. Remove the ones nobody can justify. In my experience a first pass usually removes a few.

2. Keep vendor scripts off sensitive pages

This is the change with the biggest payoff. Your login, signup, password reset, payment and account-settings pages should load as few third-party scripts as possible, ideally none beyond what the page needs to work. If marketing wants conversion tracking, fire it on the page after the sensitive step, not on the form itself.

For payments, use your payment provider's hosted checkout or its embedded fields, which run card inputs in a frame served by the provider, so code on your page cannot read the card number. If your checkout collects card details in your own form, fix that first.

This is also one reason I recommend keeping the marketing site separate from the product: marketing tools can live on the marketing domain without being loaded inside the logged-in app.

3. Lock down who can change the scripts

In the Optimizely case the attacker changed code inside the vendor's dashboard. Your exposure includes every account that can edit what a vendor serves on your site: the testing tool, the tag manager, the chat widget's custom code field. For each:

  • Turn on single sign-on or at least enforced two-factor authentication.
  • Remove former employees, agencies and freelancers. This is the same problem as shared admin logins, just in marketing tools.
  • Turn on change notifications or audit logs where the vendor offers them, and send them somewhere a person reads.

4. Add a Content Security Policy, starting in report-only mode

A Content Security Policy is a header that tells browsers which domains your pages may load scripts from and send data to (MDN: Content Security Policy). It would not have stopped code served from an allowed vendor domain, but it limits where stolen data can be sent and blocks scripts from domains you never approved. Start in report-only mode so nothing breaks, collect reports for two weeks, then enforce on the sensitive pages first.

You will read advice to use Subresource Integrity, which pins a script to an exact hash (MDN: Subresource Integrity). It is excellent for static libraries you load from a CDN. It does not work for vendor snippets whose content changes by design, like testing tools, so do not let it give you false comfort there.

5. Decide who gets told, and how fast

If a vendor tells you their script was compromised, someone needs to know within hours, remove the tag, check which pages it ran on and for how long, and decide whether customers must be told. Write down that owner now. If you have no incident plan at all, this is a good first scenario to write one around.

What to ask the vendor

You will not audit your vendors, but you can ask three questions before adding a script, and again after an incident like this:

  1. Who can change the code your service serves on our site, and how is that access protected?
  2. Will you notify us of a security incident affecting our account, and within what time frame?
  3. Can we restrict your script to specific pages or turn off custom code features we do not use?

Vague answers are an answer. The same discipline applies to any vendor that touches customer data, which I cover in vetting vendors that see customer data.

The compliance angle, if you take cards

If you handle card payments, PCI DSS version 4 already asks merchants to keep an inventory of scripts on payment pages, justify each one, and detect unauthorized changes to those pages. Using a hosted payment page or provider-served fields is usually the simplest way to keep that scope small. Check the requirements with your payment provider or assessor; this is not compliance advice.

FAQ

Were we affected by the Optimizely incident?

If you do not use Optimizely Web Experimentation, not directly. If you do, check Optimizely's own notices and your account's project code and change history, and ask them directly whether your projects were among those affected. Either way, use it as a prompt to review every third-party script you load.

Should we stop using A/B testing and analytics tools?

No. They are useful. The fix is scope and control: run them on pages where a compromise would be embarrassing rather than damaging, keep them off login and payment pages, and lock down who can edit them.

Is a tag manager safer or riskier?

It is convenient, and it means one more dashboard that can put code on your site. Treat access to it like access to production: single sign-on, few editors, and a log someone reads.

How long does this review take?

For a typical early-stage site, making the list and moving scripts off sensitive pages is a day or two of one engineer's time. A Content Security Policy takes longer to tune, mostly waiting for reports. These are estimates from projects I have reviewed, not benchmarks.

If you want a second pair of eyes on what runs on your site and app, a technical teardown is a good place to start, and our pricing page shows how engagements are scoped. If you are unsure where to start after this incident, a short call is enough to set the order.

F
The founder of Fraction
Built engineering teams from 2 to 30. Killed more bad rebuilds than I've greenlit. More about me →

Not sure the call you're about to make is the right one?

That's exactly what a 20-minute fit call is for — or a two-week Teardown if you'd rather start with a written verdict.