• David Zeuthen's avatar
    pkexec: Avoid TOCTTOU problems with parent process · 5d44f404
    David Zeuthen authored
    
    
    In a nutshell, the parent process may change its uid (either real- or
    effective uid) after launching pkexec. It can do this by exec()'ing
    e.g. a setuid root program.
    
    To avoid this problem, just use the uid the parent process had when it
    executed pkexec. This happens to be the same uid of the pkexec process
    itself.
    
    Additionally, remove some dubious code that allowed pkexec to continue
    when the parent process died as there is no reason to support
    something like that. Also ensure that the pkexec process is killed if
    the parent process dies.
    
    This problem was pointed out by Neel Mehta <nmehta@google.com>.
    Signed-off-by: default avatarDavid Zeuthen <davidz@redhat.com>
    5d44f404
pkexec.c 21.4 KB