The Optimizely attack and the risk of trusted website scripts

A website can change what visitors see and do even when your team has not deployed a new release. Experimentation tools, analytics tags and other external scripts create another route for code to reach the browser. Website security needs to account for who can change that code and how you would detect an unexpected change.

The recent Optimizely incident gives IT and website teams a concrete reason to review that boundary. Start with the scripts on your important pages, their owners and the evidence you could use to investigate a change.

What has been reported

On 16 November, Report URI reported malicious JavaScript in 188 Optimizely snippets associated with 178 organisations. Its analysis described changes to Project JavaScript and capabilities including payment-data theft, cryptocurrency-address substitution and iOS exploit delivery. Those findings do not establish that every visitor was compromised. Read Scott Helme’s investigation.

Optimizely’s statement, posted at 01:02 UTC on 17 November, says an unauthorised party exploited an Experimentation vulnerability. The vendor says it fixed the vulnerability, removed the injected code and took protective action on affected accounts. The incident was in Monitoring when checked. The statement does not disclose the detailed vulnerability or establish the full impact on visitors. Optimizely status.

Where the trust boundary sits

External JavaScript included in a page can act within that page’s browser context. It is not isolated simply because a different company hosts it. OWASP identifies third-party code changes and sensitive-data disclosure as central risks of these integrations. OWASP guidance.

Simplified attack path Original Router ID explanatory diagram, not captured traffic. Optimizely platform Visitor Unauthorised actor Unauthorised actor Optimizely project / Project JavaScript Optimizely project Project JavaScript Snippet / delivery Snippet delivery Visitor / browser Visitor browser External / server External server Code change Code JavaScript Requests Explanatory diagram • Detailed initial access remains undisclosed. Dashed arrow: modification. Solid arrow: code or request.
Figure 1. Simplified attack path based on the vendor statement and reported mechanism. Arrows show code delivery or requests, not proof of compromise for an individual visitor. Original Router ID diagram.

Optimizely’s documentation places Project JavaScript at the beginning of snippet execution. Its scope can extend across experiments, while shared code belongs to an experiment and variation code belongs to a variation. These are separate places to inspect. Optimizely code scopes.

For your team, the operational question is straightforward: does a change in a marketing platform receive the same ownership and review as a change deployed by developers? Record who approves it, who can publish it and who receives an alert when the delivered script changes.

Start with evidence from your own site

This is a documentation-based review plan. Use authorised access for inspection and a staging environment for configuration tests. Involve the person responsible for website releases and the incident-response owner if you find unexplained code.

  1. Map the dependency. Record each important page, its script URLs, the associated project and the business owner. Include login, account and payment journeys. If a script has no obvious owner, trace its inclusion through the page template or tag manager. The useful result is an inventory someone can act on.
  2. Inspect project code. In Optimizely, open Settings > JavaScript. Preserve the current content, available history and timestamps, then compare them with an approved version. An unexplained loader or destination needs investigation; ordinary JavaScript syntax alone is not proof of malware. Project settings.
  3. Inspect the other scopes. Open the experiment’s Design > Shared Code > JavaScript, then the variation’s Variation Code Editor > JavaScript. Account for each change. If no trustworthy baseline exists, record that gap instead of declaring the project clean. The paths above follow the current vendor documentation; permissions and interface versions can differ.
  4. Preserve evidence before containment. If a change is suspicious, have the authorised response team retain the relevant code and logs, decide how to suspend delivery, and review access to the project. Record the time and repeat the checks after remediation. A clean response today does not establish what visitors received yesterday.

Do not test by opening suspected attacker URLs. Work from retained evidence and the indicators published by the investigator, within your response process.

What browser controls can and cannot do

Content Security Policy, or CSP, lets a site tell browsers which resources and connections are permitted. Its effectiveness depends on the actual policy and how scripts receive trust.

Control Useful purpose Important limit
script-src Constrain script execution and loading Code already trusted by the policy can still behave maliciously
connect-src Restrict destinations for fetch, XHR and beacons Does not stop local page changes or cover every outbound mechanism
Report-Only Observe policy conflicts before enforcement Does not block the attempted action
Subresource Integrity Reject a file whose bytes do not match its expected hash Requires controlled updates and suitable cross-origin configuration

'strict-dynamic' extends nonce- or hash-based trust to scripts loaded by the trusted script. That can support a strong CSP, but it also matters when the trusted loader is compromised. 'unsafe-eval' permits code evaluation from strings. Review those choices against the integration’s needs and test changes before rollout. MDN on script policy.

Browser policy checks Separate CSP checks for loading scripts and selected connections. Browser • Enforced CSP Allowed code / in the page Allowed code in the page script-src script-src connect-src connect-src Additional / script Additional script Network / destination Network destination Load If allowed fetch / XHR If allowed Allowed code can still change the page. Report-Only reports violations without blocking.
Figure 2. CSP applies different checks to script loading and selected network requests. The policy does not inspect business intent. Original Router ID diagram.

A restrictive connect-src can block covered requests to an unapproved collector, but it cannot undo a change already made to the page. Review other relevant directives as well. MDN on connection policy.

Subresource Integrity is useful when you can approve and pin a specific script version. A frequently changing experimentation snippet needs an integrity-update process; pinning an old hash can also block a legitimate update. Confirm cross-origin support before adopting it. MDN on integrity.

Verify a small staging change

Choose one representative staging page and save its current response headers. Your developer needs control of HTTP response headers and a working reporting collector. Build the candidate policy from the page’s actual dependencies; a generic policy copied into production can break legitimate functions.

First deliver it through Content-Security-Policy-Report-Only. Define the collector with Reporting-Endpoints and select it with report-to. Confirm the document response in the browser’s Network panel and check report arrival. Report delivery and browser support must be tested; an empty dashboard alone proves little. MDN on Report-Only.

Use a harmless script on a second test origin that you control and deliberately exclude from the policy. The expected progression is:

Test Expected evidence
Excluded test script under Report-Only Violation recorded; script can still run
Same test under enforced CSP Browser blocks the script; violation visible
Approved page journeys under enforcement Intended functions continue to work

If the first check produces no evidence, confirm the delivered header and collector before proceeding. If enforcement breaks an approved journey, restore the previous staging header, identify the exact dependency and retest. Do not solve the problem by broadly allowing every origin. These are expected results, not results from a Router ID lab test. MDN CSP deployment guide.

Make ownership part of the fix

Assign an owner to every script that reaches a sensitive page. Keep an approved baseline and a way to investigate changes. Agree on who can suspend an integration and how the team will verify recovery.

If those responsibilities are spread across your website provider, marketing team and IT team, start by bringing them together around one page and one inventory. Contact Router ID to discuss your website security priorities and the next review that fits your environment.

Discuss my website security

Next
Next

Why Palo Alto Segmentation Projects Stall—and How to Move Forward