Protection against rogue USB devices

Hi!

A successful attack resulting in data theft is nothing else than someone exploiting a software on your system so it does things you never wanted it to do. The only way to avoid this is to hinder someone calling such function on your system.

We use IP firewalls to minimize our publically available attack surface in a desperate hope that the remaining surface doesn't expose such functions anymore.

While most people tend to know about the utter importance of IP firewalls, few know their system is also exposed to other security threats. No, this time I am not talking about UEFI, which is nothing else than a well decorated trojan horse, but about USB security.

An USB isn't the same as the good old (nearly eradicated) serial port. While the serial port requires you to start the software first, which is meant to talk to the other end of the serial cable and to plug in the cable after it, the USB will actually start the software on your computer automatically as soon as you insert the device.

Unfortunately our attack surface grows as the list of supported USB devices grows. And it does grow all the time. As a reminder: An attacker just needs to find ONE critical bug in your attack surface to break through.

Since the attack surface labeled "USB" has grown steadily, it's long time due to address it.

Fortunately, in order to successfully breach into your computer, the person needs local access to it. At first glance, this sounds like a good thing. But if you look closer, it actually doesn't make things much better in many cases. An attacker needs around 5 seconds to successfully infect a system with a rongue USB device and none of your devices will always be attended by you.

Strictly speaking, a system isn't proven uninfected anymore as soon as you have left it unattended for one time and you can't tell that no other person could have attached an USB device in the meantime. And no, a locked screensaver doesn't help anything. Everything USB-related is running in the background as root.

The safest approach to address this issue is to make the user actively approve the newly inserted device via whitelists, which glues the VID/PID of an USB device with a certain driver. The attack surface is minimized drastically that way, as most people are only attaching certain HIDs anyway.

It doesn't protect you from keyloggers secretly hidden into your keyboard tough, but that's another story.

So, after all that explainations.... what I actually wanted to ask: Is there an USB-Firewall for FreeBSD?
 
The safest approach to address this issue is to make the user actively approve the newly inserted device via whitelists, which glues the VID/PID of an USB device with a certain driver.
I'm inserting a new keyboard or mouse that has not been previously whitelisted on a system that does not currently have a mouse or keyboard attached. How do I whitelist that? Do I use the unknown device to approve the use of the unknown device?

The FreeBSD devd processing has all kinds of hooks in it, I think the starting point of "USB device inserted, now do something" is where you would start.
I think most of the USB drivers contain the VID/PID of the things they support.

My opinion:
The bigger issue is related to automounting USB devices like thumb drives; that is usually done from a "file manager" in a "desktop environment". If you disable all automounting pieces, when you plug in a thumb drive the most you get is new device nodes and GEOM layer tasting it. Is that enough for bad things to happen? I don't know.
But I think the issue is largely solved by "don't plug unknown devices into your system and don't allow others to"
 
Permissions can be set on /dev/ devices, to allow only certain USB devices and specific users to use them. File permissions for those devices are important. Permissions can be set by class of USB devices down to manufacturer brand. May want to disable webcamd, bc it sets the permissions for many classes of USB devices in dev.

Then allowing only necessary users to be in those groups, like wheel and operator.

There's also hardening options for mounting in /boot/loader.conf.
 
So, after all that explainations.... what I actually wanted to ask: Is there an USB-Firewall for FreeBSD?

If you want to block by device ID then you are fairly deep into the USB stack already before you can block a device. The attack surface would still be pretty large.
 
Back
Top