I realise I sound like a broken record when I go on about this, but I’m going to say it yet again: every time you add a script from a third party to your website, you are handing a stranger the keys to your house and your visitors’ houses, then hoping they never lose them. Unless you have truly formidable security, which is very rarely the case, this is a bad idea.
I talked about DebugBear last time, a performance auditing script that got taken over by bad actors.
Well, today we’ve got Optimizely, a very popular A/B testing script (A/B testing compares two versions of a page or a button, for example, by showing each to different people and seeing which one performs better) that got taken over and found itself injecting malware into the browsers of visitors to sites like Ikea, KLM, the BBC, and Salesforce. We’re talking about some of the largest sites on the planet, not some random blog. Despite that, they still got turned into malware dispensers by a script they trusted but didn’t control.
A couple of months back, it was Brevo, the French email marketing platform that got compromised along with 100,000 (!) client websites.
In most cases, the perpetrators were hunting financial or crypto information. But the same technique could be used to change the page content or takeover as the user. Imagine fake stories on news sites, forms that send their content elsewhere, scripts that hijack the user session and change their password or make a booking. The only real limit is the attacker’s imagination, and attackers aren’t short of that.
Things are not likely to improve here. Generative AI is amplifying the discovery of these weaknesses as well as their exploitation at scale.
Really think twice before you embed anything external into your website. These services will promise all kinds of marvels: more conversions, more leads, better insight. But, if (when?) they get breached, so will you and so will your users.
If you must install those analytics, lead generators, chatbots, whatever… check if you can install them on your own server first, where they can’t suddenly mutate under your feet.
If you can’t, use version pinning and SRI (Subresource Integrity, see previous email). But even SRI wouldn’t have protected you from the Optimizely attack.
In that case, the only thing that would have done the job is a strict CSP (Content Security Policy). Very few websites have them properly setup because, well, they’re a pain in the neck. It’s worth it for the peace of mind, though. Paste your site address here for a check, then brace yourself to be loathed by your IT department or web developer when you ask them to implement one.
Colin