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!
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!