Change USB VID & PID on Digispark
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.
USB VID
To set 05AC as USB VID (Apple), replace #define USB_CFG_VENDOR_ID 0xc0, 0x16
with
#define USB_CFG_VENDOR_ID 0xAC, 0x05
USB PID
To use 0250 as USB PID (Apple Aluminium Keyboard with ISO layout), replace #define USB_CFG_DEVICE_ID 0xdb, 0x28
with
#define USB_CFG_DEVICE_ID 0x50, 0x02
Vendor Name
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 'A','p','p','l','e'
and replace #define USB_CFG_VENDOR_NAME_LEN 13
with
#define USB_CFG_VENDOR_NAME_LEN 5
Device Name
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 'K','e','y','b','o','a','r','d'
and replace #define USB_CFG_DEVICE_NAME_LEN 7
with
#define USB_CFG_DEVICE_NAME_LEN 8
Subscribe to my newsletter
Read articles from Stefan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Stefan
Stefan
CS student building open-source tools for fun and profit. Mostly hacking around with Arduino.