Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What data can a HID device receive?

Tags:

keyboard

hid

I am designing a USB keyboard with special capabilities. What information can such a HID device receive from the host?

Can I via USB:

  • Read data from a form on the screen?
  • Find out what OS the user is on?
  • Find out if there's been an error message?
  • Even 'know' what's going on visually on the screen, i.e. what program is selected or whether the program is windowed or fullscreen?

Thank you!

like image 499
sscirrus Avatar asked May 13 '15 07:05

sscirrus


People also ask

What do HID compliant devices do?

Universal Serial Bus devices are used to connect various components to a computer. A HID (Human Interface Device) compliant USB follows a specific protocol for communication that allows it to be used with virtually any system.

What is the difference between HID and USB?

As for the difference between HID and USB serial, serial is bulk while HID is control and interrupt. That's fundamental for USB, and means HID has (potentially) lower latency but serial has higher capacity.

How does HID USB work?

The USB HID class keyboard is normally designed with an IN endpoint that communicates keystrokes to the computer and an OUT endpoint that communicates the status of the keyboard's LEDs from the computer to the keyboard.

What are HID attacks?

The HID attack is a scenario in which an attacker takes a programmable embedded development platform such as the Teensy 3.2 (pictured above), and an associated software package such as Peensy or the Social Engineering Toolkit (SET) and creates a USB device which when plugged into a computer will execute a pre- ...


2 Answers

The device can't get any of this information from a standard driver that the operating system supplies because that would be a security issue. It can receive any information that your own driver or application sends it. There are many ways to communicate with it - your device could present multiple interfaces (which will appear as separate devices), multiple endpoints, or use the control channel. You will definitely need to study the spec, and I also found this tutorial helpful.

I have done something similar and used the control channel to exchange feature data with a Windows application (over the standard Windows driver). On Windows, the API calls are HidD_SetFeature() and HidD_GetFeature().

On the device side, my hardware ran embedded Linux and I used the GadgetFS library to create a user-mode driver - much easier to debug than a kernel driver.

like image 200
rhashimoto Avatar answered Sep 28 '22 12:09

rhashimoto


As others have said, you'll run into issues if you try this with a normal HID. However, there is a project called the USB Rubber Ducky. From their description:

The USB Rubber Ducky isn't your ordinary HID (Human Interface Device). 
Coupled with a powerful 60 MHz 32-bit processor and a simple scripting language

The USB Rubber Ducky looks like a usb-device and is recognized as a HID, but is programmable. You can make a small script that will be typed onto the screen which will allow you to performs the queries you seek.

With the USB Rubber Ducky you can:

  • Read data from a form on the screen? Yes

  • Find out what OS the user is on? Yes

  • Find out if there's been an error message? Yes

  • Even 'know' what's going on visually on the screen, i.e. what program is selected or whether the program is windowed or fullscreen? Yes

    If you aren't hoping to buy this device, at least their firmware is on github so it can provide you a starting point

like image 20
rogergarrison Avatar answered Sep 28 '22 12:09

rogergarrison