HTML smuggling hides a payload inside JavaScript that decodes it and saves it locally using browser APIs, so network controls see only an HTML file or page. The payload (an ISO, ZIP, script or executable) is created on the endpoint. That makes the artefacts worth hunting the HTML itself, the blob-origin download and what runs next.
Signals at a Glance
| Signal | Where | ATT&CK |
|---|---|---|
| HTML attachment with Blob construction, base64 decode and a download trigger | Email gateway | T1027.006 |
| File written by a browser with a blob: origin URL | Defender file events, EDR | T1027.006 |
| HTML file opened from the mail client, then a new archive or image in Downloads | Sysmon 11, EDR | T1566.001 |
| Dropped ISO, ZIP, LNK or script executed minutes after the browser wrote it | Sysmon 1, EDR | T1204.002 |
| Decoded content that never crossed the proxy as a file download | Proxy vs endpoint | T1140 |
Catching the HTML
Legitimate pages use Blob and base64 too, but an attachment that builds a Blob from an embedded string and clicks a download link is unusual. Score the combination, not a single keyword:
rule hunt_html_smuggling_blob_download
{
meta:
description = "HTML with embedded base64 blob assembly and forced download"
note = "hunting rule - tune/validate on your own mail corpus before blocking"
strings:
$blob1 = "new Blob" nocase
$blob2 = "createObjectURL" nocase
$legacy = "msSaveOrOpenBlob" nocase
$dec = "atob(" nocase
$dl1 = ".download =" nocase
$dl2 = "download=" nocase
$click = ".click()" nocase
condition:
filesize < 5MB and
(1 of ($blob*)) and ($dec or $legacy) and (1 of ($dl*)) and $click
}
Blob Origin and What Runs Next
Microsoft Defender records the download origin for files a browser writes. A blob: or empty origin on a risky file type, followed by execution, is the endpoint view of the same technique:
// Defender XDR (KQL) - risky file written by a browser from a blob origin, then executed
let drops = DeviceFileEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ ("chrome.exe","msedge.exe","firefox.exe")
| where FileName matches regex @"(?i)\.(iso|img|zip|rar|7z|lnk|js|jse|vbs|hta|exe|dll|msi)$"
| where FileOriginUrl startswith "blob:" or isempty(FileOriginUrl)
| project DropTime=Timestamp, DeviceId, DeviceName, FileName, FolderPath, SHA256;
drops
| join kind=inner (
DeviceProcessEvents
| where Timestamp > ago(7d)
| project ExecTime=Timestamp, DeviceId, ProcessCommandLine, InitiatingProcessFileName, ExecFolder=FolderPath
) on DeviceId
| where ExecTime between (DropTime .. DropTime + 30m)
| where ProcessCommandLine has FileName or ExecFolder has FileName
// tune/validate: empty origin also covers some legitimate in-browser exports
- Have the gateway detonate or strip HTML attachments for users who have no business reason to receive them, and rewrite the rest to open in a protected viewer.
- Hunt for HTML attachments with very long single-line strings; payloads are usually one large base64 literal.
- Review browser download policy: block risky file types downloaded from email-originated pages, and require the mark of the web to be preserved on saved files.
Use SigmaHQ and Elastic rules for browser-spawned and download-origin behaviour, Microsoft Defender for Office guidance on HTML attachments, and public YARA rules for smuggling kits as a starting point. Baseline your own environment — web developers and some business tools generate blobs legitimately.
Build Detections That Fire
Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.
- Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
- Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
- 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Stay ahead of emerging threats. Get notified when we publish new intelligence reports and advisories.
Subscribe to Alerts