keystroke injection

term

hackingsecurity

Kept in this browser · My desk

An attack in which a device presents itself to a computer as a USB keyboard and types a prepared script with the logged-in user's privileges.

USB's human interface device class lets any device declare itself a keyboard, and hosts accept it without authentication; a 2018 systematization of USB attacks called this the trust-by-default nature of the ecosystem. Programmable keystroke devices appeared in 2010, with Adrian Crenshaw's Teensy-based dongle at DEF CON 18 and Hak5's USB Rubber Ducky. The FBI warned in January 2022 that the FIN7 group mailed such devices to US companies.

How it works. A boot-protocol keyboard sends eight-byte reports holding modifier bits and up to six key codes; the host translates them through the HID usage tables, so a device that sends the right codes opens a Run dialog or a terminal and types commands. What it cannot do. It acts only while plugged in, needs the target's keyboard layout and a logged-in session to do most things, and is visible on screen while it types. Variants. Tools add mass storage or network adapters (the Bash Bunny), hide inside cables (the O.MG Cable), or come from reprogrammed ordinary peripherals (BadUSB). Defences. Policy against unknown devices; macOS's accessory approval on Apple silicon laptops; Linux USB authorization through USBGuard rules; Windows device installation policies and device control, noting that blocking removable storage does not stop a keyboard; keystroke-timing checks such as Google's UKIP, which tools counter with random delays; logging of new devices (Windows event 6416). Law. In Brazil, article 154-A of the Penal Code punishes intrusion, and its paragraph 1 producing or selling a device intended to enable it.

Also known as: keystroke injection attack, HID attack, HID injection, hotplug attack, injeção de teclas

← Back to K Back to the glossary