Why you should change the USB IDs
You can make the Digispark appear as any USB device by setting the USB IDs to a custom value, and I'll show you how. But first, why would you?
It's particularly useful for BadUSB pentests where you don't want it to appear as a Digispark but as a generic USB Keyboard or an Apple device so that macOS doesn't open the keyboard setup assistant. You might also require a USB device with a particular vendor or device ID for testing and developing products.
Whatever your reasons are, you can spoof the IDs to anything you want. Websites like devicehuhnt.com have a database that you can search for registered USB devices.
In the tutorial below, I will make the Digispark appear as an Apple keyboard so that it can be used for BadUSB attacks on macOS. But you are free to change the values to whatever you like.
How to do it
You have to edit the USB Product ID (PID) and Vendor ID (VID) deep in the Arduino Digispark files.
- In Arduino, open File > Preferences
- Click on the Path at the bottom (it's a shortcut)
- Open packages > digistump > hardware > avr > 1.7.5 (or other version number) > libraries > DigiKeyboard
- Make a copy of usbconfig.h and call it usbconfig_BACKUP.h in case you need to undo the changes
- Open usbconfig.h in a text editor
- Replace lines as explained below
You can download an already modified usbconfig.h here to save you time. Otherwise, continue below.
To set 05AC as USB VID (Apple), replace
#define USB_CFG_VENDOR_ID 0xc0, 0x16 with
To use 0250 as USB PID (Apple Aluminium Keyboard with ISO layout), replace
#define USB_CFG_DEVICE_ID 0xdb, 0x28 with
To set the vendor name to Apple, replace
#define USB_CFG_VENDOR_NAME 'd','i','g','i','s','t','u','m','p','.','c','o','m' with
#define USB_CFG_VENDOR_NAME_LEN 13 with
To set the device name to Keyboard, replace
#define USB_CFG_DEVICE_NAME 'D','i','g','i','K','e','y' with
#define USB_CFG_DEVICE_NAME_LEN 7 with
Learn more about BadUSBs
The Digispark is a great beginner tool for learning about BadUSB. You can find other articles on the topic here in our BadUSB series: blog.spacehuhn.com/series/badusb
And you're invited to join my beginner-friendly online course about BadUSB Hacking: learnbadusb.com