2

This question already has an answer here:

In this case, the victims may think they are using a generic USB cable, but the PC will recognize the cable as a Human Interface Device, much like it would a mouse or keyboard, giving the attacker just enough permissions to wreak havoc inside the system. This is different from all the other variations as this threat is much trickier to address with awareness practices.

https://www.bleepingcomputer.com/news/security/usbharpoon-is-a-badusb-attack-with-a-twist/

https://www.tomshardware.com/news/malicious-usb-cables-wi-fi-controller,38603.html

marked as duplicate by Filopn, Community Apr 3 at 10:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Depends on your OS.

If you're on Windows you can use Penteract Disguised-Keyboard Detector which will lock the screen when it detects any HID.

If you're on Linux, I think there exists software that whitelists or blacklists USB devices, therefore avoiding the need for awareness.

Not the answer you're looking for? Browse other questions tagged or ask your own question.