Attackers abused Optimizely’s web experimentation platform on November 16 to serve malicious JavaScript to visitors of 178 organizations, according to security firm Report URI and researcher Scott Helme.
Affected organizations include Zoom, the BBC, CNN, Salesforce, GitLab, IKEA, HSBC, Equifax, Air France-KLM, Ledger and Peacock. Report URI fetched 1,611 distinct Optimizely snippets and found 188 infected, belonging to the 178 organizations. Helme said the true number is likely higher, since researchers could only check the snippets they found in time.
Hacking Scenario
Optimizely customers load a JavaScript snippet from its content delivery network, which is why one compromise can reach every site using it. The snippet includes an optional “Project JavaScript” field for custom code that runs on every page. The attacker wrote malicious code into that field across customer projects and left the rest of each snippet untouched. Because the files still came from Optimizely’s domain with its certificate, affected sites already trusted the source.
Helme said Optimizely’s network served exactly what it received, so this was not cache poisoning. Report URI does not know how the attacker gained write access to so many unrelated projects and left that question to Optimizely. The malicious code also ran on Optimizely’s own sites. Report URI said it contacted Optimizely through several channels and had received no response at publication.
What the malware did
Helme described a multi-purpose kit that swapped cryptocurrency wallet addresses for the attacker’s, skimmed payment cards, stole cookies and screenshots, and delivered the Coruna and DarkSword exploit kits to iPhones and iPads. The attacker rebuilt the payload 26 times during the day, adding features along the way. Cards typed into hosted payment frames from providers such as Stripe and Adyen were out of reach, but cards entered in a site’s own form fields were not.
Timeline (UTC)
- 04:21: First malicious injection seen, when the BBC’s snippet loaded a malicious script
- 13:03: Attacker begins moving funds to exchanges, including a HitBTC deposit address
- 13:43: Card skimmer deployed
- 20:40: Cleanup begins
- 20:56: Code still found in 169 snippets
- 21:52: Code found in just one snippet
The attacker’s wallets had received about $7,040 as of 19:25 UTC, all within roughly nine hours. Report URI cannot see how many cards or cookies reached the attacker’s server.
The CSP gap
Report URI crawled 256 affected organizations’ hosts and tested their Content Security Policies (CSP) against the payload:
- 68had no CSP
- 50had a CSP that allowed both the malicious code and the data theft
- 17blocked the data theft but still let the code run, so address swapping worked
- 24(15 percent) blocked the payload
Allow listing Optimizely’s domain would not have helped, Helme said, because the code came from that trusted host. A restrictive script-src setting listing only the hosts a site needs separated protected sites from the rest. He named two settings that let the code through, ‘strict-dynamic’ and ‘unsafe-eval’, and said Optimizely’s own documentation tells customers to allow them.
“Trusted JavaScript doesn’t always remain trustworthy,” Helme wrote. He said Report URI’s own monitoring tools would have flagged the malicious changes.
Action steps for CISOs
Report URI advises Optimizely customers to:
- Inspect your code: Check every project’s Project JavaScript and each experiment’s custom code for scripts you did not write.
- Tighten access: Review who and what has write access to your Optimizely account, and rotate credentials.
- Assume exposure: Treat cards entered in your own forms on November 16, and secrets in cookies not marked HttpOnly, as potentially exposed.
- Deploy a CSP: Restrict connect-src, avoid unsafe-eval where possible, and turn on reporting.
