I found this which claims to block these attacks: https://www.gdatasoftware.com/antivirus-windows
> USB Keyboard Guard
> Protects you against manipulated USB devices that pretend to be keyboards, even though they look like USB sticks or external hard drives.