Lion Cipher Lab

Decode a BadUSB keystroke-injection payload — then lock down USB with USBGuard

Why it matters

A USB stick can lie about what it is. Instead of a flash drive, it announces itself to the OS as a keyboard — a Human Interface Device (HID) — and 'types' commands the instant it's plugged in. This is 'BadUSB' (Rubber Ducky). It defeats every 'don't run files off a USB stick' rule, because the OS trusts keyboards implicitly: there is no 'do you allow this keyboard?' prompt. Understanding the attack by decoding a payload you wrote — and then defending with device authorization — is core endpoint-hardening judgment. It's also a clean lesson in defense-in-depth: the fix isn't blocking storage,…

What you'll learn

Steps in this lab

  1. The threat: a USB stick that pretends to be a keyboard
  2. DuckyScript: the human-readable HID-injection language
  3. Write a BENIGN demo payload
  4. Encode it to inject.bin
  5. Decode it: read inject.bin back to raw keystrokes
  6. Install USBGuard and snapshot what's already attached
  7. The fix: flip from implicit-allow to default-block
  8. Judgment: when this friction is worth it, and the Windows equivalent

Open the full interactive lab →