Skip to content

Seeking Guidance on Building a Custom BadUSB Protection Tool Inspired by Anti-BadUSB #1

Description

@lxlnimalxl

Hi,

Thank you for creating Anti-BadUSB! It’s a clean, cross-platform solution that effectively demonstrates how behavioral heuristics (like rapid keystrokes) can be used to detect and mitigate BadUSB-style attacks.

I’m a developer with experience in scripting and security tools, and I’d like to build my own lightweight BadUSB defense mechanism—either as a learning project or for small-scale deployment. Your implementation using pynput and timing thresholds is very helpful as a starting point.

To better understand the design choices, I’d appreciate your insight on a few points:

Detection Thresholds:
How did you arrive at the default values (e.g., 10 keypresses, 30ms window)? Were these tuned through testing against real Rubber Ducky payloads?
Evasion Considerations:
Have you observed or tested ways this detection could be bypassed (e.g., by slowing down the payload or using mouse-based injection)?
Extension Ideas:
If someone wanted to enhance this approach—say, by adding USB descriptor checks (VID/PID) or integrating with system logs—would you recommend keeping the logic in Python, or switching to a lower-level language/service?
I’m not asking for code, just high-level advice or lessons learned that could help someone build a robust, minimal detector from scratch.

Thanks again for open-sourcing this tool!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions