NetBSD Problem Report #2634

From gnats  Tue Jul 16 02:25:20 1996
Received: from lerome.chautauqua.com by pain.lcs.mit.edu (8.7.5/8.7.3) with ESMTP id CAA27193 for <gnats-bugs@gnats.netbsd.org>; Tue, 16 Jul 1996 02:11:05 -0400 (EDT)
Message-Id: <199607160610.XAA04587@lerome.chautauqua.com>
Date: Mon, 15 Jul 1996 23:10:44 -0700 (PDT)
From: douzzer@mit.edu
Reply-To: douzzer@mit.edu
To: gnats-bugs@NetBSD.ORG
Subject: /usr/sbin/chroot is a bogon
X-Send-Pr-Version: 3.95

>Number:         2634
>Category:       misc
>Synopsis:       /usr/sbin/chroot is doomed
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 16 02:35:00 +0000 1996
>Closed-Date:    Sun Jun 22 08:26:41 +0000 1997
>Last-Modified:  Thu Mar 24 11:34:00 +0000 2005
>Originator:     Daniel G. Pouzzner
>Release:        1.2A
>Organization:
just me
>Environment:
>Description:
	hey guys, /usr/sbin/chroot can not possibly work out.
if it ever leaves experimental status and goes setuid in a release,
here is what will happen:

-hacker would find a setuid-root program on a partition he has write
on.

-he would create a bogus directory hierarchy with a homebrew
${top}/usr/lib/libc.so and ${top}/usr/libexec/ld.so, with (for
example) strrchr() replaced with a 'system("/sh")'

-he would put a hard link to the setuid program in ${top}/haha, plus
copies of /bin/sh, /bin/chmod, and /bin/chown.

-he would then do a "chroot ${top} /haha" and, voila, he has a root
shell. /chown root /sh; /chmod 4755 /sh ; exit

-${top}/sh now yields immediate full root

>How-To-Repeat:
	this is all hypothetical :-]
>Fix:
	i started work tonight on a program called "safexec" that will
launch untrustable programs in a completely compartmentalized fashion,
under uid/gid nobody, chroot'd to nowhere special, with a blank
environment save what is passed on the safexec command line.

	when i feel it is ready for prime time i'll let you know, and
also submit it to CERT. that will probably be in the next few days (i
tend not to dawdle).

-douzzer
 Menlo Park, CA
>Release-Note:
>Audit-Trail:

From: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
To: douzzer@mit.edu
Cc: gnats-bugs@NetBSD.ORG, netbsd-bugs@NetBSD.ORG
Subject: Re: misc/2634: /usr/sbin/chroot is a bogon 
Date: Tue, 16 Jul 1996 07:16:45 -0400

 > 	hey guys, /usr/sbin/chroot can not possibly work out.
 > if it ever leaves experimental status and goes setuid in a release,
 > here is what will happen:
 > [ ... ]

 Funny, that it exactly an example of _why_ chroot is _not_ setuid, and
 why past calls to have it made setuid have been resisted.

 chroot is intended for use only by root; if you make it setuid it has
 exactly (or something similar to) the vulnerability you describe.


 I'm sure that past discussions have been logged somewhere in the
 mailing list archives...


 cgd

From: David Brownlee <david@mono.org>
To: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
Cc: douzzer@mit.edu, gnats-bugs@NetBSD.ORG, netbsd-bugs@NetBSD.ORG
Subject: Re: misc/2634: /usr/sbin/chroot is a bogon 
Date: Tue, 16 Jul 1996 20:27:31 +0100 (BST)

 	Anyone care to submit a pr updating the man page to explain
 	this? :)

 .---- I've been too drunk to love ----.--- I've been too drunk to remember -.
 |          Too drunk to care          |     The hell of the night before    |
 |  Looked like death, felt like Hell  |    I've been drinking myself blind  |
 `------ Been the worse for wear ------'--- And still I'll drink some more --'


 On Tue, 16 Jul 1996, Chris G Demetriou wrote:

 > > 	hey guys, /usr/sbin/chroot can not possibly work out.
 > > if it ever leaves experimental status and goes setuid in a release,
 > > here is what will happen:
 > > [ ... ]
 > 
 > Funny, that it exactly an example of _why_ chroot is _not_ setuid, and
 > why past calls to have it made setuid have been resisted.
 > 
 > chroot is intended for use only by root; if you make it setuid it has
 > exactly (or something similar to) the vulnerability you describe.
 > 
 > 
 > I'm sure that past discussions have been logged somewhere in the
 > mailing list archives...
 > 
 > 
 > cgd
 > 
State-Changed-From-To: open->closed 
State-Changed-By: lukem 
State-Changed-When: Sun Jun 22 01:26:41 PDT 1997 
State-Changed-Why:  
I've added a CAVEATS section to chroot(8) explaining that 
making it setuid root is a bad idea. 
From: Adam Ciarcinski <adam@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/2634 CVS commit: pkgsrc/lang/ocaml
Date: Thu, 24 Mar 2005 11:32:50 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	adam
 Date:		Thu Mar 24 11:32:50 UTC 2005

 Modified Files:
 	pkgsrc/lang/ocaml: Makefile.common PLIST PLIST.opt distinfo
 	pkgsrc/lang/ocaml/patches: patch-aa patch-aj patch-al patch-at patch-ax
 	    patch-ay patch-ba patch-bm patch-bn patch-bp patch-bq patch-bs
 	    patch-bu
 Added Files:
 	pkgsrc/lang/ocaml/patches: patch-ag

 Log Message:
 Changes 3.08.3:
 New features:
 - support for ocamlopt -pack under Mac OS X (PR#2634, PR#3320)
 - ignore unknown warning options for forward and backward compatibility
 - runtime: export caml_compare_unordered (PR#3479)
 - camlp4: install argl.* files (PR#3439)
 - ocamldoc: add -man-section option
 - labltk: add the "solid" relief option (PR#3343)
 - compiler: ocamlc -i now prints variance annotations

 Bug fixes:
 - typing: fix unsoundness in type declaration variance inference.
     Type parameters which are constrained must now have an explicit variant
     annotation, otherwise they are invariant. This is not backward
     compatible, so this might break code which either uses subtyping or
     uses the relaxed value restriction (i.e. was not typable before 3.07)
 - typing: erroneous partial match warning for polymorphic variants (PR#3424)
 - runtime: handle the case of an empty command line (PR#3409, PR#3444)
 - stdlib: make Sys.executable_name an absolute path in native code (PR#3303)
 - runtime: fix memory leak in finalise.c
 - runtime: auto-trigger compaction even if gc is called manually (PR#3392)
 - stdlib: fix segfault in Obj.dup on zero-sized values (PR#3406)
 - camlp4: correct parsing of the $ identifier (PR#3310, PR#3469)
 - windows (MS tools): use link /lib instead of lib (PR#3333)
 - windows (MS tools): change default install destination
 - autoconf: better checking of SSE2 instructions (PR#3329, PR#3330)
 - graphics: make close_graph close the X display as well as the window (PR#3312)
 - num: fix big_int_of_string (empty string) (PR#3483)
 - num: fix big bug on 64-bit architecture (PR#3299)
 - str: better documentation of string_match and string_partial_match (PR#3395)
 - unix: fix file descriptor leak in Unix.accept (PR#3423)
 - unix: miscellaneous clean-ups
 - unix: fix documentation of Unix.tm (PR#3341)
 - graphics: fix problem when allocating lots of images under Windows (PR#3433)
 - compiler: fix error message with -pack when .cmi is missing (PR#3028)
 - cygwin: fix problem with compilation of camlheader (PR#3485)
 - stdlib: Filename.basename doesn't return an empty string any more (PR#3451)
 - stdlib: better documentation of Open_excl flag (PR#3450)
 - ocamlcp: accept -thread option (PR#3511)
 - ocamldep: handle spaces in file names (PR#3370)
 - compiler: remove spurious warning in pattern-matching on variants (PR#3424)
 - windows: better handling of InterpreterPath registry entry (PR#3334, PR#3432)


 To generate a diff of this commit:
 cvs rdiff -r1.4 -r1.5 pkgsrc/lang/ocaml/Makefile.common
 cvs rdiff -r1.11 -r1.12 pkgsrc/lang/ocaml/PLIST
 cvs rdiff -r1.8 -r1.9 pkgsrc/lang/ocaml/PLIST.opt
 cvs rdiff -r1.26 -r1.27 pkgsrc/lang/ocaml/distinfo
 cvs rdiff -r1.4 -r1.5 pkgsrc/lang/ocaml/patches/patch-aa \
     pkgsrc/lang/ocaml/patches/patch-aj pkgsrc/lang/ocaml/patches/patch-al \
     pkgsrc/lang/ocaml/patches/patch-at
 cvs rdiff -r0 -r1.4 pkgsrc/lang/ocaml/patches/patch-ag
 cvs rdiff -r1.1 -r1.2 pkgsrc/lang/ocaml/patches/patch-ax \
     pkgsrc/lang/ocaml/patches/patch-ay pkgsrc/lang/ocaml/patches/patch-bm \
     pkgsrc/lang/ocaml/patches/patch-bq pkgsrc/lang/ocaml/patches/patch-bu
 cvs rdiff -r1.3 -r1.4 pkgsrc/lang/ocaml/patches/patch-ba
 cvs rdiff -r1.2 -r1.3 pkgsrc/lang/ocaml/patches/patch-bn \
     pkgsrc/lang/ocaml/patches/patch-bp pkgsrc/lang/ocaml/patches/patch-bs

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Adam Ciarcinski <adam@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/2634 CVS commit: pkgsrc/x11/ocaml-graphics
Date: Thu, 24 Mar 2005 11:33:24 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	adam
 Date:		Thu Mar 24 11:33:24 UTC 2005

 Modified Files:
 	pkgsrc/x11/ocaml-graphics: Makefile

 Log Message:
 Changes 3.08.3:
 New features:
 - support for ocamlopt -pack under Mac OS X (PR#2634, PR#3320)
 - ignore unknown warning options for forward and backward compatibility
 - runtime: export caml_compare_unordered (PR#3479)
 - camlp4: install argl.* files (PR#3439)
 - ocamldoc: add -man-section option
 - labltk: add the "solid" relief option (PR#3343)
 - compiler: ocamlc -i now prints variance annotations

 Bug fixes:
 - typing: fix unsoundness in type declaration variance inference.
     Type parameters which are constrained must now have an explicit variant
     annotation, otherwise they are invariant. This is not backward
     compatible, so this might break code which either uses subtyping or
     uses the relaxed value restriction (i.e. was not typable before 3.07)
 - typing: erroneous partial match warning for polymorphic variants (PR#3424)
 - runtime: handle the case of an empty command line (PR#3409, PR#3444)
 - stdlib: make Sys.executable_name an absolute path in native code (PR#3303)
 - runtime: fix memory leak in finalise.c
 - runtime: auto-trigger compaction even if gc is called manually (PR#3392)
 - stdlib: fix segfault in Obj.dup on zero-sized values (PR#3406)
 - camlp4: correct parsing of the $ identifier (PR#3310, PR#3469)
 - windows (MS tools): use link /lib instead of lib (PR#3333)
 - windows (MS tools): change default install destination
 - autoconf: better checking of SSE2 instructions (PR#3329, PR#3330)
 - graphics: make close_graph close the X display as well as the window (PR#3312)
 - num: fix big_int_of_string (empty string) (PR#3483)
 - num: fix big bug on 64-bit architecture (PR#3299)
 - str: better documentation of string_match and string_partial_match (PR#3395)
 - unix: fix file descriptor leak in Unix.accept (PR#3423)
 - unix: miscellaneous clean-ups
 - unix: fix documentation of Unix.tm (PR#3341)
 - graphics: fix problem when allocating lots of images under Windows (PR#3433)
 - compiler: fix error message with -pack when .cmi is missing (PR#3028)
 - cygwin: fix problem with compilation of camlheader (PR#3485)
 - stdlib: Filename.basename doesn't return an empty string any more (PR#3451)
 - stdlib: better documentation of Open_excl flag (PR#3450)
 - ocamlcp: accept -thread option (PR#3511)
 - ocamldep: handle spaces in file names (PR#3370)
 - compiler: remove spurious warning in pattern-matching on variants (PR#3424)
 - windows: better handling of InterpreterPath registry entry (PR#3334, PR#3432)


 To generate a diff of this commit:
 cvs rdiff -r1.2 -r1.3 pkgsrc/x11/ocaml-graphics/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:
 System: NetBSD lerome 1.1 NetBSD 1.1 (GENERIC_SCSI3) #9: Tue Nov 21 20:15:17 MET 1995 pk@neon:/usr/src1/sys/arch/sparc/compile/GENERIC_SCSI3 sparc

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.