Creating a USB rubber ducky from a Digispark Attiny 85

by | Nov 25, 2022 | Tech Articles

Step One – Install Digispark drivers

Step Two – Download and install the Arduino IDE

Step Three – Configure Arduino IDE for the Digispark

  • Add the Digispark board manager index within the Arduino IDE by navigating to:
    • File > Preferences > Additional boards manager URLs
    • Paste: http://digistump.com/package_digistump_index.json
    • Click OK
  • Install the Digispark boards within the Arduino IDE by navigating to:
    • Tools > Boards > Board Manager
    • Filter for and select Digistump AVR Boards by Digistump and click install
  • Set Digispark as default within the Arduino IDE by navigating to and selecting:
    • Tools > Boards > Digistump AVR Board > Digispark (Default – 16.5mhz)

Step Four – Create your first Rubber Ducky script

  • Create a new sketch with File > New sketch
  • Paste the following code:

#include “DigiKeyboard.h”
void setup() {
  // No setup scripting is required, but this function is needed
}
void loop() {
  // This is generally not necessary but with some older systems it seems to
  // prevent missing the first character after a delay:
  DigiKeyboard.sendKeyStroke(0);
  // Open a command prompt
  DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
  DigiKeyboard.delay(500);
  DigiKeyboard.println(“cmd”);
  DigiKeyboard.delay(500);
  // Execute the following function in a command prompt
  DigiKeyboard.println(“echo Pwned by Redacted Information Security”);
  DigiKeyboard.delay(500);
  // Blink the red LED when the code has finished executing
  while (true)
  {
    digitalWrite(0, HIGH);
    digitalWrite(1, HIGH);
    delay(300);
    digitalWrite(0, LOW);
    digitalWrite(1, LOW);
    delay(300);
  }
}

 

  • Click on ‘Verify’ (the tick icon) to ensure that the code will work.
  • Click on ‘Upload’ (the arrow icon) and plug in the Digispark when invited to
  • Once the code has uploaded, you’re done! Have fun playing with the code 🙂

Simon

An experienced cybersecurity professional and capable leader with a passion for penetration testing, program development, and mentoring. With skills ranging from operations planning to physical surveillance, it's Simon's goal to contribute to Australia's growing cybersecurity industry.