Imagine that locally on my system
sudo is configured with a timeout, so that once I authenticate after running
sudo once in some terminal, I don't need to re-authenticate for another 10 minutes.
Does this effectively give processes running as children of the process that invoked
sudo, but not with
sudo themselves (hence as siblings, not children of the process that was run with
sudo) the ability to escalate their privileges to root?
As a concrete example, imagine I run, in the terminal:
sudo echo "hi" other_process
echo process is run with
other_process is not. Can
other_process use the 10-minute-expiry sudo ticket associated with the earlier
sudo call, e.g., by itself launching a sub-process via
I guess if the answer is yes, it means you need to be very careful with any processes that you run within the timeout period of
sudo. One might imagine that running an untrusted process like
other_process would keep it within the sandbox of the current user, but if it can use the existing
sudo ticket it could escalate to root.
Does the answer change if the
sudo invocation comes not directly in the terminal but in a script launched from the terminal?
E.g., I run:
script.sh, there is a line like
sudo echo "inside script", will other processes subsequently launched by the script be able to use the sudo ticket to escalate their privileges to root? How about after the script finishes: will other processes in the terminal that ran
script.sh still be able to use the
1 These are no longer like sibling but somehow 'aunt' or 'uncle' processes (siblings of the parent).