✉️ HTML Smuggling generator&obfuscator for your Red Team operations
✉️ HTML Smuggling generator&obfuscator for your Red Team operations
HTMLSmuggler - JS payload generator for IDS bypass and payload delivery via HTML smuggling.
The full explanation what is HTML Smuggling may be found here.
The primary objective of HTML smuggling is to bypass network security controls, such as firewalls and intrusion detection systems, by disguising malicious payloads (e.g. executables/archives/etc.) within seemingly harmless HTML and JavaScript code. By exploiting the dynamic nature of web applications, attackers can deliver malicious content to a user's browser without triggering security alerts or being detected by traditional security mechanisms. Thanks to this technique, the download of a malicious file is not displayed in any way in modern IDS solutions.
The main goal of HTMLSmuggler tool is creating an independent javascript library with embedded malicious user-defined payload. This library may be integrated into your phishing sites/email html attachments/etc. to deliver embedded payload to the target user system (bypassing IDS and IPS system). An example of created javascript library may be found here.
Install yarn package manager.
Install dependencies:
yarnRead help message.
yarn build -hOptions:
-p, --payload Path to payload file you want to smuggle
-n, --name Name of file, that would be downloaded
-t, --type Contet-Type of downlonaded file (default: "application/octet-stream")
-f, --function Name of exported function (default: "download")
-c, --compress Enable payload compression (gzip)
-d, --delay Delay before antibot and download in ms (default: 0)
-a, --antibot Enable bot detection and block them (recommended)
-h, --help display help for command(Optional) Modify javascript-obfuscator options in obfuscator.js, my preset is nice, but very slow.
Compile your javascript payload:
⚠️ AVOID USAGE OF PAYLOADS BIGGER THAN 3 MiB (see FAQ)
yarn build -p /path/to/payload -n file.exe -t "application/octet-stream" -c -a -d 3000Get your payload from dist/payload.esm.js or dist/payload.umd.js. After that, it may be inserted into your page and called with download() (or custom specified with -f flag) function.
payload.esm.jsis used inimport { download } from 'payload.esm';imports (ECMAScript standart).
payload.umd.jsis used in html script SRC andrequire('payload.umd');imports (CommonJS, AMD and pure html).
A full example may be found here.
Import created script to html file (or insert it inline):
Call download() function from body:
Some phishy button
Happy phishing :)
A full example may be found here.
Import created script to vue file:
Call download() function:
Some phishy button
Happy phishing :)
Q: I have an error RangeError: Maximum call stack size exceeded, how to solve it?
A: This issue described here. To fix it, try to disable splitStrings in obfuscator.js or make smaller payload (it's recommended to use up to 2 MB payloads because of this issue).
Q: Why does my payload build so long?
A: The bigger payload you use, the longer it takes to create a JS file. To decrease time of build, try to disable splitStrings in obfuscator.js. Below is a table with estimated build times using default obfuscator.js.
| Payload size | Build time |
|---|---|
| 525 KB | 53 s |
| 1.25 MB | 8 m |
| 3.59 MB | 25 m |
No open issues yet, or sync has not completed.