HTML Smuggling: Phishing Pages Built Inside the Browser

Attack coverageUpdated

HTML smuggling hides a payload or phishing page in encoded HTML and JavaScript, then assembles it in the browser, past gateways and scanners. How it works.

HTML smuggling hides a malicious file or phishing page inside an innocent-looking HTML file or web page as encoded JavaScript, then assembles it inside the victim's browser. Because the payload only exists once it is decoded on the device, email gateways, web proxies, and file scanners see ordinary HTML instead of the threat.

Microsoft called it "a highly evasive malware delivery technique that leverages legitimate HTML5 and JavaScript features" back in 2021 (Microsoft), and MITRE tracks it as T1027.006. The newer twist is using it to deliver phishing pages rather than files: the credential form is built in the browser and shown from a blob: URL or a local file, places where much of the security stack, including many browser extensions, is not looking.

How HTML smuggling works

  1. Delivery. The victim gets an HTML attachment, a link to a near-empty launcher page, or a file staged on trusted storage such as SharePoint.
  2. The hidden payload. The real content sits in the page as a base64 string, a JavaScript Blob, or a data URL. Some kits encrypt it and ship the key in the same file, purely to defeat scanners.
  3. Assembly in the browser. Script decodes the payload on the device. For malware, it builds a file and triggers a download using the HTML5 download attribute. For phishing, it either wraps the HTML in a Blob and navigates to the resulting blob: URL, or writes the decrypted page straight into the document.
  4. The victim interacts with something that never crossed the network in readable form. There is no HTTP response containing the form for a gateway to hash and no file on the mail server for a scanner to flag.

Real-world examples

  • Malware delivery. Microsoft linked HTML smuggling to a NOBELIUM spear-phishing campaign, the Mekotio banking trojan, AsyncRAT and NJRAT, and Trickbot. MITRE lists APT29 embedding an ISO file in an HTML attachment and QakBot arriving in ZIP files the same way.
  • Blob URL phishing. We documented kits that serve an empty launcher page on free hosting, then assemble a Microsoft sign-in clone as a blob: document. The <all_urls> match pattern most browser security extensions rely on does not cover blob:, so their content scripts are never injected into the page the victim sees.
  • Encrypted local files. In the Signs Australia campaign, a compromised SharePoint tenant served an HTML file that decrypted itself with AES-256-GCM using WebCrypto, then wrote a device code phishing page into the document. The phishing page existed nowhere in plaintext until it rendered in the victim's browser.
  • Combined with BitM. The Nyasher kit used blob delivery for its live-streamed Google login.

Warning signs and detection signals

  • An address bar showing blob: or file: on a page that asks for credentials or shows a sign-in code.
  • HTML or HTM attachments, or HTML files downloaded from SharePoint, OneDrive, or webmail.
  • Page script that calls crypto.subtle.decrypt followed by document.write, or URL.createObjectURL followed by a top-level navigation.
  • A launcher page on free hosting that shows only a spinner and contains no content of its own.
  • A password manager that stays silent on what looks like a familiar login page.
  • ISO or ZIP downloads that a page generated locally rather than fetched from a server.

How Surface stops it

The point of smuggling is to get past everything that inspects content in transit. Surface Vision does not depend on transit: it runs locally in the browser, on the rendered page the user is looking at, after the smuggled content has been assembled.

That means the same layers apply however the page arrived, over HTTPS, from a blob: URL, or from a local file: cloned-page fingerprinting, visual similarity, lookalike and homoglyph domains, AiTM signals, kit signatures, and the device-code detections. Our own research is the evidence. Surface detects the blob URL kits described above, and in the Signs Australia case it blocked the locally opened, decrypted page when it opened Microsoft's device login window. Detection keeps working if the Surface server is down.

Smuggled malware files are a different job. Once a payload is written to disk and run, it is in endpoint territory, so keep the controls Microsoft recommends: attack surface reduction rules and opening .js files in a text editor rather than executing them.

If it already happened

  1. If credentials or a code were entered, treat it as account compromise: revoke sessions and refresh tokens, reset the password, and check for new device registrations and MFA methods.
  2. If a file was downloaded and run, isolate the endpoint and investigate with your EDR before reconnecting it.
  3. Pull the delivery vehicle. Remove the email or file from every mailbox and library. If it came from a partner's compromised SharePoint, tell them.
  4. Hunt for other recipients who opened the attachment or reached the launcher domain.
  5. Reduce exposure. Block HTML attachments where the business allows and alert on traffic to free hosting domains you do not use.

Related techniques: device code phishing and malicious browser extensions.