sudo -- Privilege escalation with sudoedit

2010-01-29T00:00:00
ID 018A84D0-2548-11DF-B4A3-00E0815B8DA8
Type freebsd
Reporter FreeBSD
Modified 2010-01-29T00:00:00

Description

Todd Miller reports:

When sudo performs its command matching, there is a special case for pseudo-commands in the sudoers file (currently, the only pseudo-command is sudoedit). Unlike a regular command, pseudo-commands do not begin with a slash ('/'). The flaw is that sudo's the matching code would only check against the list of pseudo-commands if the user-specified command also contained no slashes. As a result, if the user ran "sudo ./sudoedit" the normal matching code path was followed, which uses stat(2) to verify that the user-specified command matches the one in sudoers. In this case, it would compare the "./sudoedit" specified by the user with "sudoedit" from the sudoers file, resulting in a positive match.