|
Bugzilla – Full Text Bug Listing |
| Summary: | If a user can change the clock and sudo has previously been run, they can escalate without typing their password. | ||
|---|---|---|---|
| Product: | Sudo | Reporter: | tntc.tig |
| Component: | Sudo | Assignee: | Todd C. Miller <Todd.Miller> |
| Status: | RESOLVED FIXED | ||
| Severity: | security | CC: | meklu |
| Priority: | normal | ||
| Version: | 1.8.7 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
tntc.tig
2013-09-08 14:11:17 MDT
For reference, we discussed this on the following reddit thread: http://www.reddit.com/r/linux/comments/1lyev4/is_your_clock_locked/ Sudo should probably use clock_gettime() with CLOCK_MONOTONIC where possible. I'll take a look at doing this for sudo 1.8.9. (In reply to Todd C Miller from comment #2) > Sudo should probably use clock_gettime() with CLOCK_MONOTONIC where > possible. I'll take a look at doing this for sudo 1.8.9. Thanks Todd! You rock! The CLOCK_MONOTONIC clock is affected by NTP adjustments and adjtime, which may potentially cause some issues. CLOCK_MONOTONIC_RAW on Linux however is thankfully not adjustable, so it might be more desirable in this case. A common culprit with the two is that the clock doesn't increment when the system is suspended. CLOCK_BOOTTIME (introduced in Linux 2.6.39, don't know of a Darwin/BSD equivalent) however, does increment but otherwise has the same issues as plain CLOCK_MONOTONIC. If only CLOCK_BOOTTIME_RAW were a thing. :( I'm not too concerned with adjtime() changing the clock as it can only move forward incrementally. One problem with using CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW and CLOCK_BOOTTIME is we lose the ability to detect time stamps that predate the system booting. The user's session ID is now stored in the time stamp file which helps, but it would still be possible to reboot, log in repeatedly until you get the matching session, and then be able to use sudo without entering a password. This argues for moving the time stamps back to /var/run (or similar) and storing the lecture status somewhere else. > The user's session ID is now stored in
> the time stamp file which helps, but it would still be possible to
> reboot, log in repeatedly until you get the matching session, and
> then be able to use sudo without entering a password.
Rebooting? Pff. You can read auth.log, which happens to store the session ID and the PTY. Why not just launch terminals with setsid to generate new sids until you match the right one from auth.log? Then you can just launch new terminals until you match the PTY. Or you need to do it the other way maybe. On Ubuntu, for example, setsid is installed by default.
Hell, on OS X right now, they don't even create the files with the SIDs, they just use the timestamp on the FOLDER /var/db/<username>.
(OS X Lion has 1.7.4p6, and the version of OS X I'm running has version 1.7.10p7)
Any updates on this one? I see 1.8.9 is out, but no mention of a fix. Is there anything I can do to further help out? Due to a large number of internal changes in sudo 1.8.9 this got pushed back to 1.8.10. I'll update this bug when there is a version available for testing. I've just committed code to use a new timestamp format, http://www.sudo.ws/repos/sudo/rev/7e16eb37bacc I'll probably make a beta version of sudo 1.8.10 available with this change soon but you can checkout and try sudo trunk to get the changes now if you'd like. Annoyingly Mac OS X lacks clock_gettime() but it is possible to get at the monotonic timers via mach calls. The first beta of sudo 1.8.10 is available: http://www.sudo.ws/devel.html#1.8.10b1 (In reply to Todd C Miller from comment #10) > The first beta of sudo 1.8.10 is available: > http://www.sudo.ws/devel.html#1.8.10b1 Yeah man! That did it! Just tested it on OS X 10.9! Excellent! (In reply to Todd C Miller from comment #10) > The first beta of sudo 1.8.10 is available: > http://www.sudo.ws/devel.html#1.8.10b1 Also adding a video of it working. Thanks again! http://www.youtube.com/watch?v=NdJezFasyso Fixed in sudo 1.8.10, out now. (In reply to Todd C Miller from comment #13) > Fixed in sudo 1.8.10, out now. Awesome! Thanks Todd! You rock! |