1

I got a giant foam enter key gadget with USB as a gift (search for "Big Enter" if you want to see what gadget I mean). My guess is that it will likely just be a keyboard where only the enter key is connected. As I don't trust these gadgets and I want to improve my knowledge about Linux devices and drivers, I was wondering how I could prevent this possible rubber ducky from issuing arbitrary key commands. I want to limit the allowed key presses to "Enter" only for all devices connected to a certain USB port on my system.

Would I need a custom kernel driver for this or are there other ways? systemctl or something?

Thanks for your advice :)

dfsg76
  • 504
  • 1
  • 6
  • 22

1 Answers1

1

From a USB perspective this is a HID device (Human Interface Device). What you can do is run dmesg after connecting the device to see which driver it loads. You can also run lsusb -v to get its vendor and product ID and many other informations

Very likely it loads a USB HID driver then you can run usbhid-dump to get the reports and descriptors it sends. From these descriptors can be read the device functionality

https://www.systutorials.com/docs/linux/man/8-usbhid-dump/

https://www.kernel.org/doc/html/latest/usb/gadget_hid.html

For more advanced stuff see How to capture raw HID input on linux?

If you know what the device does you can disable keys like in https://unix.stackexchange.com/questions/566398/disable-a-specific-key-on-a-specific-keyboard

https://unix.stackexchange.com/questions/60078/find-out-which-modules-are-associated-with-a-usb-device

ralf htp
  • 9,149
  • 4
  • 22
  • 34