Some of the world's most visited websites spent Monday serving malware to their visitors after attackers found a way into Optimizely, a platform businesses use to test and customise their web pages.
Security researcher Scott Helme and his team at Report URI identified malicious JavaScript being served by the websites of at least 178 organisations, including the BBC, CNN, Zoom, IKEA, Salesforce, GitLab, HSBC, Equifax, Air France-KLM, Ledger and Peacock. All of them use Optimizely's Web Experimentation software.
The attackers abused a feature that lets Optimizely customers add their own JavaScript to web pages. Because the code was served from Optimizely's own content delivery network with the company's own certificate, the affected sites treated it as trusted.
Of the 1,611 Optimizely scripts examined by Helme and his team, 188 contained malicious code, including the scripts used by Optimizely's own website and login portal. The attack has been dubbed OPTIMJACK.
What the malware did to visitors
The injected code was designed to steal money and data from anyone who visited an affected site. It swapped cryptocurrency wallet addresses in page text, form fields, links and the clipboard, replacing them with addresses belonging to the attackers, so funds sent by victims went to the criminals instead.
It also skimmed payment card details as users entered them, stole cookies and took screenshots of visitors' screens. On iPhones and iPads, it delivered the Coruna and DarkSword exploit kits, designed to plant code on Apple devices.
Helme traced about 7,040 dollars in cryptocurrency to the attackers' wallets within roughly nine hours on Monday, and the funds were swept to exchanges the same day. There is no telling how much more the attackers stand to make from stolen payment card details.
The payload domain used by the attackers was registered early on Monday morning and placed on registry hold early on Tuesday. The first injection was seen at 04:21 UTC on Monday, in the BBC's snippet.
Most sites cleaned up within a day
The malicious code was removed from most affected sites within hours. By 21:52 UTC on Monday, only TalkTalk remained on Report URI's list of organisations whose Optimizely code still contained the malware, and by 23:11 UTC the infected files were clean.
Optimizely confirmed the breach in a notice on its service status page early on Tuesday. "An unauthorized party exploited a vulnerability in Experimentation and used it to add malicious JavaScript to some customer projects," the company said.
The company said it had fixed the vulnerability, removed the injected code from affected projects, taken steps to secure affected user accounts and put additional protections in place. It has not explained how the attacker gained write access to so many unrelated customers' projects, and no CVE has been assigned.
Companies respond, questions remain
Salesforce said it was investigating unauthorised Optimizely script changes and had disabled them as a precaution. Equifax also investigated the issue and ceased using Optimizely, saying it had found no evidence of any compromise to its own systems.
Apple said the underlying vulnerabilities targeted by the hackers were fixed last year, and users running up-to-date software would have been protected from exploitation.
At least 24 organisations blocked the malicious code because their content security policies listed only the hosts they actually needed, a reminder that strict script controls can blunt this kind of attack.
Reuters said it could not immediately ascertain whether the code was successfully used in each case or the extent of any resulting hacks. Report URI estimated the code was served during about 34 million page visits, with a wide range of 6 million to 150 million.