NetBSD Problem Report #9528
Received: (qmail 15318 invoked from network); 4 Mar 2000 02:00:59 -0000
Message-Id: <200003040200.VAA01734@nyarlathotep.old-ones.com>
Date: Fri, 3 Mar 2000 21:00:57 -0500 (EST)
From: Bill Squier <groo@old-ones.com>
Reply-To: groo@old-ones.com
To: gnats-bugs@gnats.netbsd.org
Subject: xterm vulnerable to root exploit
X-Send-Pr-Version: 3.95
>Number: 9528
>Category: security
>Synopsis: xterm vulnerable to root exploit
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: tron
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 03 18:03:00 +0000 2000
>Closed-Date: Fri May 26 07:20:06 +0000 2000
>Last-Modified: Sun Dec 17 13:32:26 +0000 2000
>Originator: Bill Squier
>Release:
>Organization:
Bill Squier (groo@cs.stevens-tech.edu)
http://www.cs.stevens-tech.edu/~groo
>Environment:
System: NetBSD nyarlathotep 1.4 NetBSD 1.4 (NYARLATHOTEP) #10: Wed Dec 15 20:43:55 EST 1999 groo@nyarlathotep:/sysn/arch/i386/compile/NYARLATHOTEP i386
>Description:
Forwarded message, from BUGTRAQ:
---------- Forwarded message ----------
Date: Tue, 29 Feb 2000 17:39:25 +0100
From: Morten Welinder <terra@DIKU.DK>
To: BUGTRAQ@SECURITYFOCUS.COM
Subject: xterm log file vulnerability
It used to be Well Known that xterm's way of opening a log file
was insecure. Well, that was 5+ years ago so I decided to take
a look at the current state of affairs. Things have changed,
but mostly to "different" rather than "better".
Problem: when log files are enabled, they are created in the
following way (checking in XFree86 3.3.6 source; matches Solaris
binaries) and are subject to race conditions:
1. File is checked for existance using access.
2. If file does not exist, it is created in a subprocess using user's
real uid/gid. [ok]
3. File is checked for existance using access.
4. File is checked for write permission using access.
5. File is opened O_WRONLY | O_APPEND. [plonk]
A little symlink magic between 4 and 5 and you have write access to
any file if your xterm is setuid/setgid.
General attack idea:
ls -lL `which xterm`
# If not setuid/setgid, you are safe
touch dummy
symlink-flipflop link dummy /.rhosts
xterm -l -lf link -e echo + +
Moral: access() is totally useless for security purposes. Use it
only as a means of providing better error messages (as it might not
be easy to get an error message out from a subprocess).
Morten
----- End forwarded message -----
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: security-officer->tron
Responsible-Changed-By: tron
Responsible-Changed-When: Tue May 23 05:30:31 PDT 2000
Responsible-Changed-Why:
I'll will import the "xterm" from the XFree86 4.0 sources which includes
a fix for this bug as soon as my CVS access to the XFree86 server works
again.
State-Changed-From-To: open->closed
State-Changed-By: tron
State-Changed-When: Fri May 26 00:19:41 PDT 2000
State-Changed-Why:
Fixed by importing XFree86 4.0 "xterm" sources.
>Unformatted:
(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.