ForgeNEX

Optimizely suffers a massive attack: the risk of third-party JavaScript

An attacker injected malicious code into Optimizely's scripts and stole data from at least 178 websites. The lesson for SMEs: external dependencies can also be compromised.

4 min read

In this article

An attack that doesn't come from your code, but from your provider's

When we talk about web security, we usually look inward: our server, our CMS, our passwords. The incident that Optimizely has confirmed forces us to look outward, specifically at the third-party JavaScript that we load on every page. According to reports, attackers exploited a vulnerability in Optimizely Experimentation's account registration process to impersonate a user and add malicious code to client projects. The result: at least 178 websites compromised, including properties of companies such as Zoom, GitLab, Starbucks, IKEA, American Eagle, Air France, Heineken, Costco, and HSBC. Salesforce has also confirmed that it is investigating unauthorized modifications to Optimizely scripts and that it has disabled those scripts in its test and production environments.

The finding was made public by Scott Helme, founder of Report URI, who explained that all affected sites had the same infection. The described methodology is especially uncomfortable: the attackers did not touch the victims' own code, but rather the Project JavaScript field that Optimizely serves from its own CDN. In other words, the file was still coming from a trusted domain, with the provider's certificate, and the visitor's browser had no way of distinguishing that an intruder had slipped inside.

Illustrative detail: Optimizely confirms a massive cyberattack against client websites

What exactly the malware did

According to Helme's report, the injected code was a fairly complete kit. It monitored form submissions and fetch or XHR POST requests for card numbers, expiration dates, and CVV. When it gathered all three data points, it sent them to an external domain. It also replaced cryptocurrency wallet addresses with the attacker's, copied cookies and screenshots, and on iPhone and iPad installed iOS exploit kits. An important detail: cards entered in third-party hosted payment iframes, such as Stripe or Adyen, were out of the attacker's reach; those entered in the site's own forms were not.

The provider's response and reasonable doubts

Optimizely has assured its clients that it has blocked access to the vulnerable route, terminated active sessions, revoked tokens, restored access for affected accounts, and removed the injected code from compromised projects. It also claims that the platform is "fully protected" and that it is no longer possible to modify the JavaScript. However, analyst Frank Dickson has expressed skepticism: he points to a temporal discrepancy between the provider's timeline and that of the external researcher, and warns that absolute certainties in an early phase of a forensic investigation do not help clients assess their real exposure. Helme, for his part, points to a small group of thieves, probably of Chinese origin, although he acknowledges that "either they are Chinese or they really want us to think they are."

What this means for an SME

The first reaction might be: "we don't use Optimizely." And that is probably true. But the attack pattern is perfectly transferable to any business that has a website with third-party tools: analytics pixels, chatbots, A/B testing systems, review widgets, marketing scripts. Each of those fragments is a door that opens in your clients' browsers and that you do not control. If the provider falls, you fall with it, even if your code is impeccable.

At ForgeNEX we often see this in SMEs that have accumulated plugins and tags without a clear inventory. The recommendation is not to live in fear, but to apply digital hygiene:

  • Make an inventory of third-party scripts. Review which external domains you load and what each one is for. If something does not provide measurable value, remove it.
  • Apply a content security policy (CSP). It allows you to limit from which domains JavaScript can run on your website. It is not a silver bullet, but it greatly reduces the surface.
  • Use integrity attributes (SRI) when possible. Although not all providers facilitate it, it is advisable to demand it as much as possible.
  • Review your own payment forms. If you charge with forms hosted on your website and not with payment gateway iframes, take extra precautions and consider migrating to hosted solutions.
  • Demand transparency from your providers. Ask about their incident response protocols and notification deadlines.

This case is reminiscent of others we have already discussed on the blog, such as the theft of credentials and tokens from all Chainalysis clients. In both, the weak link is not the final victim, but the chain of trust. For an SME, the practical conclusion is that security is no longer limited to protecting what is yours: it also consists of knowing what you trust to others and how you verify that they still deserve that trust. If your IT team does not have a map of external dependencies, this is a good time to start drawing one.

Source: Computerworld. Analysis and adaptation: ForgeNEX.

Keep reading

Call us WhatsApp