Skip to main content
BlackUSB is an experimental script that prevents theft of personal data, malware, forensic tools, and BadUSB attacks (USB Rubber Ducky). It generates a whitelist of USB/HID devices and blocks any unauthorized insertion of unknown devices.
Experimental Status: BlackUSB is marked as frozen. Use at your own risk and test thoroughly before deploying in production environments.

Platform Support

BlackUSB is available for both Linux and Windows operating systems with different implementations:

Linux Version

A bash script that generates a whitelist of USB/HID devices and blocks unauthorized devices using udev rules.

Installation

Command Reference

Usage Examples

1

Show connected devices

Display all currently connected USB devices:
Example output:
2

Enable protection

Activate BlackUSB and create a whitelist of currently connected devices:
3

Manage devices

Eject a device or add to whitelist:

Paranoic Mode

By default, BlackUSB locks the terminal when an unauthorized device is detected. Paranoic mode powers off the system instead.To enable, edit the script and uncomment:
Paranoic Mode: Enabling this will immediately shut down your system when an unauthorized USB device is inserted. Use with extreme caution.

Logs

All BlackUSB events are logged to:
Example log entry:

Dependencies

  • bash
  • udev

Credits

BlackUSB is forked from:

Use Cases

  • Data Theft Prevention: Block unauthorized USB drives from being used to steal sensitive data
  • BadUSB Protection: Prevent USB Rubber Ducky and similar HID attack devices
  • Malware Prevention: Stop malware propagation through infected USB devices
  • Forensic Tool Defense: Block unauthorized forensic tools from accessing the system
  • Compliance: Enforce USB device policies in regulated environments

License

BlackUSB is licensed under:
  • GPL-3.0
  • CC BY-SA 4.0

Disclaimer

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.