A foundation of code that allows for an Arduino Micro Bad USB to be defused for development purposes.
This was developed for an Arduino Micro. Arduino IDE or a Serial Connection to the Arduino is required for defusal.
Open Arduino IDE or setup a serial session for the Arduino, DO NOT CONNECT THE ARDUINO LOADED WITH A PAYLOAD UNTIL A SERIAL SESSION IS ESTABLISHED. To do this in the Arduino IDE application:
- Select the Arduino Micro device
- Select the Serial Monitor icon:
- Select the "Serial Monitor" tab
- There should be a yellow banner presented that displays: "Not connected. Select a board and port to connect automatically"
- Connect the Bad USB
- To defuse the Bad USB before execution, type "d" into the "Message" line and press enter. You have 5 seconds before the payload executes.
Code to be executed should be placed into the codeExecution() function. It currently uses a hello world function as a placeholder.
void codeExecution (){
// Code to execute goes here:
Keyboard.begin();
Keyboard.print("Hello world");
Keyboard.end();
}