AI Security AI安全 1d ago Updated 1d ago 更新于 1天前 46

Malvertising Sends Malware in Pieces, Then Makes the Browser Build the Executable 恶意广告将恶意软件分片发送,然后让浏览器自行构建可执行文件

Malvertising campaign "SourTrade" uses browser-side assembly to construct Windows executables, ensuring no complete malware binary exists on the network during transmission. Attackers leverage a legitimate Bun runtime and JavaScriptCore bytecode, combining them with attacker-controlled PE headers and pseudorandom data via ServiceWorkers and SharedWorkers. The technique generates unique file hashes per session by rotating AES-CTR seeds, effectively bypassing static hash-based detection mechanisms SourTrade 恶意广告活动利用浏览器端构建技术,通过合法 Bun 运行时和碎片化载荷组装最终的可执行文件,规避传统基于哈希的检测。 攻击者使用 ServiceWorker 和 SharedWorker 在客户端内存中拼接 PE 头、节表和包含恶意 JavaScriptCore 字节码的数据,实现“无完整二进制文件在网络传输”。 该活动伪装成 TradingView、Solana 等知名金融平台,针对全球 12 个国家的加密货币投资者,利用指纹识别技术对研究人员和正常用户展示不同内容。 防御重点应从单一文件检测转向全链路分析,包括广告引流、伪装着陆页、配置请求及 ServiceWorker

65
Hot 热度
70
Quality 质量
60
Impact 影响力

Analysis 深度分析

TL;DR

  • Malvertising campaign "SourTrade" uses browser-side assembly to construct Windows executables, ensuring no complete malware binary exists on the network during transmission.
  • Attackers leverage a legitimate Bun runtime and JavaScriptCore bytecode, combining them with attacker-controlled PE headers and pseudorandom data via ServiceWorkers and SharedWorkers.
  • The technique generates unique file hashes per session by rotating AES-CTR seeds, effectively bypassing static hash-based detection mechanisms.
  • Campaign targets retail cryptocurrency traders by impersonating TradingView, Solana, and Luno, using sophisticated cloaking to evade researcher and bot detection.

Why It Matters

This represents a significant evolution in evasion techniques, shifting the burden of malware construction from the server to the client's browser environment. For security practitioners, it highlights the limitations of traditional signature-based defenses and underscores the need for behavioral analysis and comprehensive chain monitoring rather than relying on single-point artifact detection.

Technical Details

  • Assembly Mechanism: The attack registers a page-scoped ServiceWorker (/sw.js) and builds a SharedWorker from embedded JavaScript. This worker fetches configuration and a clean Bun runtime from a secondary domain (purelogicbox[.]org).
  • Payload Construction: The SharedWorker retrieves Base64-encoded PE headers, section tables, and malicious JavaScriptCore bytecode (for app.js). It generates a large pseudorandom byte stream using AES-CTR and combines these elements according to a template to assemble the final executable in memory.
  • Evasion Strategy: By assembling the file client-side, the final binary never traverses the network as a whole. Each victim receives a uniquely hashed file due to session-specific random values, neutralizing static hash-based blocking.
  • Delivery Chain: The assembled executable is passed to the ServiceWorker as a readable stream. A hidden iframe navigates to a same-origin URL, triggering the ServiceWorker to return the bytes with a Content-Disposition attachment header, preserving the Mark of the Web (MotW) from the landing page.

Industry Insight

  • Shift to Behavioral Analysis: Defenders must move beyond static file hashing and implement monitoring for anomalous browser behaviors, such as unusual ServiceWorker registrations or unexpected data streams from legitimate runtimes like Bun.
  • Supply Chain Trust Risks: The use of legitimate tools (Bun) for malicious purposes demonstrates the growing risk of "living off the land" techniques in web environments. Security teams should scrutinize how legitimate software components are being invoked in unexpected contexts.
  • Holistic Threat Hunting: Investigation should focus on the entire delivery chain—from ad referral and cloaked landing pages to configuration requests and secondary domain fetches—rather than isolating individual network artifacts which may appear benign in isolation.

TL;DR

  • SourTrade 恶意广告活动利用浏览器端构建技术,通过合法 Bun 运行时和碎片化载荷组装最终的可执行文件,规避传统基于哈希的检测。
  • 攻击者使用 ServiceWorker 和 SharedWorker 在客户端内存中拼接 PE 头、节表和包含恶意 JavaScriptCore 字节码的数据,实现“无完整二进制文件在网络传输”。
  • 该活动伪装成 TradingView、Solana 等知名金融平台,针对全球 12 个国家的加密货币投资者,利用指纹识别技术对研究人员和正常用户展示不同内容。
  • 防御重点应从单一文件检测转向全链路分析,包括广告引流、伪装着陆页、配置请求及 ServiceWorker 下载行为,以识别这种动态组装的攻击链。

为什么值得看

这篇文章揭示了恶意软件分发领域的一种新型 evasion 技术,即利用合法开发工具(Bun)和浏览器原生功能(ServiceWorker)在客户端动态构建恶意可执行文件,这对现有的基于静态特征和哈希值的威胁检测机制构成了严峻挑战。对于安全从业者和企业防御团队而言,理解这种“内存组装”和“碎片化传输”的技术细节,有助于优化网络流量监控策略,从关注单个文件转向关注完整的攻击行为链。

技术解析

  • 客户端动态组装架构:攻击者不再直接分发完整的恶意二进制文件,而是将 PE 头、节表以及包含恶意载荷的 .bun 部分以 Base64 形式嵌入配置响应中。浏览器通过 JavaScript 获取合法的 Bun 运行时,并结合 AES-CTR 生成的伪随机字节流,按照模板指令在内存中重新组装出最终的 Windows 可执行文件。
  • 隐蔽通信与 Worker 利用:着陆页首先注册页面级 ServiceWorker (/sw.js),随后利用嵌入页面的 JavaScript 构建 SharedWorker。SharedWorker 负责向攻击者控制的服务器请求 /config 配置信息,获取运行时 URL 和会话特定的随机值,从而实现配置与载荷的分离传输,避免在网络流量中出现完整的恶意文件。
  • 反侦察与环境指纹识别:着陆页具备访客指纹识别能力,能够区分正常用户、研究人员和自动化机器人。对于疑似研究人员或 Bot,页面显示为空;而对于选定的高价值目标(如加密货币投资者),则呈现高度仿真的 TradingView 或 Luno 界面,以提高欺骗成功率。
  • 持久化与下载伪装:组装完成后,ServiceWorker 将生成的可执行文件作为可读流传递给隐藏的 iframe,并通过 Content-Disposition: attachment 头触发下载。此过程保留了“Mark of the Web (MotW)”属性,但将下载源标记为着陆页而非提供 Bun 运行时的二级域名,增加了溯源难度。

行业启示

  • 检测范式需从静态转向动态行为分析:传统的基于文件哈希或静态特征库的检测手段对此类攻击失效。安全厂商和企业应加强对浏览器端脚本行为、ServiceWorker 注册与活动、以及异常网络数据重组行为的监控,建立基于行为图谱的威胁检测模型。
  • 供应链与合法工具的滥用风险加剧:攻击者利用合法的 Bun 运行时和开源库(如 StreamSaver.js 的架构理念)作为掩护,模糊了恶意代码与合法软件的边界。开发者和安全团队需警惕合法开发工具被用于恶意目的,加强对第三方依赖和运行时环境的完整性校验。
  • 加密货币领域的定向攻击持续升级:针对金融和加密货币用户的恶意广告活动正变得更加精细化和定制化。金融机构和投资平台应加强用户安全教育,明确提示官方软件分发渠道,并考虑在广告投放环节引入更严格的验证机制,防止假冒着陆页的传播。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全