Universal Keyboard Emulator USB Rubber Ducky

Tomas Savenas
Mac O’Clock
Published in
2 min readMay 3, 2020

--

I want to share my experience on how to create and upload a payload to Rubber Ducky on the macOS terminal. Also how I flashed the USB Rubber Ducky firmware to work with macOS, Linux, and Windows machines.

Prerequisites

We need a HomeBrew package manager to install a DFU programmer and Java Open JDK.

Using Java application, we will compile a payload.

DFU programmer is required to flash Rubber Ducky to simulate Apple Keyboard on your macOS. If you didn’t flash the firmware, you would see the Keyboard Setup Assistant window.

brew install dfu-programmer
brew install java
echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.zshrc

Flash Rubber Ducky

Flash USB-Rubber-Ducky with different firmware that changes vendor ID and machines will think it’s apple keyboard. insert rubber ducky in USB

check rubber ducky id

system_profiler SPUSBDataType

Eject rubber ducky dismount from the plastic case. To flash, you need to go to DFU mode. This how to do it.
Now you need to hold down the little button and put it into USB at the same.

git clone https://github.com/hak5darren/USB-Rubber-Ducky
dfu-programmer at32uc3b1256 erase
dfu-programmer at32uc3b1256 flash --suppress-bootloader-mem USB-Rubber-Ducky/Firmware/Images/osx.hex
dfu-programmer at32uc3b1256 reset

To edit file I am using nano command below.

nano payload.txt

I am using this payload. it will work on Linux, macOS, and Windows

DELAY 1000
ALT F2
DELAY 50
GUI SPACE
DELAY 50
GUI r
DELAY 50
BACKSPACE
DELAY 100
STRING https://savenas.lt
DELAY 500
ENTER

Next need to compile into inject.bin the file

cd USB-Rubber-Ducky
java -jar duckencoder.jar -i payload.txt

We need to move into the SD card. in my case, it’s named Untitled :)

cp inject.bin /Volumes/UNTITLED/

Then eject the SD card and put it into rubber ducky.

Check rubber ducky id

system_profiler SPUSBDataType

Reference

#1 https://github.com/hak5darren/USB-Rubber-Ducky

--

--

Tomas Savenas
Mac O’Clock

Kibernetinio saugumo entuziastas; Aktyviausias Lietuvis TryHackMe platformoje; Inovacijų valdymo ir Antreprenerystės Magistrantas @ KTU