sudo and OpenDoas timestamp files (2020)
A 2020 write-up demonstrates reusing sudo timestamp files across SSH sessions for passwordless sudo, fixed via session-leader start times.
The author contrasts OpenBSD doas(1)'s persist feature, which uses TIOCSETVERAUTH/TIOCCHKVERAUTH/TIOCCLRVERAUTH ioctls to track authenticated TTYs with timeouts, with sudo(8)'s timestamp files bound to PPID or TTY number. A proof-of-concept reused a sudo timestamp file after an SSH session ended by opening a newly recycled pseudo-tty and calling clone(2) in a loop until matching the sshd subprocess's PPID, then ran sudo without a password. The proposed mitigation binds timestamps to the session leader's monotonic start time; this was implemented in OpenDoas and proposed upstream. sudo(8) 1.8.22 (2017) already added the equivalent session start-time check (commit 1709dc7f77).