A USB rubber ducky is a USB device that looks like a normal USB thumb drive with the exception that it can be used to send HID commands to a computer just like a keyboard and mouse do. You can purchase a commercial Keystroke Injection Attack Platform or USB rubber ducky from the HakShop or you could make your own DIY USB Rubber Ducky with an Arduino.
There are a number of Arduinos that supports HID commands. The Leonardo or the Pro Micro, for instance, are centered around an ATmega32U4. The 32U4 comes with a full-speed USB transceiver interface, allowing the Pro Micro/Leonardo to be programmed to emulate any USB device. In simple terms, you can program the Pro Micro/Leonardo to act just like a mouse, keyboard or other HID-class USB device. There are even libraries available from the Arduino website that allows the 32U4 Arduinos to appear as a native Mouse and/or Keyboard to a connected computer.
Arduino Pro Micro; ~£3 from eBay
USB Type A surface mount connector
MICRO USB MALE TO USB Female OTG Adapter
Small Toggle Switch
The toggle switch is to be used to put the Arduino into the HID mode. If the Mouse or Keyboard library is constantly running, it will be difficult to program your board, so the switch toggles the board into idle mode and thus allows it to be programmed.
10k Resistor & misc wires
Putting it all together
To assemble the USB dongle, we picked a small USB case but this proved difficult to squeeze all the components inside it.
Normal USB type A to micro USB male adapter was also found to be too big, so we decided to solder a surface mount USB Type A connector to a OTG adapter and glued the plastic parts together. The results look as follows:
The micro toggle switch was glued at the back of the case and an opening was cut in the case to allow the switch to be toggled.
To finish up the USB rubber ducky, connect the USB adapter to the Pro Micro and fit it in the case. A 10k resistor is soldered between the Pro Micro ground to the Digital Pin 8. Solder a wire between Pin 8 and the common connection of the switch. Connect the 5V pin of the Pro Micro to another pin of the switch. The resulting finish is as follows:
And with the case closed:
Programming your DIY USB Rubber Ducky
To get started, toggle your switch to the “off” position. Then plug it your computer. Upload the following code onto the board using the Arduino environment.
Once uploaded, unplug the USB and toggle the switch to the “on” position. Plug it back in. The above code will open Notepad in Admin mode and type some text. See the following video for a quick demo.
We would like to point out that information provided here are for educational purposes. USB rubber ducky is used to automate task but can also be used unethically to deploy viruses and trojan. We are not responsible for misuse of information provided here.
Thanks for reading. Contact us at email@example.com for comments or questions.