Introduction
Modern websites rarely operate using only their own code. They depend on several third-party services for analytics, marketing, website personalisation, A/B testing, payment processing and performance monitoring.
These integrations make development faster and help businesses improve their digital experiences. However, they also introduce a security risk that developers sometimes overlook: what happens when a trusted third-party service becomes compromised?
A recent security incident involving Optimizely demonstrated exactly how this risk can affect websites, even when their own infrastructure has not been directly compromised.
The incident is a reminder that every external script running on a website should be treated as part of its security boundary.
What Is Optimizely?
Optimizely is a digital experience platform that helps businesses experiment with and optimise their websites.
One of its popular capabilities is Web Experimentation, which allows teams to conduct A/B tests, personalise website experiences and measure how visitors interact with different versions of a page.
For example, a business might want to compare two versions of a landing page:
-
Version A uses a blue call-to-action button.
-
Version B uses a green call-to-action button.
Optimizely can distribute these variations among visitors and help the business determine which version performs better.
To enable these features, websites typically integrate a JavaScript snippet provided by Optimizely. This script runs in visitors' browsers and delivers the configured experiments.
That integration became the entry point for a security incident in November 2026.
What Happened in the Optimizely Security Incident?
On November 16, 2026, an unauthorised attacker exploited a vulnerability in Optimizely Web Experimentation's account signup flow.
According to Optimizely's incident report, the vulnerability allowed the attacker to impersonate users and modify the custom JavaScript associated with certain customer projects.
The attacker inserted malicious JavaScript into those projects.
As a result, visitors accessing affected websites could receive malicious code through scripts they already trusted.
Independent security researchers reported identifying 188 infected JavaScript snippets associated with 178 organisations.
Some of the publicly identified organisations included BBC, CNN, Zoom, Salesforce and GitLab.
The important distinction is that this was not simply a case of individual websites having vulnerable application code. The malicious code was delivered through a trusted third-party integration.
How Did the Attack Work?
To understand the incident, consider how third-party JavaScript normally works.
A website includes an external script using a reference similar to:
<script src="https://cdn.optimizely.com/js/example.js"></script>
When a visitor opens the website, the browser requests the JavaScript file from Optimizely's infrastructure and executes it.
During the incident, attackers modified JavaScript associated with affected customer projects.
The browser continued loading the script through the expected Optimizely integration, but the script contained additional malicious functionality.
This created a serious problem: the website was trusting a source that it had previously considered legitimate.
What Was the Malicious JavaScript Designed to Do?
Security researchers identified several malicious capabilities.
1. Payment Card Data Collection
The malicious code attempted to capture payment card information entered into forms directly on affected webpages.
This created a risk for visitors entering payment details on pages where the compromised script was running.
2. Cryptocurrency Address Replacement
The script included functionality to replace copied cryptocurrency wallet addresses with addresses controlled by the attackers.
A visitor could believe they were sending cryptocurrency to the intended recipient while unknowingly sending it elsewhere.
3. Browser Information Collection
Researchers also identified functionality involving the collection of certain browser information, including readable cookies and screenshots in specific circumstances.
4. Targeting Mobile Devices
The malicious JavaScript attempted to deliver additional exploit code targeting certain iPhone and iPad software versions.
These capabilities demonstrate how a single compromised JavaScript integration can create multiple types of security risks.
Why Is This Called a Supply Chain Attack?
A supply chain attack occurs when attackers compromise a trusted third-party component, service or dependency to indirectly affect its customers.
Consider a typical website architecture:
-
A company develops and secures its website.
-
The website integrates an external analytics or experimentation service.
-
Visitors' browsers load JavaScript from that service.
-
If the external service is compromised, malicious code may reach those visitors through the existing integration.
The attacker does not necessarily need direct access to the website's source code, database or hosting server.
Instead, the attacker abuses the trust relationship between the website and its third-party provider.
This is what makes supply chain attacks particularly challenging.
What Can Developers Learn From This Incident?
The Optimizely incident highlights several security practices that deserve more attention.
1. Audit Third-Party JavaScript
Review all external scripts integrated into your website.
Understand why each script is required, what permissions it has and whether it is still actively needed.
Remove unused or unnecessary integrations.
2. Implement Content Security Policy (CSP)
Content Security Policy is a browser security mechanism that helps control which sources are allowed to load scripts and other resources.
A properly designed CSP can restrict unauthorised script execution and limit communication with unknown external domains.
However, CSP must be configured carefully. Simply allowing a trusted vendor's domain does not guarantee that every script served by that domain is safe.
3. Use Subresource Integrity Where Appropriate
Subresource Integrity (SRI) allows browsers to verify externally loaded static resources against a known cryptographic hash.
If the resource changes unexpectedly, the browser can refuse to execute it.
SRI is useful for versioned, static scripts. It is not always practical for dynamic experimentation scripts that change frequently.
4. Isolate Sensitive Operations
Avoid loading unnecessary marketing, analytics and experimentation scripts on sensitive pages such as payment and authentication screens.
Where possible, use hosted payment fields or cross-origin payment iframes to isolate payment information from the main webpage.
5. Monitor Third-Party Script Changes
Do not assume that an external JavaScript file will remain unchanged forever.
Monitor script changes, investigate unexpected network requests and maintain logs that can help identify suspicious activity.
6. Review Vendor Security Practices
Before integrating a third-party service, understand its security controls, access management, incident response process and vulnerability disclosure practices.
Third-party integrations should be included in regular security assessments.
What Was Optimizely's Response?
According to Optimizely's official security incident report, the company took the following actions:
-
Fixed the vulnerability: The security flaw in the account signup flow was addressed.
-
Terminated affected sessions: Active sessions associated with unauthorised activity were terminated.
-
Revoked relevant tokens: Relevant tokens were revoked as part of the security response.
-
Removed malicious code: Injected JavaScript was removed from identified affected projects.
-
Introduced additional safeguards: Further protections were implemented to prevent unauthorised code delivery.
Optimizely also clarified that the incident was limited to Web Experimentation. Its Feature Experimentation, SDKs and legacy Full Stack products were not affected.
The company engaged Mandiant to assist with the forensic investigation.
For ongoing updates, readers can also refer to Optimizely's official security incident status page.
Final Thoughts
The Optimizely incident demonstrates an important principle of modern web development:
A website is only as secure as the code and services it trusts.
Developers often spend considerable time securing their backend APIs, databases, authentication systems and frontend applications. However, third-party JavaScript integrations can introduce risks that are outside the direct control of the development team.
Security should therefore extend beyond the code we write ourselves.
Every external dependency, script and integration should be evaluated, monitored and reviewed as part of the overall application security strategy.
The goal is not to avoid third-party tools. These tools provide significant business value. The goal is to integrate them responsibly, limit their access to sensitive functionality and prepare for situations where a trusted dependency may no longer be trustworthy.
In modern web development, convenience should never come at the cost of security.
