Skip to main content

Keystroke Injection via USB

ATtiny 85 microcontroller​

Environment setup on Kali and "Hello World"​

  1. Download the Arduino IDE and install the dependecies.
sudo apt-get install libusb-0.1-4
  1. Extract and install.
./install.sh
./arduino
  1. Go to Preferences > Additional Boards Manager URLs and paste http://digistump.com/package_digistump_index.json.

  2. Go to Tools > Board > Board Manager and search for Digistump AVR and install the latest version.

  3. Copy this script.

#include "DigiKeyboard.h"
void setup() {
//empty
}
void loop() {
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(500);
DigiKeyboard.print("Hello World");
for(;;){ /*empty*/ }
}
  1. Click on Upload and plug the USB device.

Change the product ID (PID) and the vendor ID (VID)​

  1. Check the VID:PID .
lsusb
  1. Edit the configuration file (example 06ab:0107).
nano /root/.arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbconfig.h
#define USB_CFG_VENDOR_ID 0xab, 0x06
#define USB_CFG_DEVICE_ID 0x07, 0x01

Rubber Ducky​

  1. Installation.
cd /opt
git clone https://github.com/hak5darren/USB-Rubber-Ducky
cd USB-Rubber-Ducky/
  1. Test hello world script.
REM Hello World
DELAY 1000
STRING Hello world
  1. Load the script.
java -jar duckencoder.jar  -i /path/to/hello_world.duckyscript -o /media/root/A87B-A154/inject.bin
  1. Unplug the device.
umount /media/root/A87B-A154