ESP32-S3 BadUSB Proof-of-Concept
A proof-of-concept BadUSB project using the ESP32-S3 DevKitC. It demonstrates HID (Human Interface Device) emulation, keystroke injection, and custom payload deployment for security research, red teaming, and penetration testing.
This project includes a web-based control panel for the ESP32-S3 BadUSB, enabling users to upload, edit, and execute BadUSB scripts directly from a browser over WiFi.
CLICK TO EXPAND
This repository does not include or redistribute Hak5’s DuckyScript language files or any other copyrighted Hak5 content. The language files referenced in this project are owned by Hak5 LLC and are subject to copyright and trademark protections.For those who wish to use the official language files, please visit the official Hak5 repository: Hak5 DuckyScript Languages . You ned to put the languages folder inside of the SD card.
IF THE URL IS DOWN, GO TO: Waybackmachine
This project is intended solely for educational purposes, experimentation, and authorized security testing where permitted by local laws. It is not affiliated with, endorsed by, or sponsored by Hak5 LLC. Users are responsible for ensuring that their use of this project and any related tools complies with all applicable local, national, and international laws. By referencing Hak5’s resources rather than including them, this repository respects copyright and trademark protections and encourages users to obtain any original files directly from Hak5. USB Rubber Ducky and DuckyScript are the trademarks of Hak5 LLC. If Hak5 LLC at any time determines that this reference to their DuckyScript language files or any related content is inappropriate, unauthorized, or otherwise requires removal, this repository will promptly comply with their request and remove the reference immediately, without contest or delay, in order to respect their intellectual property rights and legal requirements.
-
Board: ESP32-S3 DevKitC-1 (N16R8)
-
SD Card Interface: SPI
| SD Card Pin | ESP32-S3 DevKitC-1 Pin |
|---|---|
3V3 |
3V3 |
GND |
GND |
CS (SS) |
GPIO10 |
MOSI |
GPIO11 |
MISO |
GPIO13 |
CLK |
GPIO12 |
✅ Working as expected
⏳ Planned
❌ Not implemented yet, but planned
| # | Feature / Example | Status |
|---|---|---|
| 1 | Basic Key Combinations (press multiple keys simultaneously) |
✅ |
| 2 | Strings & Variables (store and manipulate text) |
✅ |
| 3 | WiFi Detection (detect available wireless networks and run commands based of "is the wifi there or not") |
✅ |
| 4 | LED Control (turn LEDs on/off) |
✅ |
| 5 | Raw Keycodes (send specific key signals) |
✅ |
| 6 | SD Card Detection (detect SD card status) |
✅ |
| 7 | Uploading files (add non-text files) |
✅ |
| 19 | Noisy OS Detection (detect operating system) |
⏳ |
| 8 | Function Variables (store values for functions) |
⏳ |
| 9 | Repeat / Replay Commands (repeat key sequences) |
⏳ |
| 10 | Custom Fonts WebGUI (use fonts from SD) |
⏳ |
| 11 | Math Operations (perform calculations) |
❌ |
| 12 | Blocks (visual programming blocks) |
❌ |
| 13 | Hold Keys (hold keys across time intervals) |
❌ |
| 14 | Rower Payloads (run multiple scripts sequentially) |
❌ |
| 15 | Boolean Variables (store true or false) |
❌ |
| 16 | Syntax Error Highlight (show errors in editor) |
❌ |
| 17 | Customisation WebGUI (adjust GUI settings) |
❌ |
| 18 | Expose SD Card over USB (show/hide SD card access) |
❌ |
| 20 | Keylog Addon (record keystrokes) |
❌ |
| 21 | Connecting to WiFi (establish wireless connection) |
❌ |
| 22 | Web Actions (perform tasks using WiFi) |
❌ |
| 23 | Pasting/Cutting/Copying files from the SD card to the PC. | ❌ |
| 24 | Disabling USB Function on boot and only draw power | ❌ |
| 25 | Mouse functionality | ❌ |
| 26 | Silent OS Detection | ❌ |
| 27 | HID over Bluetooth | ❌ |
| 28 | Starting the script when someone connects/disconnects to the ESP(involving Bluetooth, WiFi) | ❌ |
| 29 | Able to turn on/off Bluetooth/WiFi | ❌ |
| 30 | Able to turn on/off Bluetooth/WiFi when an WiFi was detected | ❌ |
| 31 | Chaining Commands together, making them work in universal conditions | ❌ |
| 32 | While/For loops | ❌ |
| 33 | Advanced scripting EXAMPLE | ❌ |
/languages (inside of sd card, containing all Language files, You need to find the Language files yourself. Putting them here in the repository would get me into legal trouble. You need to create them yourself)
en.json
de.json
/DESIGNS (inside of the sd card, containing the /CSS, /JSS, and /FONTS folders. You need to create them yourself)
.....
index.html (inside of the sd card, containing the Website. Copy/Paste the index.html
index.html→ main frontend (UI for writing & executing scripts)syntaxes.json→ list of all available commands (STRING,DELAY,REPEAT, etc.) with description + examplesmain.cpp(firmware) → ESP32 BadUSB logicREADME.md→ project documentation (this file)- Folder for payloads
/payloads✅ - Folder for Fonts
/FONTS✅ (not working correctly tho) - Folder for custom Designs / Items such as CSS, JS, HTML.
/items /languages(inside of sd card, containing all files) ✅config.json(inside of the Root of the SD card. Main config for WiFi hosting, password etc etc....)/uploadsFor saving uploaded files ✅
If you want to help me, contact me on Discord and send me your code suggestions: sniper74
- Basic key press & combinations (Win+R, Alt+Tab, etc.)
- String typing
- Script management (save, delete, execute via UI)
- WiFi AP hosting and WebUI
- To see the incomplete structure, go to : Wiki
- Integrate an
syntaxes.jsonto integrate all commands - Define full JSON schema for supported commands
- Add status indicators in UI for working / not working features
- Gradually implement missing features
- Adding Customisation and Designing
- Flash firmware onto ESP32-S3
- Move the
index.htmlto the SD Card - Connect the SD Card with the Pins to the ESP (DO IT WHILE THE POWER IS OFF)
- Connect to WiFi AP
- Open
192.168.4.1in your browser - Upload and run scripts from the WebUI
This project is for educational and testing purposes only.
Do not use it to conduct illegal, harmful, or malicious activities.
I am not responsible for any misuse of the information or code provided.
I am not responsible for any bodily injury that occurs while soldering, handling tools, or connecting wires.
Follow standard safety procedures (eye protection, ventilation, insulated tools) when working with electronics.
If you are unsure about a procedure, stop and seek help from a qualified person.
Do not attempt high-voltage, medical, or otherwise hazardous experiments without professional supervision.
Always disconnect power sources before making wiring changes or adjustments.
Test circuits with appropriate measurement tools and verify voltages before touching components.
Use correct-rated components and fuses — substituting parts may create fire or shock risks.
Keep liquids away from electronics and work on a non-conductive surface.
Keep small parts and tools away from children and pets.
Do NOT eat any components or materials.
Do NOT cut open batteries, capacitors, or sealed components.
Do NOT pour water or any liquids on the device or circuit.
This project is provided as-is with no warranty, express or implied.
I make no guarantees about the accuracy, safety, or suitability of the instructions for your situation.
You are responsible for ensuring compliance with local laws, regulations, and safety codes.
Any modifications you make are at your own risk; back up important data before experimenting.
If a step seems unclear or risky, consult official documentation, contact me, or an expert before proceeding.
By using this project you accept full responsibility for results and consequences.
If you plan to publish or share derived work, attribute appropriately and avoid distributing instructions that enable harm.
For medical or life-critical applications, consult licensed professionals, do not rely on hobby projects.
