These are the kinds of bugs I am relieved to see found. There is no immediate urgency, just update your system regularly and we are all safer having it patched.
The exploit discloses up to 64 bytes of kernel stack, and allows the attacker to zero (IIUC) the two least significant bits at any arbitrary offset. So you can, in essence, re-target a pointer to attacker-controlled data. My understanding is they forged some internal structures to amplify that two-bit write into a more powerful write primitive.
Given the number of devices out in the real world that run Linux--many that aren't updated often--this can be serious!
Odoo, uniCenta and Floreant POS systems are used in restaurants and hotels and you can walk right up to the little boxes on the reception desk and shove a USB drive in.
WebUSB lets web apps talk to USB devices that are attached to the host running the browser. It doesn't have the browser present an emulated USB device to the kernel (at least not to my knowledge).
not really, WebUSB is on the other side of (it allows you to interact with USB devices, it can not emulate a malicious device)
you would need to use WebUSB to hack a usb device connected to the computer, overwrite it's firmware and then make it restart so that it can "hack back" into the computer
which to be fair isn't impossible, but seems unlikely to be an relevant attack vector
> usb2shell is the physical version: instead of a crafted request, the attacker plugs in a crafted USB device.
This is the kind of bug from movies I’ve always wanted to see in real life. The kind that lets James Bond plug something into a computer for 2 second and hack the entire system.
From what I understand, linux filesystems aren't hardened against malicious malformed filesystems on disk. The assumption is that the disk (at least the filesystem structure) is trusted. This is usually fine, but there would be a large class of exploits waiting to happen if say a USB drive found on the pavement is plugged in and automounted.
For untrusted USB mount, there are tools like https://github.com/cea-sec/usbsas that don't mount in the kernel but do everything in userspace, and thus bypass this class of attack.
Most people don't use it though so I guess it depends on how much you care in the end...
Not automounted in this case, just plugged in (which I might have done with a found USB, and then tried to copy any partitions as raw files and then examine them with safe(r) tools that the whole kernel.
Unless you changed the USB authorization policy to default deny [0] with some userspace filter for whitelisting specific devices, e.g. USBGuard [1], any USB device can pretend to be any other USB device.
There's no need to exploit the mass storage device driver when you can just pretend to be a keyboard and open a terminal. It's likely also possible to detect when the system is idle and do this when nobody is watching.
An excellent endorsement for the QubesOS security model. USB devices are attached to a disposable, unprivilleged VM and only the data to/from the device is passed through to other VMs. So the scope of an exploit in how the kernel handles the USB device is limited to a VM that is insulated from the rest of the system.
I'm not saying this is wrong but it sounds like adding lots of complexity into solving a problem and adding complexity leads to more possible exploits. I mean VMs aren't immune to attacks either.
There is no host OS in QubesOS. Only a hypervisor that coordinates the VMs and how they interact with each other and with the hardware. In this case the hypervisor exposes to a VM the PCI hardware interface to which the USB device is connected. Only the kernel in that VM then interacts with the USB device directly.
Fair warning, the learning curve could be described as a cliff face. But it is an interesting architecture and I ran it as my daily driver for two years.
So, a lot of people are assuming that this only works in-person ... however, with devices like a GL.iNet Comet Remote KVM which emulates a USB device, nothing stops someone from doing a remote exploit of a kvm node (likely running a 4.19.x or 6.1.x. linux kernel) which then allows an exploit of the node it is plugged into. This is just another tool in the sandbox of someone who already has a lot of remote exploit tools.
ie: Just because it required physical USB access doesn't mean it's not remote-exploitable in some/many cases.
AFAIU, Linux considers physically connected devices to be "trusted", and doesn't place a ton of importance on securing drivers against hardware acting maliciously. I myself think that this policy is pretty bad, but I see how it could be the only reasonable policy for a monolithic kernel written in C where all drivers run in ring 0..
..I'm surprised though that there's an ACE which can be triggered from the generic USB Mass Storage Device driver without even mounting the filesystem I guess. This is gonna affect even many systems which disable all USB drivers they don't need for security reasons. I expected it to be from a driver for some ancient piece of hardware nobody has maintained for 15 years.
Read the section 'the bug': the change that made this possible was introduced in 6.5. Really only vindicates the criticism of Linux's monolithic architecture further; hardware continues to implement weird tricky features and drivers have to support them. Sure would be nice if we weren't executing those drivers in a priviledged mode...
> I'm surprised though that there's an ACE which can be triggered from the generic USB Mass Storage Device driver without even mounting the filesystem I guess
I’ve been reading the usb implementation of OpenBSD, and it’s very much a foundational bus like pci. Most (if not all) subsystems hook into it, and it’s basically “trust me, bro” especially with the need to hotswap and how versatile one device can be.
At least the "2shell" names make sense. It clearly states the weak point (usb, php...) and what the result is (full on shell, rather than just reading from RAM or an out of bounds write)
fwiw the reason this is "2shell" is because it can get an authenticated shell at any privilege level accessible by the kernel (i.e. root but not hypervisor escape) even on a fully locked down machine by RCE-ing the USB bus driver (and not emulating a keyboard or anything).
Plugging up USB ports on computers in customer facing/front of house areas is a good idea. For one thing, it keeps people from trying to charge their phones on your computers!
Hmm... people seem to be dismissing this in the comments.
It's more than a normal rubber duck attack, like pretending to be a mouse and keyboard, it is a proper exploit of the SCSI driver IIUC.
Someone with access to a physical device for one or two minutes can get root pretty much undetected.
It works even if locked or if the device is booted with no one logged in. That's pretty cool IMO.
Not as worrying as a remote exploit of course.
These are the kinds of bugs I am relieved to see found. There is no immediate urgency, just update your system regularly and we are all safer having it patched.
Lots of details missing, though: How did they go from being able to rewrite just one byte in kernel memory to arbitrary code execution?
The exploit discloses up to 64 bytes of kernel stack, and allows the attacker to zero (IIUC) the two least significant bits at any arbitrary offset. So you can, in essence, re-target a pointer to attacker-controlled data. My understanding is they forged some internal structures to amplify that two-bit write into a more powerful write primitive.
Given the number of devices out in the real world that run Linux--many that aren't updated often--this can be serious!
Odoo, uniCenta and Floreant POS systems are used in restaurants and hotels and you can walk right up to the little boxes on the reception desk and shove a USB drive in.
> Linux 6.5 and later
Maybe in this case it happens to be better if they're out of date!
Would this work over WebUSB?
WebUSB lets web apps talk to USB devices that are attached to the host running the browser. It doesn't have the browser present an emulated USB device to the kernel (at least not to my knowledge).
Nothing stopping webUSB flashing the firmware of a device to run this exploit though presumably.
If you give the site access to your device, sure. But ultimately so could any other firmware updater.
Which is part of why Mozilla has been so bearish on WebUSB/MIDI/etc.
Performing software updates of essentially soft USB devices in a microcontroller is pretty much the primary use case of WebUSB currently.
not really, WebUSB is on the other side of (it allows you to interact with USB devices, it can not emulate a malicious device)
you would need to use WebUSB to hack a usb device connected to the computer, overwrite it's firmware and then make it restart so that it can "hack back" into the computer
which to be fair isn't impossible, but seems unlikely to be an relevant attack vector
Oh but surely next thing WebUSB people will demand would be usb host browser-side.
Was fixed in 7.2.8, my machines are updated on occasion by me, and are running 7.2.15, which came out on 01 Nov.
Looks like 7.2.8 was cut on 25 Sep: https://lwn.net/Articles/1096820/
So if you're on a maintained distro and update more often than every couple of months, you probably already have the fix for this.
> usb2shell is the physical version: instead of a crafted request, the attacker plugs in a crafted USB device.
This is the kind of bug from movies I’ve always wanted to see in real life. The kind that lets James Bond plug something into a computer for 2 second and hack the entire system.
From what I understand, linux filesystems aren't hardened against malicious malformed filesystems on disk. The assumption is that the disk (at least the filesystem structure) is trusted. This is usually fine, but there would be a large class of exploits waiting to happen if say a USB drive found on the pavement is plugged in and automounted.
Please correct me if I'm wrong
For untrusted USB mount, there are tools like https://github.com/cea-sec/usbsas that don't mount in the kernel but do everything in userspace, and thus bypass this class of attack.
Most people don't use it though so I guess it depends on how much you care in the end...
Not automounted in this case, just plugged in (which I might have done with a found USB, and then tried to copy any partitions as raw files and then examine them with safe(r) tools that the whole kernel.
I just always assumed this was the case
Unless you changed the USB authorization policy to default deny [0] with some userspace filter for whitelisting specific devices, e.g. USBGuard [1], any USB device can pretend to be any other USB device.
There's no need to exploit the mass storage device driver when you can just pretend to be a keyboard and open a terminal. It's likely also possible to detect when the system is idle and do this when nobody is watching.
[0] https://www.kernel.org/doc/Documentation/usb/authorization.t...
[1] https://usbguard.github.io/
i believe this works on a locked machine, a keyboard shouldn't be able to get you past the lock screen.
Odd I never get past my lock screen without a keyboard.
Well, now you can with usb2shell. And you even get root for free.
But no keyboard
An excellent endorsement for the QubesOS security model. USB devices are attached to a disposable, unprivilleged VM and only the data to/from the device is passed through to other VMs. So the scope of an exploit in how the kernel handles the USB device is limited to a VM that is insulated from the rest of the system.
I'm not saying this is wrong but it sounds like adding lots of complexity into solving a problem and adding complexity leads to more possible exploits. I mean VMs aren't immune to attacks either.
Isn't the host OS in danger?
There is no host OS in QubesOS. Only a hypervisor that coordinates the VMs and how they interact with each other and with the hardware. In this case the hypervisor exposes to a VM the PCI hardware interface to which the USB device is connected. Only the kernel in that VM then interacts with the USB device directly.
Neat! Imma have to poke around QubesOS.
Fair warning, the learning curve could be described as a cliff face. But it is an interesting architecture and I ran it as my daily driver for two years.
No the pcie USB controller is passed to a disposable sys-usb vm.
That's what's in danger.
So, a lot of people are assuming that this only works in-person ... however, with devices like a GL.iNet Comet Remote KVM which emulates a USB device, nothing stops someone from doing a remote exploit of a kvm node (likely running a 4.19.x or 6.1.x. linux kernel) which then allows an exploit of the node it is plugged into. This is just another tool in the sandbox of someone who already has a lot of remote exploit tools.
ie: Just because it required physical USB access doesn't mean it's not remote-exploitable in some/many cases.
AFAIU, Linux considers physically connected devices to be "trusted", and doesn't place a ton of importance on securing drivers against hardware acting maliciously. I myself think that this policy is pretty bad, but I see how it could be the only reasonable policy for a monolithic kernel written in C where all drivers run in ring 0..
..I'm surprised though that there's an ACE which can be triggered from the generic USB Mass Storage Device driver without even mounting the filesystem I guess. This is gonna affect even many systems which disable all USB drivers they don't need for security reasons. I expected it to be from a driver for some ancient piece of hardware nobody has maintained for 15 years.
Read the section 'the bug': the change that made this possible was introduced in 6.5. Really only vindicates the criticism of Linux's monolithic architecture further; hardware continues to implement weird tricky features and drivers have to support them. Sure would be nice if we weren't executing those drivers in a priviledged mode...
> I'm surprised though that there's an ACE which can be triggered from the generic USB Mass Storage Device driver without even mounting the filesystem I guess
I’ve been reading the usb implementation of OpenBSD, and it’s very much a foundational bus like pci. Most (if not all) subsystems hook into it, and it’s basically “trust me, bro” especially with the need to hotswap and how versatile one device can be.
However, the redundant 3 times `if` statements in this patch can clearly be reduced to one.
Finally something my server can't be reached by!
>curl -fsSLO https://usb2shell.com/tools/usb2shell-check.sh
>less usb2shell-check.sh
>sh usb2shell-check.sh
I LOLed. Use "less -nU" to prevent black text on black background attack vector. Maybe.
Clickbait2shell, a new exploit where you blindly add "2shell" at the end of a random word. Sequel to Clickbleed.
At least the "2shell" names make sense. It clearly states the weak point (usb, php...) and what the result is (full on shell, rather than just reading from RAM or an out of bounds write)
Yeah but it can only be used once, so now we need to decide how we're going to version these
I can open the terminal with my mouse. Should I call it cursor2shell?
fwiw the reason this is "2shell" is because it can get an authenticated shell at any privilege level accessible by the kernel (i.e. root but not hypervisor escape) even on a fully locked down machine by RCE-ing the USB bus driver (and not emulating a keyboard or anything).
2shell1mouse
You're too late, Terminal2shell already exists.
autoexpect has been around a long time, and can be incredibly useful. =3
baitgate imo
It's never going to stop being funny how scandals are still called "gate" just because of that one hotel's name
I patch with superglue.
Plugging up USB ports on computers in customer facing/front of house areas is a good idea. For one thing, it keeps people from trying to charge their phones on your computers!
Hm, it looks like it can be used to jailbreak the Tesla Model 3. I wonder if I can use it to add AndroidAuto.
Is Android vulnerable to it?