X Tutup
The Wayback Machine - https://web.archive.org/web/20230627225837/https://github.com/systemd/systemd/issues/18304
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please grant uaccess permissions to removable USB disks #18304

Open
joshtriplett opened this issue Jan 18, 2021 · 2 comments
Open

Please grant uaccess permissions to removable USB disks #18304

joshtriplett opened this issue Jan 18, 2021 · 2 comments
Labels
needs-discussion 🤔 RFE 🎁 Request for Enhancement, i.e. a feature request udev

Comments

@joshtriplett
Copy link
Contributor

Plugging in a removable USB disk shouldn't just mount the disk and give logged-in local users access to it. Ideally, those users would also have access to the USB disk device.

This would allow users to do things like writing a disk image to a disk device, without getting in the habit of using sudo to do so. That substantially improves safety, since the user would be able to write to removable USB disks but not accidentally overwrite a non-removable disk.

Older Linux distributions used to do this, with a rule like SUBSYSTEM=="block", ATTRS{removable}=="1", GROUP="floppy". I think it'd be appropriate to do so today using uaccess alone, rather than a group.

@poettering
Copy link
Member

Uh, this opens a can of worms: unpriv users that can modify raw file systems that the linux kernel then mounts and accesses? yuck. kernel file system devs made very clear they don't intend their implementations to be robust against rogue file system images, but it's an entirely new can of worms to allow runtime access to unpriv users completely uncontrolled even while the image might be mounted!

udisks can write disk images to USB disks. what#s wrong with using that?

@poettering poettering added needs-discussion 🤔 RFE 🎁 Request for Enhancement, i.e. a feature request udev labels Jan 19, 2021
@joshtriplett
Copy link
Contributor Author

joshtriplett commented Jan 19, 2021

it's an entirely new can of worms to allow runtime access to unpriv users completely uncontrolled even while the image might be mounted!

A malicious USB drive, or any gadget that supports looking like a USB mass storage device, could already do that. If that's exploitable, it's already exploitable on systems that enable automounting. I don't think this opens up any new attack surface area.

Along the same lines but much more simply, as far as I can tell it's already possible to use udisksctl loop-setup to set up a loopback device pointing to a file you own and can write to. That doesn't require authentication if you're on a local seat. So it's already possible, as a local user, to mount a filesystem and subsequently write to the backing device.

If your system allow local users to automount filesystems, this attack surface is already present. Adding these permissions would not introduce any new attack surface. These permissions would just make it easier and safer for legitimate users to write to removable devices they plug in.

udisks can write disk images to USB disks. what#s wrong with using that?

There are many, many more disk-image-related tools (and scripts) built around writing to the underlying disk device, rather than asking udisks to do so.

My goal here was to make it safe for users to run dd if=some.img of=/dev/sda , without needing to use sudo, and thus without the risk of accidentally using the wrong device and overwriting the wrong disk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-discussion 🤔 RFE 🎁 Request for Enhancement, i.e. a feature request udev
Development

No branches or pull requests

2 participants
X Tutup