Visitors to 178 organisations' websites were served malicious JavaScript after attackers tampered with snippets belonging to Optimizely Web Experimentation, the A/B testing service that sites embed to trial page changes. The campaign, tracked as OPTIMJACK, was documented by Report URI researchers and reported by Security Affairs.
How the tampering worked
Optimizely snippets are small blocks of JavaScript that marketing and product teams drop into a page template to run experiments, toggle variants and collect behavioural data. They execute with the full privileges of the hosting page — same origin, same access to cookies, forms and DOM — which is precisely what makes them attractive to an attacker.
In this case, the injected code served as a delivery channel for a crypto-stealer and payment-card skimmer, alongside payload logic that the research associates with iPhone users. Report URI's audit flagged malicious code in 188 of the 1,611 snippets it examined, spread across the 178 organisations' sites identified in the report — a hit rate scoped strictly to that audited sample, not a claim about the Optimizely install base at large.
Injected snippets were observed on sites including BBC, CNN and Zoom properties; the report does not establish these brands as confirmed breach victims, only that the tampered code was seen loading on pages under those domains.
Importantly, the research does not establish how the snippets were altered in the first place. The report leaves the initial access path open — no confirmed Optimizely platform compromise is asserted — so defenders should not read it as a vendor-breach notification. What is confirmed is the end state: someone with edit rights over a snippet could execute arbitrary code on every visitor's machine.
What web-stack operators should check
For teams running experimentation or tag-management tooling, the incident distils into a short, practical audit:
- Subresource Integrity (SRI). Third-party
<script>files pulled from an external domain should carry anintegrityattribute with a pinned hash, so the browser refuses to execute them if the file changes. In practice this protection is rarely applied to scripts injected by tag managers at runtime, and it does nothing for inline script blocks — enumerate both and plan accordingly. - Content Security Policy. A restrictive
script-srcthat limits execution to an explicit allowlist of hosts and nonces makes drive-by snippet substitution far harder, even when an attacker can edit markup. - Snippet inventory and diffing. Keep a baseline of every third-party snippet on your estate and alert on content drift — changed URLs, appended payloads, unfamiliar CDN origins. Report URI's own methodology (hash-comparing snippets at scale) is a workable model.
- Access review. Confirm who can edit experimentation snippets and tag containers, and that changes require review rather than landing unattended in production.
Any organisation running Optimizely or comparable experimentation and tag-management tooling should treat these four checks as a weekend task rather than a backlog item.
The exposure described in the report is not limited to any single market. Hong Kong IT teams operating content-heavy sites with third-party testing and analytics scripts face the same surface, and the checklist above applies without modification. No Hong Kong-specific regulatory action or incident has been reported in connection with this campaign.
Attribution for the underlying research goes to Report URI, with the story surfaced by Security Affairs.
178 個機構的網站訪客被投放惡意 JavaScript,原因是攻擊者篡改了屬於 Optimizely Web Experimentation 的 snippets——網站用來嵌入並測試頁面改動的 A/B 測試服務。這項行動被追蹤為 OPTIMJACK,由 Report URI 研究人員記錄,並由 Security Affairs 報道。
篡改手法
Optimizely snippets 是一小段 JavaScript,市場推廣及產品團隊將其放入頁面模板,以執行實驗、切換變體及收集用戶行為數據。它們以宿主頁面的完整權限執行——同一 origin、同樣可存取 cookies、表單及 DOM——這正是它們對攻擊者具吸引力之處。
是次事件中,注入的代碼用作 crypto-stealer 及支付卡 skimmer 的投放渠道,另有研究人員將部分 payload 邏輯與 iPhone 用戶聯繫起來。Report URI 的審計在檢視的 1,611 個 snippets 中標記出 188 個含惡意代碼,散布於報告所指的 178 個機構網站——該命中率嚴格限於所審計的樣本,並非對 Optimizely 整體安裝量的推斷。
被注入的 snippets 出現在包括 BBC、CNN 及 Zoom 旗下站點;報告並未證實這些品牌為確認的受害者,只說明被篡改的代碼曾在這些域名下的頁面載入。
值得留意的是,研究並未確認 snippets 最初如何被更改。報告對初始入侵途徑持開放態度——並未斷言 Optimizely 平台被入侵——防範方不應將其視為供應商安全事故通知。確知的是最終結果:任何擁有 snippet 編輯權限的人,均可在每一位訪客的機器上執行任意代碼。
網站技術團隊應檢查什麼
對於運行實驗或 tag management 工具的團隊,事件可歸納為一份簡短實用的審計清單:
- Subresource Integrity(SRI)。 從外部域名載入的第三方
<script>檔案應帶有固定的雜湊值integrity屬性,使檔案一旦變更,瀏覽器便拒絕執行。實際上,這項保護極少應用於由 tag manager 在運行時注入的腳本,且對 inline script 區塊完全無效——兩者都要逐一列舉並相應規劃。 - Content Security Policy。 一個限制嚴格的
script-src,將執行範圍限定於明確的主機及 nonces allowlist,可大幅增加 snippet 被暗中替換的難度,即使攻擊者能夠編輯 markup 亦然。 - Snippet 盤點及差異比對。 為管轄範圍內每個第三方 snippet 保留基準版本,並在內容出現偏差時發出警報——URL 變更、附加 payload、陌生的 CDN origin。Report URI 自身的方法(大規模比對 snippets 雜湊值)是一個可行的參考模式。
- 權限審查。 確認誰有權編輯實驗 snippets 及 tag containers,並確保任何更改須經覆核,而非無人監督直接進入 production。
任何運行 Optimizely 或同類實驗及 tag management 工具的機構,都應將上述四項檢查視為週末任務,而非擱置在工作清單上的待辦事項。
報告所述的暴露面並不限於任何單一市場。香港 IT 團隊運行內容密集的網站,並使用第三方測試及分析腳本,所面對的暴露面相同,上述檢查清單可原樣適用。目前尚未有報道指香港有針對此行動的特定監管行動或事故。
基礎研究歸功於 Report URI,報道由 Security Affairs 提供。
