Re: root daemon dropping privileges temporarily?

From: Jem Berkes (jb_at_users.pc9.org)
Date: 05/26/04

  • Next message: Alan Balmer: "Re: CRC32 variants?"
    Date: 26 May 2004 16:16:55 GMT
    
    

    > Currently, the program is launched as root and does setuid() after it
    > authenticates the connecting user. My concern is vulnerability while
    > the software is running as root.
    >
    > Is it possible/portable to do setuid() to something like nobody and
    > then later do a setuid() back up to root? Or should I be using
    > seteuid() to set the effective user ID?

    I ran into a different scheme, this one separates privileges and seems
    common. Although it's still not perfect (since the processes are related) I
    think it should be pretty good, unless anyone knows otherwise?

    1) fork() and setgid, setuid nobody. Unprivileged child "faces the world"
    2) parent retains root privileges, and code now ONLY does authentication
    3) unprivileged child can now query the privileged parent only using IPC

    Thus if the network-facing child becomes compromised, the attacker is stuck
    at nobody's privileges, though they can still craft dangerous data to send
    to the root authenticator process via IPC.

    I think the only way the parent (root, authenticator) can be compromised is
    if it is vulnerable to maliciously crafted IPC queries. But still much
    better off then a root-privilege process doing socket I/O with the world.

    -- 
    Jem Berkes
    http://www.sysdesign.ca/
    

  • Next message: Alan Balmer: "Re: CRC32 variants?"

    Relevant Pages

    • Re: [patch, 2.6.11-rc2] sched: RLIMIT_RT_CPU_RATIO feature
      ... The programs in question can be setuid ... setuid root is precisely what we are attempting to ... then the the program immediately and irrevocably drops root privileges ... either change policy to RT or fork another task that needs the same ...
      (Linux-Kernel)
    • Re: root daemon dropping privileges temporarily?
      ... the program is launched as root and does setuid() after it ... > the software is running as root. ... I ran into a different scheme, this one separates privileges and seems ... I think the only way the parent (root, authenticator) can be compromised is ...
      (comp.os.linux.security)
    • Re: Some thoughts about anti-virus software for Linux
      ... privileges to do so. ... The programs that run with root privileges are ... Some binaries might be installed with the "setuid bit" set to another ... be changed by the admin (or is set by the package manager on the admin's ...
      (Ubuntu)
    • Re: setuid
      ... >> I would like all members of a group to have permission to run a command ... >> with root privileges, while ... >> Is it possible to use the setuid mechanism on a group basis? ...
      (comp.os.linux.misc)
    • Re: Great SWT Program
      ... from a terminal emulator and log in as root there. ... terminal-emulator windows open, ... The script, suid-root utility, or whatever would ... the command interpreter with root privileges ...
      (comp.lang.java.programmer)