It was reported [1] that sudoedit can allow for arbitrary code execution due to the sudoers configuration file not properly handling the special command name "sudoedit". In the sudoers file, the sudoedit special command is supposed to allow a user to use sudoedit to edit a specified file as another user (i.e. as an alias to sudo -e), however it can be abused to allow for the execution of arbitrary code. In sudoers, defining something like: "user ALL=(ALL) sudoedit /etc/sysconfig/autofs" should grant the user the rights to edit /etc/sysconfig/autofs using the /usr/bin/sudoedit command or "sudo -e /etc/sysconfig/autofs", however: % sudoedit /etc/sysconfig/autofs [opens file in vim] % sudoedit /etc/sysconfig/autoff [sudo] password for user: Sorry, user user is not allowed to execute 'sudoedit /etc/sysconfig/autoff' as root on host.com. % sudo -e /etc/sysconfig/autofs [opens file in vim] % sudo -e /etc/sysconfig/autoff [sudo] password for user: Sorry, user user is not allowed to execute 'sudoedit /etc/sysconfig/autoff' as root on host.com. % echo whoami >sudoedit % chmod 755 sudoedit % ./sudoedit user % sudo ./sudoedit [sudo] password for user: Sorry, user user is not allowed to execute './sudoedit' as root on host.com. % sudo ./sudoedit /etc/sysconfig/autofs root % rpm -q sudo sudo-1.7.1-7.fc12.x86_64 If the defined file to edit is passed as an argument to "./sudoedit", then sudo will execute the script with the associated privileges. Verified this happens also on Red Hat Enterprise Linux 5 (sudo-1.6.9p17-5.el5). I have not yet checked earlier versions, but the Debian report indicates this was not a problem with sudo-1.6.8p12-12.el5. It is possible this is due to sudoedit being both a special command in sudoers and also an actual system command (/usr/bin/sudoedit). If the sudoers file contains the full path of sudoedit (treating it as a command rather than a special configuration command), it is not possible to perform the above. Note that the sudoedit executable is only present in RHEL5 and Fedora, and not in RHEL4 or earlier. According to the sudoers manpage on RHEL4, sudoedit is not a valid special command either, so this would be an issue only on RHEL5 and Fedora, and would not affect earlier versions. [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570737
The relevant section in the sudoers(5) manpage states that "sudoedit" should be a magic command so should not require the full path: Cmnd ::= '!'* commandname | '!'* directory | '!'* "sudoedit" | '!'* Cmnd_Alias ... The special command "sudoedit" is used to permit a user to run sudo with the -e option (or as sudoedit). It may take command line arguments just as a normal command does.
Created attachment 395599 [details] patch from upstream to fix the flaw in sudo 1.7.x
Created attachment 395600 [details] patch backported to sudo 1.6.x
Created attachment 395605 [details] patch from upstream to fix the flaw in sudo 1.7.x (simplified) Todd sent this instead as a simplified patch.
Created attachment 395606 [details] patch backported to sudo 1.6.x (simplified)
This is CVE-2010-0426.
This issue has been addressed in following products: Red Hat Enterprise Linux 5 Via RHSA-2010:0122 https://rhn.redhat.com/errata/RHSA-2010-0122.html
This issue did NOT affect the versions of the sudo package, as shipped with Red Hat Enterprise Linux 3 and 4. This issue affects the current versions of the sudo package, as shipped with Fedora release of 11 and 12. Please fix.
sudo-1.7.2p5-1.fc11 has been submitted as an update for Fedora 11. http://admin.fedoraproject.org/updates/sudo-1.7.2p5-1.fc11
sudo-1.7.2p5-1.fc12 has been submitted as an update for Fedora 12. http://admin.fedoraproject.org/updates/sudo-1.7.2p5-1.fc12
sudo-1.7.2p5-1.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/sudo-1.7.2p5-1.fc13
sudo-1.7.2p5-1.fc12 has been pushed to the Fedora 12 stable repository. If problems still persist, please make note of it in this bug report.
sudo-1.7.2p5-1.fc11 has been pushed to the Fedora 11 stable repository. If problems still persist, please make note of it in this bug report.
sudo-1.7.2p5-1.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.