AI prompts
base on "Bob the Smuggler": A tool that leverages HTML Smuggling Attack and allows you to create HTML files with embedded 7z/zip archives. The tool would compress your binary (EXE/DLL) into 7z/zip file format, then XOR encrypt the archive and then hides inside PNG/GIF image file format (Image Polyglots). # BobTheSmuggler
![](images/bob.png)
## Quick Update
_Jan 15th, 2024 - **Support for multi-file compression has been added**. If you have multiple files generated for your final payload (e.g., DLL-Sideloading files or multi-stage delivery files), you can now use the '-i' option to specify the directory path. If a directory path is provided, BobTheSmuggler will automatically archive all the files in that directory, XOR encrypt the archive, and embed it inside PNG/GIF._
## Project Description
Check out my blog to get a thorough understanding of how to use this tool: [BobTheSmuggler: Your Covert Cyber Swiss Knife for Undetectable Payload Delivery](https://medium.com/@TheCyb3rAlpha/bobthesmuggler-your-covert-cyber-swiss-knife-for-undetectable-payload-delivery-bc84f3037522).
**"Bob the Smuggler"** is a tool that leverages HTML Smuggling Attack and allows you to create HTML files with embedded 7z/zip archives. The tool would compress your binary (EXE/DLL) into 7z/zip file format, then XOR encrypt the archive and then hides inside PNG/GIF image file format (Image Polyglots). The JavaScript embedded within the HTML will download the PNG/GIF file and store it in the cache. Following this, the JavaScript will extract the data embedded in the PNG/GIF, assemble it, perform XOR decryption, and then store it as an in-memory blob.
![](https://www.plantuml.com/plantuml/dpng/bP7BRzf04CRl_YkcbygSE5O2LQKonhIYJSGZoe7BuXt3IlkmPjSGyzTdRCSAIW0f5qlU-RxVFBw93u92PNJqBHpG81WHa9I8slSe6YqnHtL4I5ymhuBOQOIPua-SFgV3wM8n6BCeSQOaz1w-GsfpgilGYhOs_d4UdbK99nKEK0hlJuvaOr45n2rdveXRmazu_9yDW6Um4DVe1n70A3Kxb3qHPTTOsKRAw8rNTW-hW7jXtPv4UQYPZDhZPtZsPtQNoFKl4bTFsLqYrplhH-Dy_My1Zk21TwNRYAaYp8EkcTLQjfOzSs6bnixwHlJSnKfLS0ePMYGH4FwAerZbf3Y6nCac1jPoWe547fIp7DDlxz7iTDrdaLG-EDCDjqPJweQpyIX_NGtbiWKFUCtTRs_TJTiK2r7fqFg6VB0BRxzJGiZ_V18hzBkkkT2Ogyr3Twub2bb3uOYXMXsHQgxpK6KqOLHbz2i0)
This tool currently support the following payload Delivery Chains:
- .EXE/.DLL --> .7z/.Zip (Password Protected) --> .JS --> .HTML
- .EXE/.DLL --> .7z/.Zip (Password Protected) --> .JS --> .SVG --> .HTML
- .EXE/.DLL --> .7z/.Zip (Password Protected) --> .PNG/.GIF --> .JS --> .HTML
- .EXE/.DLL --> .7z/.Zip (Password Protected) --> .PNG/.GIF --> JS --> .SVG --> .HTML
## Key Features
- **Stealthy File Concealment:** Embed any file type (EXE/DLL) securely within HTML pages, PNG, GIF, and SVG files, ensuring the data remains hidden in plain sight.
- **Versatile Embedding:** Offers the flexibility to embed files in various formats, catering to diverse needs and scenarios.
- **Advanced Obfuscation:** Utilizes sophisticated techniques to obfuscate the embedded data, further enhancing security and reducing detectability.
- **Custom Template Support:** Allows the use of custom HTML and SVG templates for embedding, providing personalized and context-specific concealment.
- **Intuitive Interface:** Features an easy-to-use command-line interface, making it accessible for both technical and non-technical users.
- **Visual Validation:** Includes visualization tools for PNG files, offering users a way to confirm the successful embedding of data.
## Pre-requisites
Before running the tool, you need the following pre-requisites:
```
pip install python-magic py7zr pyminizip
```
**Note:** To install python-magic, you would need to install the libmagic library on your system. Follow this URL to install the libmagic library: https://pypi.org/project/python-magic/
## Installation
Once the required libraries are installed, you can proceed with the installation of the tool using the following commands:
```
git clone https://github.com/TheCyb3rAlpha/BobTheSmuggler.git
cd BobTheSmuggler
```
## Usage
Once installed, you can use the tool by executing the following command:
```
python3 BobTheSmuggler.py -h
```
![Usage](images/usage.png "usage")
```
======================================================================
██████╗ ██████╗ ██████╗ ████████╗██╗ ██╗███████╗
██╔══██╗██╔═══██╗██╔══██╗ ╚══██╔══╝██║ ██║██╔════╝
██████╔╝██║ ██║██████╔╝ ██║ ███████║█████╗
██╔══██╗██║ ██║██╔══██╗ ██║ ██╔══██║██╔══╝
██████╔╝╚██████╔╝██████╔╝ ██║ ██║ ██║███████╗
╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝
███████╗███╗ ███╗██╗ ██╗ ██████╗ ██████╗ ██╗ ███████╗██████╗
██╔════╝████╗ ████║██║ ██║██╔════╝ ██╔════╝ ██║ ██╔════╝██╔══██╗
███████╗██╔████╔██║██║ ██║██║ ███╗██║ ███╗██║ █████╗ ██████╔╝
╚════██║██║╚██╔╝██║██║ ██║██║ ██║██║ ██║██║ ██╔══╝ ██╔══██╗
███████║██║ ╚═╝ ██║╚██████╔╝╚██████╔╝╚██████╔╝███████╗███████╗██║ ██║
╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝
======================================================================
usage: BobTheSmuggler.py [-h] -i EXE_FILE [-p PASSWORD] -f OUTPUT_HTML -o OUTPUT_FILENAME -t {html,svg,png,gif} [-c {7z,zip}] [-u PNG_URL] [-png PNG_FILE] [-gif GIF_FILE] [-e CUSTOM_FILE] [-v]
Hides EXE/DLL file inside an HTML/SVG file.
optional arguments:
-h, --help show this help message and exit
-i EXE_FILE Path to the EXE/DLL file.
-p PASSWORD Password for compression.
-f OUTPUT_HTML HTML Smuggled file (.html)
-o OUTPUT_FILENAME Downloaded file name (Your payload is in this file.)
-t {html,svg,png,gif} Type of embedded template.
-c {7z,zip} Compression format: 7z or zip (default: zip)
-u PNG_URL URL for the embedded PNG image.
-png PNG_FILE Path to the PNG file for embedding EXE/DLL.
-gif GIF_FILE Path to the GIF file for embedding EXE/DLL.
-e CUSTOM_FILE HTML file to clone as template.
-v, --verbose Enable verbose logging.
```
## Examples
If you want to compress SharpHound.exe into 7z format (password protected) and store it in a HTML file, you can use the following command:
```
python3 BobTheSmuggler.py -i path/to/SharpHound.exe -p 123456 -c 7z -f SharpHound.html -o SharpHound.7z -t html
```
![bts_html](images/bts_html.png "HTML Creation")
### Embed payload inside PNG File:
To create an HTML file with the embedded payload hidden inside PNG file, you can use the following command:
```
python3 BobTheSmuggler.py -i <Input_file_path> -p <password_to_encrypt> -f <output_HTML_filename> -o <Output 7z/zip filename stored inside HTML> -t png test.png
```
![bts_png](images/bts_png.png "PNG Creation")
**NOTE:** Make sure you host the PNG/GIF files on a CDN. (Recommended: You should use the -u option to provide the CDN URL where you'll host the PNG/GIF file). For testing purpose, you can use the flask app (app.py) which would host banner.gif and banner.png on localhost:8000
Similarly, you can use the following command to create an HTML file with the embedded payload hidden inside GIF file:
### Embed payload inside GIF File:
```
python3 BobTheSmuggler.py -i <Input_file_path> -p <password_to_encrypt> -f <output_HTML_filename> -o <Output 7z/zip filename stored inside HTML> -t gif test.gif
```
![bts_gif](images/bts_gif.png "GIF Creation")
Once the final image (PNG/GIF) is generated, the size of the image will increase because it will contain your embedded file.
![](images/bts_image.png)
### .EXE/.DLL --> .7z --> .PNG --> .SVG --> .HTML Chain:
A simple chain with a different approach. Your EXE/DLL gets compressed to .7z/.zip file, then it gets stored inside a PNG/GIF file. The PNG/GIF gets called by the JS inside the SVG file which is embedded inside HTML. Once the JS is called, it downloads PNG/ZIP file, extracts XOR'd compressed data from the image chunks, decrypts the file and invokes the download functionality.
```
python3 BobTheSmuggler.py -i <Input_file_path> -p <password_to_encrypt> -f <output_HTML_filename> -o <Output 7z/zip filename stored inside HTML> -t svg -e <Custom_SVG_Template>
```
The Following Templates have been added to this project:
- **OneDrive Download HTML Template (Used by BumbleBee malware delivery mechanism)**
- **Paypal Fake Invoice SVG Template (Used for callback phishing)**
![](images/bts_templates.png)
## Disclaimer
This tool is intended solely for educational purposes. Users are advised to utilize it only in a manner that promotes learning and understanding. The author of this tool explicitly disclaims any liability for its use beyond educational contexts. Users choosing to employ this tool for purposes other than education do so at their own risk and responsibility, and the author shall not be held accountable for any consequences arising from such use.
", Assign "at most 3 tags" to the expected json: {"id":"6918","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"