What is preventing private keys from being transferred via the USB cable?

If all my firmware is legit but my PC has the right malware, could the private keys theoretically be extracted?

If not, why not?