Phishing & Social Engineering

HTML Smuggling

HTML smuggling is a sophisticated evasion technique that allows attackers to deliver malicious payloads by encoding them within specially crafted HTML files or web pages.

Alway Automate, Nothing To Manage

Always automated.

Nothing to manage.

Leave Training & Simulated Phishing to us.

Definition

HTML smuggling is a sophisticated evasion technique that allows attackers to deliver malicious payloads by encoding them within specially crafted HTML files or web pages. When a user opens the HTML in a web browser, legitimate HTML5 and JavaScript features decode and assemble the malware on the victim's machine locally, behind firewalls and perimeter security. This technique bypasses traditional email gateways, web proxies, and content inspection systems by generating executable files only after the HTML is loaded on the endpoint—after the file has passed all network-level security controls.

How it works

HTML smuggling exploits standard, legitimate APIs that all modern browsers support to create a novel attack vector.

Malicious APIs and Legitimate Functions

HTML smuggling abuses three legitimate HTML5 and JavaScript features:

  • HTML5 download attribute: Allows anchor (<a>) tags to trigger file downloads without server-side redirection, providing direct download control from the browser

  • JavaScript Blob API: Creates binary data structures in memory that can be converted to downloadable files

  • URL.createObjectURL(): Generates temporary URLs pointing to Blob objects stored in browser memory

Attack Flow: Three Stages

Stage 1: HTML Delivery

Attackers send email with malicious HTML attachment or direct users via phishing email to malicious HTML webpage. HTML appears benign to email filters and web proxies—it is just markup and scripting code. No suspicious executable file is transmitted through network perimeter controls, allowing the HTML to bypass antivirus, content filters, and signature-based detection systems.

Stage 2: Encoding and Assembly

Within the HTML, attackers encode malicious executables (PE files, ZIP archives, ISO images, etc.) as base64, hexadecimal, or chunked data strings embedded directly in HTML/JavaScript. When HTML loads in the browser, JavaScript automatically decodes this data back into binary form using standard browser APIs. JavaScript creates a Blob object from the decoded data and generates a temporary download URL using URL.createObjectURL().

Stage 3: Local Execution

The browser triggers automatic file download using the HTML5 download attribute on an anchor tag. The malware file is written to disk (Downloads folder, Temp folder, or other user-writable locations). Depending on browser and OS settings, the user may be prompted to open the file or the file may auto-execute. Once the malware executes locally, it establishes command-and-control communications, performs lateral movement, or deploys secondary payloads like ransomware.

Evasion Characteristics

HTML smuggling provides multiple layers of evasion:

Network-Level Bypass: Network inspection tools see only HTML and JavaScript traffic—both are legitimate and commonly used in normal internet activity. Traditional network-based malware detection systems cannot identify malicious intent from HTML and JavaScript.

Signature Evasion: No known malware signature is transmitted during transport. The malicious file is generated locally on-demand through legitimate browser APIs, making signature-based detection at the network boundary ineffective.

Obfuscation: Payload encoding (base64, hex, chunked strings) and JavaScript obfuscation hide malicious intent from static analysis tools. Each campaign can use unique encoding, making it difficult to develop universal detection signatures.

Perimeter Avoidance: Security solutions depending on file-based or signature-based detection at the network boundary are rendered ineffective because the malicious executable never exists as a file until after it passes through perimeter defenses.

Real-World Attack Chain: IcedID and Nokoyawa Ransomware

The DFIR Report documented a sophisticated HTML smuggling attack that compromised an entire domain within 12 hours (2023). This represents HTML smuggling evolution from initial access to enterprise-wide ransomware deployment:

  1. Initial Access: TA551 distributed malicious HTML via email using thread-hijacked messages (replies to existing email threads)

  2. Payload Presentation: HTML rendered fake Adobe interface prompting download of password-protected ZIP

  3. Malware Delivery: ZIP contained ISO file with three hidden files and visible shortcut disguised as document

  4. First-Stage Execution: Shortcut executed batch script that loaded rundll32.exe with IcedID DLL

  5. Credential Access: IcedID executed, accessed LSASS memory to harvest credentials

  6. Command-and-Control: Established command-and-control with attacker infrastructure

  7. Lateral Movement: Attackers used RDP with stolen credentials, deployed Cobalt Strike beacons; hands-on-keyboard reconnaissance using AdFind, SoftPerfect Netscan

  8. Domain-Wide Ransomware: Deployed Nokoyawa ransomware throughout network via PsExec and WMIC within 12 hours of initial breach

This attack demonstrates HTML smuggling as an effective entry point for enterprise-wide ransomware deployment (DFIR Report, 2023).

How it differs

Aspect

HTML Smuggling

PDF Phishing

SVG Phishing

Standard Malware Email

File Format

HTML + JavaScript

PDF binary

SVG XML

EXE/ZIP/MSI attached

Encoding

Base64, hex, chunked data

Embedded links

Base64-encoded HTML

Direct binary

Detection Evasion

High (no signature)

Medium (PDF detection)

Medium-High (XML parsing)

Low (executable signatures)

Network-Level Bypass

Yes (HTML/JS appear benign)

Partial (PDF attachment flags)

Yes (SVG as image)

No (flagged immediately)

Local Execution

Yes (browser + endpoint)

No (external phishing page)

Yes (browser JS execution)

Yes (direct execution)

File Assembly

On-device (Blob API)

N/A

On-device (JS decode)

N/A

User Interaction Required

Click download prompt

Click link

Click SVG

Auto-execute or open

Primary Use

Malware distribution

Credential theft

Credential theft

Malware delivery

Why it matters

HTML smuggling represents an increasingly popular malware distribution technique that bypasses traditional network-based defenses. Microsoft Security Blog documented HTML smuggling "surging" in popularity for banking malware and targeted attacks in 2021, with the technique continuing to evolve through 2025.

Growth trends indicate expanding adoption. From Q4 2023 to Q1 2024, unique domains using HTML smuggling increased from 1,000 to 1,300—a 30% increase in just six months. From March to June 2024, phishing campaigns leveraging HTML smuggling targeted technology, banking, and financial services sectors across Asia, North America, and South Europe, frequently hosted on Cloudflare Workers to evade detection (The Hacker News, 2024).

Microsoft Defender Experts observed and assisted multiple customers addressing HTML smuggling campaigns from October 2024 through early 2025, indicating ongoing active exploitation at enterprise scale.

HTML smuggling is particularly attractive to threat actors because it delivers malware families with high impact: IcedID (banking credential harvesting), Mekotio (Latin American targeting), AsyncRAT and NJRAT (remote access for hands-on-keyboard attacks), Trickbot (modular banking malware), AZORult (information stealer), Nokoyawa (ransomware-as-a-service), and Cobalt Strike (post-exploitation framework). These malware families enable credential theft, persistent access, lateral movement, and ransomware deployment.

Limitations

Despite effectiveness, HTML smuggling faces technical and operational constraints.

Browser-Dependent Execution

HTML smuggling requires a modern browser with HTML5 support. Text-based email clients or older clients may not execute JavaScript, limiting attack reach. Additionally, some corporate email systems render HTML emails in sandboxed environments that block Blob API and URL.createObjectURL() operations.

User Interaction Required

Success depends on users downloading and opening the file. The HTML download prompt provides a moment where users can evaluate file type and source. Users cannot be compromised without their active participation in the download-and-execute sequence.

Blob API and Browser Limitations

Blobs are stored in browser memory and are subject to browser garbage collection. Very large payloads may trigger performance warnings or fail to allocate sufficient memory. Some browsers or OS configurations restrict where downloaded files can be written, limiting execution vectors.

Obfuscation Complexity Costs

Encoding large binaries (PE files, RATs, ransomware) in base64/hex increases file size significantly—base64 encoding increases file size by approximately 33%, while hex encoding increases it by approximately 100%. Large HTML files may trigger email size filters, preventing delivery. Each campaign requires custom HTML/JavaScript; mass-scale delivery requires multiple encoding variants to evade detection signatures.

Testing and Infrastructure Requirements

Attackers must test payloads across multiple browsers (Chrome, Firefox, Safari, Edge) and OS combinations to maximize success. HTML smuggling also requires reliable command-and-control servers; takedown of infrastructure disrupts ongoing campaigns.

Defense and mitigation

Organizations can implement email gateway, endpoint, and user-level controls to defend against HTML smuggling.

Email and Web Gateway Controls

Configure email servers to block or sandbox HTML files entirely—most organizations have no legitimate business reason to receive HTML attachments. Deploy email gateways with detonation/sandboxing capabilities that execute suspicious HTML files in isolated environments before delivery.

Use web proxies with JavaScript analysis capabilities to detect suspicious Blob operations, URL.createObjectURL() patterns, or automatic download triggers. Deploy Content Disarm and Reconstruction (CDR) solutions that strip active elements (scripts, macros) from files while preserving benign content.

Endpoint and Browser Security

Disable auto-download features in browsers; require manual user confirmation for all downloads. Keep browsers patched with latest security updates. Use application whitelisting to restrict which files can execute from Downloads and Temp folders.

Deploy endpoint detection and response (EDR) solutions that monitor JavaScript execution, Blob API calls, and suspicious URL.createObjectURL() patterns. Maintain current antivirus/anti-malware signatures; deploy behavioral analysis tools that detect malware spawning from HTML files.

User and Organizational Defenses

Educate users that HTML files are executable code, not just documents. Suspicious downloads should not be opened, especially password-protected archives. Train users to verify file type before opening—check file extension and properties; be suspicious of password-protected archives claiming to be documents.

Disable automatic file downloads in email policies; require manual user confirmation for suspicious file types. Establish rapid containment procedures if HTML-smuggling malware is detected; quarantine affected systems and investigate for lateral movement or ransomware deployment.

Network and Monitoring Controls

Block known malware command-and-control domains using DNS-level filtering or firewall denylists. Monitor for suspicious outbound connections from user workstations, especially to known malware C2 infrastructure. Alert on unusual RDP, PsExec, WMIC, or credential access attempts (LSASS) that may indicate post-breach activity.

Deploy ransomware-specific protections monitoring for mass file encryption, volume shadow copy deletion, or backup system tampering.

FAQs

How is HTML smuggling different from a standard phishing email with an executable attachment?

HTML smuggling does not send a recognizable executable (EXE, DLL, ZIP with malware). Instead, it sends HTML—a file type that email filters generally trust and appear non-threatening. The malicious payload is encoded as text (base64, hex) within the HTML and only decoded into binary when the browser executes the JavaScript. Standard phishing emails with executables are flagged immediately by signature-based detection; HTML smuggling evades this because the malware file does not exist until after the user opens the HTML in their browser, allowing it to pass through network-level defenses (Microsoft Security Blog, 2021; Imperva, 2024).

What is a Blob and how does HTML smuggling use it to deliver malware?

A Blob (Binary Large Object) is a JavaScript API that allows browsers to create and manipulate binary data in memory. In HTML smuggling, the attack proceeds as follows:

  1. Attacker encodes malware as base64/hex text embedded in HTML

  2. JavaScript decodes this text back into binary using Blob API

  3. URL.createObjectURL() generates a temporary URL pointing to the Blob in memory

  4. HTML5 download attribute triggers the browser to download this URL to disk

  5. Malware file is written to Downloads folder and can be executed

This entire process happens within the browser using standard APIs that all modern browsers support (Imperva, 2024; Microsoft Security Blog, 2021).

How did the Nokoyawa ransomware attack happen via HTML smuggling?

The DFIR Report documented a 12-hour attack chain (2023):

  1. TA551 sent malicious HTML via email (thread-hijacked to appear as part of ongoing conversation)

  2. HTML rendered fake Adobe interface, prompted user to download ZIP

  3. ZIP contained ISO with hidden files plus shortcut

  4. User clicked shortcut → batch script loaded IcedID DLL via rundll32.exe

  5. IcedID harvested credentials from LSASS memory

  6. Storm-0390 attackers gained RDP access using stolen credentials

  7. Deployed Cobalt Strike for reconnaissance using AdFind, SoftPerfect Netscan

  8. Distributed Nokoyawa ransomware via PsExec/WMIC

  9. Ransomware encrypted all systems within 12 hours of initial breach

This demonstrates HTML smuggling as an entry point for enterprise-wide ransomware deployment (DFIR Report, 2023).

Why can't traditional antivirus detect malware delivered via HTML smuggling?

Traditional antivirus looks for known malware signatures in files as they pass through the network. HTML smuggling delivers only HTML + JavaScript—both appear benign to traditional scanners. The malware binary is never transmitted as a file; it is encoded as text within HTML. Only after the user opens the HTML and the browser decodes the payload does the malicious file appear on disk. By that time, the file may use a temporary name, encryption, or other obfuscation that evades signature matching. Additionally, endpoint antivirus operates on file hashes and signatures; malware generated dynamically through legitimate browser APIs may not match known signatures (Imperva, 2024; Microsoft Security Blog, 2021).

What is the best defense against HTML smuggling?

The most effective defenses are multi-layered:

  1. Block HTML attachments at the email gateway—most organizations have no legitimate reason to receive HTML files via email

  2. Sandbox suspicious files using threat detonation in isolated environments before delivery

  3. Disable auto-downloads in browsers; require manual confirmation for all downloads

  4. Deploy EDR monitoring for Blob API calls, JavaScript execution, and malware spawning from Downloads folder

  5. Security training educating users that HTML files are executable code, not safe documents

No single defense is sufficient; combination of email controls, endpoint protection, and user awareness provides the strongest protection against HTML smuggling attacks (Imperva, 2024; DFIR Report, 2023; Microsoft Security Blog, 2021).

Alway Automate, Nothing To Manage

Always automated.

Nothing to manage.

Always automated.

Nothing to manage.

Leave Training & Simulated Phishing to us.

Leave Training & Simulated Phishing to us.

Alway Automate, Nothing To Manage

Always automated.

Nothing to manage.

Leave Training & Simulated Phishing to us.

© 2026 Kinds Security Inc. All rights reserved.

© 2026 Kinds Security Inc. All rights reserved.

© 2026 Kinds Security Inc. All rights reserved.