Attackers increasingly weaponize SVG files with embedded JavaScript and Base64‑encoded payloads to deliver phishing pages and malware while evading traditional detection. Deep CDR™ Technology, one of the core technologies that powers MetaDefender Core™, neutralizes this class of attack by removing all active content (scripts, external references, event handlers, etc.) and delivering a clean, standards‑compliant image that preserves functionality while eliminating risk. Normal, trustworthy SVGs (Scalable Vector Graphics) do not need JavaScript, so it is removed by default.
为什么选择 SVG
网络钓鱼有效载荷的完美载体
SVG 是一种基于 XML 的矢量图像格式,而不是简单的位图。

SVG 文件可以包括
- 脚本
- 事件处理程序
- 外部参考资料
这些功能对交互式图形非常有用,但攻击者会利用这些功能:
- 运行恶意代码
- 注入恶意 XML 数据
- 获取外部内容
- 渲染虚假登录页面
攻击者还将 SVG 与HTML/JS 走私相结合,在看似无害的图像中嵌入 Base64 有效负载,并在运行时对其进行解码。这种技术现在被正式列为 MITRE ATT&CK "SVG 走私"(T1027.017)。
主要启示
In normal enterprise content workflows (logos, icons, diagrams), SVGs don’t require JavaScript or active content. If you find <script>, event handlers, or remote references in an inbound SVG, treat them as risky.
我们在野外看到的
带有 Base64 解码钓鱼网站的电子邮件附件
- 发送:常规电子邮件带有 .svg 附件,许多电子邮件网关将其视为图像。
- Technique: Inside the SVG, an obfuscated <script> reconstructs a phishing page from a Base64 blob and loads it in the browser.
使用事件处理程序重定向的Drive网站
- 交付:被破坏或错字连篇的网站使用透明的 SVG 叠加,并带有可点击区域。
- 技术:事件属性(onload、onclick)使用 Base64 解码触发重定向。
为什么检测工作在这里举步维艰
当攻击者使用签名、模式规则和静态代码检查等传统方法时,这些方法就会失效:
- 使用 Base64、XOR、垃圾文本填充或多态模板进行混淆。
- 将执行时间推迟到运行时(如加载时),导致静态分析不可靠。
- 隐藏事件处理程序和外部引用等合法 SVG 功能背后的逻辑。
有趣的事实
根据 HTTP Archive 的数据,在排名前 1000 的网站中,92% 的图标和图形都使用了 SVG。
"如果活跃,就有风险"
Deep CDR™ Technology for SVG
Deep CDR™ Technology, one of the core technologies that powers MetaDefender Core, doesn’t try to guess what is malicious. It assumes any executable or active content in untrusted files is risky and removes or sanitizes it.

对于 SVG 来说,这意味着
- Remove JavaScript: Strips out any <script> elements and inline scripts to prevent code execution.
- 删除 CDATA:消除 CDATA 部分内可能嵌入有害逻辑的隐藏代码。
- 移除注入内容:阻止可执行恶意程序的注入内容。
- 处理图像递归清除嵌入的图像并移除外部图像。
- 规范化与重建:创建符合标准的 SVG,只包含安全的视觉元素。
- 可选择光栅化:将 SVG 转换为 PNG 或 PDF,用于不需要矢量交互的工作流程。

这种方法符合安全指南:对 SVG 进行消毒或沙盒化(或光栅化),以防止代码执行。
Top Use Cases with Deep CDR™ Technology
电子邮件网关
在交付前对入站附件和链接文件(通过下载解析的 URL)进行消毒。转换为干净 SVG 的 SVG 可防止凭证收集器呈现和下载器启动。
协作平台
Apply Deep CDR™ Technology to files shared through tools like Teams, Slack, or SharePoint. Sanitizing SVGs here ensures that no hidden login screens or malicious scripts can trick users during everyday collaboration.
网络上传门户
对上传到网站、内容管理系统或数字资产管理系统的所有文件实施消毒。这可以防止攻击者将有害代码隐藏在看似简单的徽标或图形中。
文件传输和MFT Managed File Transfer
Integrate Deep CDR™ Technology into file transfer workflows so every file, especially those from partners or vendors, is safe to use before entering your network. This reduces supply chain risks from compromised assets.
业务影响
忽略 SVG 净化可能导致..:
- 凭证盗窃:伪造登录页面获取用户凭证。
- 恶意软件感染:重定向链会发送勒索软件或窃取程序。
- 违反合规:涉及敏感数据的违规行为会引发罚款和声誉损失。
防止基于 SVG 的攻击的最佳实践
- 默认立场:不在 SVG 中使用来自不可信来源的 JavaScript。
- Sanitize or rasterize: Apply Deep CDR™ Technology to all inbound SVG files.
- 与 CSP 结合使用:用作深度防御,而非主要控制。
- 审计和日志:跟踪每项清理操作,以确保合规性和取证。
结束语
SVG-based phishing is not theoretical, it’s happening now. Detection-based tools can’t keep up with evolving obfuscation techniques. Deep CDR™ Technology offers a deterministic, zero-trust approach, removing the risk before it reaches your users.
