Bug 481720 - (CVE-2009-0034) CVE-2009-0034 sudo: incorrect handling of groups in Runas_User
CVE-2009-0034 sudo: incorrect handling of groups in Runas_User
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
source=suse,reported=20090126,public=...
: Security
Depends On: 481820 481821
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-27 06:27 EST by Tomas Hoger
Modified: 2010-03-29 04:55 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-29 04:55:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Upstream patch (706 bytes, patch)
2009-01-27 06:34 EST, Tomas Hoger
no flags Details | Diff

  None (edit)
Description Tomas Hoger 2009-01-27 06:27:58 EST
It was discovered that sudo's sudoers file parses does not correctly handle group specification in Runas_User.  If group was specified in the list (using syntax %group, to allow some user to run commands as any member of the group) and the user was already member of the group, sudo actually allowed the user to run commands as arbitrary system user.

SuSE and upstream bug report:
https://bugzilla.novell.com/show_bug.cgi?id=468923
http://www.gratisoft.us/bugzilla/show_bug.cgi?id=327

This issue was confirmed on multiple 1.6.9 sudo versions.  Latest upstream 1.7.0 was reported not to be affected, 1.6.8p12 previously shipped with Red Hat Enterprise Linux 5 was not affected as well.  Problem was confirmed on 1.6.9p17 in RHEL5 and Fedora 10.

Upstream patch:

Index: parse.c
===================================================================
RCS file: /home/cvs/courtesan/sudo/parse.c,v
retrieving revision 1.160.2.21
diff -u -r1.160.2.21 parse.c
--- parse.c	2 Nov 2008 14:35:53 -0000	1.160.2.21
+++ parse.c	23 Jan 2009 19:16:55 -0000
@@ -651,9 +651,11 @@
     /*
      * If the user has a supplementary group vector, check it first.
      */
-    for (i = 0; i < user_ngroups; i++) {
-	if (grp->gr_gid == user_groups[i])
-	    return(TRUE);
+    if (strcmp(user, user_name) == 0) {
+	for (i = 0; i < user_ngroups; i++) {
+	    if (grp->gr_gid == user_groups[i])
+		return(TRUE);
+	}
     }
     if (grp->gr_mem != NULL) {
 	for (cur = grp->gr_mem; *cur; cur++) {
Comment 2 Tomas Hoger 2009-01-27 06:34:23 EST
Created attachment 330077 [details]
Upstream patch

Attaching the patch again, as comment #0 contains copy-n-paste of another copy-n-paste from a mail, and seems to have white spaces messed.
Comment 6 Tomas Hoger 2009-01-29 08:41:02 EST
This issue only affected sudo 1.6.9.  Versions of sudo as shipped in Red Hat Enterprise Linux 2.1, 3, and 4, as well as Red Hat Enterprise Linu 5 before 5.3, were not affected by this flaw.
Comment 7 Fedora Update System 2009-02-04 21:08:36 EST
sudo-1.6.9p17-5.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.