Sounds like this can be prevented by a simple alias in .profile which makes sudo require password each time it's run:
alias sudo="sudo -k"
That won't work. The command:
does not require a password, and is not logged. And adding '-k' does not make sudo require a password. It just resets the timestamp file (that causes a password prompt) to the Unix epoch. Then, the malicious user on your machine just has to edit the date/time to the epoch, and he's in.
What you actually want is:
Code:
alias sudo="sudo -K; sudo"
So that the timestamp file is
removed, requiring a password regardless of the timestamp file vs. date comparison.
----------
The flaw may allow someone with physical access to a machine that is not password-protected to run sudo commands without knowing the logged in user's password. On systems where sudo is the principal way of running commands as root, such as on Ubuntu and Mac OS X, there is a greater chance that the logged in user has run sudo before and thus that an attack would succeed.
So Admin user A sets things up so sudo doesn't time-out. Random user B comes up to computer which is still logged in with A's account and can use sudo without a password.
So random user B can type sudo -s and go nuts.
So basically the "exploit" requires you to intentionally f- your own computer first. This is a non-issue.
Not really - this exploit
does not require that an admin "sets things up so sudo doesn't time-out". All it requires is that:
1) Admin user A has run a sudo command at least once in the past, even if it was 5 years ago. (Thus a timestamp file exists.)
2) The system date/time can be changed by Admin user A.
Fairly common situation. Now, if I'm user B and I stroll by and see that Admin user A's desktop is not locked, all I have to do is:
1) Run 'sudo -k' to reset the timestamp file to the Unix epoch.
2) Change the date/time of the machine to the Unix epoch.
I can now, as user B, run a 'sudo' command and either run with privileged access, or potentially just 'sudo su' and become root,
without needing Admin user A's password.