Explanation for newbies: setuid is a special permission bit that makes an executable run with the permissions of its owner rather than the user executing it. This is often used to let a user run a specific program as root without having sudo access.

If this sounds like a security nightmare, that’s because it is.

In linux, setuid is slowly being phased out by Capabilities. An example of this is the ping command which used to need setuid in order to create raw sockets, but now just needs the cap_net_raw capability. More info: https://unix.stackexchange.com/questions/382771/why-does-ping-need-setuid-permission. Nevertheless, many linux distros still ship with setuid executables, for example passwd from the shadow-utils package.

  • tal@lemmy.today
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 months ago

    If this sounds like a security nightmare, that’s because it is.

    You can perfectly-reasonably implement suid binaries securely. They need to be simple and carefully constructed, and there shouldn’t be many of them, but the assertion that suid is “a security nightmare” is ridiculous. sudo itself relies on the suid bit.

    • StaticFlow@feddit.uk
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 months ago

      Does passwd rely on it as well? I’m curious to it’s benefits, and what we’re it’s original use cases. Is it a necessary component of multi-user systems?

    • renzev@lemmy.worldOP
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      edit-2
      2 months ago

      They need to be simple and carefully constructed

      Yeah, that’s the difficult part. It’s always better to go with the principle of least privilege (which is Capabilities is trying to do) than to just cross your fingers and hope that there are not bugs in your code. And who exactly is going to police people to make sure that their programs are “simple and carefully constructed”? The article I linked is about a setuid-related vuln in goddamn Xorg which is anything but.