Bug#349196: a fix for sudo in sarge

2006-04-04 Thread Mikko Rapeli
On Mon, Mar 20, 2006 at 11:20:57AM +0100, Martin Schulze wrote:
> Proposed updates for woody and sarge are here:
> http://klecker.debian.org/~joey/security/sudo/
> I'd be glad if you could test them.

The patch from 1.6.8p7-1.3 to 1.6.8p7-1.4 is logical
and works well in my use cases. Thanks.

-Mikko


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#349196: a fix for sudo in sarge

2006-03-20 Thread Martin Schulze
Proposed updates for woody and sarge are here:
http://klecker.debian.org/~joey/security/sudo/
I'd be glad if you could test them.

Regards,

Joey

-- 
Linux - the choice of a GNU generation.

Please always Cc to me when replying to me on the lists.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#349196: a fix for sudo in sarge

2006-03-03 Thread Jeroen van Wolffelaar
tags 349196 + patch
thanks

On Thu, Feb 09, 2006 at 05:28:30PM +0200, Mikko Rapeli wrote:
> This seems to work and allows me to use ethereal remotely through ssh again.
> 
> The for loop was just copied from above and keepit changed to okvar, so this 
> is
> pretty simple. We did go through all the bits and if clauses and tested the
> result manually. The manual page changes are pretty obvious too.
> 
> I did not go through the list of environment variables mentioned on 
> manual pages and 'sudo -V' when run as root, but perhaps the documentation
> is enough as this is only first aid for sarge.

Thank you for preparing a patch.

Bdale, Security team, what do you think about it?

--Jeroen

-- 
Jeroen van Wolffelaar
[EMAIL PROTECTED]
http://jeroen.A-Eskwadraat.nl


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#349196: a fix for sudo in sarge

2006-02-09 Thread Mikko Rapeli
This seems to work and allows me to use ethereal remotely through ssh again.

The for loop was just copied from above and keepit changed to okvar, so this is
pretty simple. We did go through all the bits and if clauses and tested the
result manually. The manual page changes are pretty obvious too.

I did not go through the list of environment variables mentioned on 
manual pages and 'sudo -V' when run as root, but perhaps the documentation
is enough as this is only first aid for sarge.

-Mikko
--- sudo-1.6.8p7-1.3/env.c  2006-02-09 12:51:27.280782680 +0200
+++ sudo-1.6.8p7/env.c  2006-02-09 15:15:25.701543112 +0200
@@ -434,6 +434,22 @@
continue;
}
 
+/* Add everything listed in env_keep */
+   for (cur = def_env_keep; cur; cur = cur->next) {
+   len = strlen(cur->value);
+   /* Deal with '*' wildcard */
+   if (cur->value[len - 1] == '*') {
+   len--;
+   iswild = 1;
+   } else
+   iswild = 0;
+   if (strncmp(cur->value, *ep, len) == 0 &&
+   (iswild || (*ep)[len] == '=')) {
+   okvar = 1;
+   break;
+   }
+   }
+
/* Skip anything listed in env_delete. */
 #if 0
for (cur = def_env_delete; cur && okvar; cur = cur->next) {
--- sudo-1.6.8p7-1.3/sudoers.pod2006-02-09 12:51:27.0 +0200
+++ sudo-1.6.8p7/sudoers.pod2006-02-09 16:51:03.913202344 +0200
@@ -435,8 +435,8 @@
 
 =item env_reset
 
-If set, B will reset the environment to only contain the
-following variables: C, C, C, C, C,
+By default and when set, B will reset the environment to only contain the
+following variables: C, C, C, C,
 and C (in addition to the C variables).
 Of these, only C is copied unaltered from the old environment.
 The other variables are set to default values (possibly modified
@@ -742,8 +742,8 @@
 
 =item env_check
 
-Environment variables to be removed from the user's environment if
-the variable's value contains C<%> or C characters.  This can
+Like I, but listed environment variables are taken from the user's 
environment if
+the variable's value does B contain C<%> or C characters.  This can
 be used to guard against printf-style format vulnerabilities in
 poorly-written programs.  The argument may be a double-quoted,
 space-separated list or a single value without double-quotes.  The
@@ -754,7 +754,10 @@
 
 =item env_delete
 
-Environment variables to be removed from the user's environment.
+
+Not effective due to security issues: only variables listed in 
+I or I can be passed through B!
+
 The argument may be a double-quoted, space-separated list or a
 single value without double-quotes.  The list can be replaced, added
 to, deleted from, or disabled by using the C<=>, C<+=>, C<-=>, and
@@ -766,8 +769,8 @@
 
 =item env_keep
 
-Environment variables to be preserved in the user's environment
-when the I option is in effect.  This allows fine-grained
+Environment variables to be preserved in the user's environment.
+This allows fine-grained
 control over the environment B-spawned processes will receive.
 The argument may be a double-quoted, space-separated list or a
 single value without double-quotes.  The list can be replaced, added
@@ -1004,8 +1007,14 @@
 is you cannot reference an Alias that has not already been defined.
 
 Below are example I entries.  Admittedly, some of
-these are a bit contrived.  First, we define our I:
+these are a bit contrived.  First, we allow a few environment
+variables to pass and then define our I:
 
+ # Run X applications through sudo; HOME is used to find .Xauthority file
+ # Note that some programs may use HOME for other purposes too and
+ # this may lead to privilege escalation!
+ Defaults env_keep = "DISPLAY HOME"
+ 
  # User alias specification
  User_AliasFULLTIMERS = millert, mikef, dowdy
  User_AliasPARTTIMERS = bostley, jwfox, crawl
--- sudo-1.6.8p7-1.3/debian/changelog   2006-02-09 12:51:27.0 +0200
+++ sudo-1.6.8p7/debian/changelog   2006-02-09 15:58:24.867450296 +0200
@@ -1,3 +1,11 @@
+sudo (1.6.8p7-1.3.mkr1) stable-security; urgency=low
+
+  * Fix sudo environment variable white listing to respect
+env_keep so root can knowingly pass users variables through sudo,
+and try document it in the sudoers manual page
+
+ -- Mikko Rapeli <[EMAIL PROTECTED]>  Thu,  9 Feb 2006 15:57:22 +0200
+
 sudo (1.6.8p7-1.3) stable-security; urgency=high
 
   * Non-maintainer upload by the Security Team