Making a $2 BadUSB (USB Rubber Ducky)

Search for a command to run...

No comments yet. Be the first to comment.
During in the process of reverse engineering binaries, a common problem arises. How do I reverse engineer stripped binaries? There are no symbols to break on, offsets change, scripts don't work, and you ask yourself why am I doing this? Luckily there...

When I was learning how to tackle pwn challenges in CTFs, I had a tough time finding a single, clear guide that could show me the ropes of actually carrying out these exploits. That's why I decided to put together a complete guide that covers everyth...

Using python to capture and project data

Intro This is a write-up for PicoCTF 2022: Buffer Overflow 1. This is one of my favourite challenges to do. I recommend solving it for yourself before you read this write-up. What is a Buffer Overflow? Before we get started we need to first know what...

A BadUSB is a USB device that acts as a keyboard and injects preprogrammed keystrokes into a computer. A BadUSB is Indistinguishable from a generic keyboard, making it near impossible to detect and patch. You can setup reverse shells, change the desktop background or change settings. The opportunities are limitless.
Depending on where you get a BadUSB from; you can expect a range of prices between $2 to $45.
The Hak5 USB Rubber Ducky costs around $45.

Where are ATMEGA32U4 cost around $30 from Amazon.
If you get an ATTINY85 Arduino board you can expect around $2-10. This board is the one I recommend for beginners. You can get it anywhere from platforms like eBay, Alibaba or AliExpress. One thing to note about this board is that it has a 5-second delay before inputting keystrokes. This is due to it checking if it needs to be written to.

This tutorial is for an ATTINY85. This is due to its cheapness and availability. You will need the following:
Download and install the Arduino IDE.
You are required to download Digispark drivers if your Arduino version is Arduino 1.6.6 or higher.
Unzip and install the file DPInst64.exe
Open up the Arduino IDE
Open up Files ---> Preferences
Add the below text to the "Additional Boards Managers URLs:"
http://digistump.com/package_digistump_index.json

Open up Tools ---> Board ---> Board Manager

Search up Digispark and click on the install button.

If you don't want to create any of your own scripts, their is a whole github reposistory dedicated to premade scripts. You can find it here.
If you want to create an scripts, I recommend using Ducky Script and then converting it to Arduino code using d4n5h's Ducky to Arduino converter. It is far simpler then writing it directly in Arduino code. You can find the syntax of Ducky script here.
Below is an example of converting Ducky Script to Arduino code.
Note: There is a problem with the converter where DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT, KEY_R); should be DigiKeyboard.sendKeyStroke(MOD_GUI_LEFT, KEY_R)
Click on the upload button.
When the console says "plug in the device now", insert your ATTINY85 into your USB port.

I hope you enjoyed this article about the ATTINY85. If you have any questions you can always leave a comment below or feel free to reach out to me on Twitter at @dingo418.
$1 BadUSB - DigiSpark Drive By HID Tutorial
Run USB Rubber Ducky Scripts on a Super Inexpensive Digispark Board