-----BEGIN PGP SIGNED MESSAGE-----

===========================================================================
              AUSCERT External Security Bulletin Redistribution
                             
                  ESB-2000.159 -- FreeBSD-SA-00:24.libedit
              libedit reads config file from current directory
                                 6 July 2000

===========================================================================

	AusCERT Security Bulletin Summary
	---------------------------------

Product:		libedit
Vendor:			FreeBSD
Operating System:	FreeBSD
Platform:		N/A

Impact:			Increased Privileges
Access Required:	Existing User

- --------------------------BEGIN INCLUDED TEXT--------------------

- -----BEGIN PGP SIGNED MESSAGE-----

=============================================================================
FreeBSD-SA-00:24                                           Security Advisory
                                                                FreeBSD, Inc.

Topic:		libedit reads config file from current directory

Category:	core
Module:		libedit
Announced:	2000-07-05
Affects:	All versions of FreeBSD prior to the correction date
Credits:	Tim Vanderhoek <hoek@FreeBSD.org>
Vendor status:	Notified
Corrected:	2000-05-22
FreeBSD only:	NO

I.   Background

libedit is a library of routines for providing command editing and
history retrieval for interactive command-oriented programs.

II.  Problem Description

libedit incorrectly reads an ".editrc" file in the current directory
if it exists, in order to specify configurable program
behaviour. However it does not check for ownership of the file, so an
attacker can cause a libedit application to execute arbitrary key
rebindings and exercise terminal capabilities by creating an .editrc
file in a directory from which another user executes a libedit binary
(e.g. root running ftp(1) from /tmp). This can be used to fool the
user into unknowingly executing program commands which may compromise
system security. For example, ftp(1) includes the ability to escape to
a shell and execute a command, which can be done under libedit
control.

The supplied patch removes this behaviour and causes libedit to only
search for its configuration file in the home directory of the user,
if it exists and the binary is not running with increased privileges
(i.e. setuid or setgid).

FreeBSD 3.5-RELEASE is not affected by this vulnerability, although
4.0-RELEASE is affected since the problem was discovered after it was
released.

III. Impact

An attacker can cause a user to execute arbitrary commands within a
program which is run from a directory to which the attacker has write
access, potentially leading to system compromise if run as a
privileged user (such as root).

IV.  Workaround

Do not interactively run utilities which link against libedit from
directories which can be written to by other users.

To identify utilities which link dynamically against libedit, download
the libfind tool and detached PGP signature as follows: 

# fetch ftp://ftp.freebsd.org/pub/FreeBSD/CERT/tools/SA-00:24/libfind.sh
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/CERT/tools/SA-00:24/libfind.sh.asc

Verify the detached signature using your PGP utility.

Run the libfind.sh tool as root, as follows:

# sh libfind.sh libedit /

Note that it is not feasible to locate utilities which link statically
against libedit since there are no common strings embedded in such
binaries. However the following is believed to be a complete list of
statically and dynamically linked FreeBSD system utilities which link
against the library:

/bin/sh
/sbin/fsdb
/usr/bin/ftp
/usr/sbin/cdcontrol
/usr/sbin/lpc
/usr/sbin/nslookup
/usr/sbin/pppctl

Because libedit is not a portable library in common use there are
unlikely to be many FreeBSD ports which link statically against it: no
such ports are known at this time.

V.   Solution

One of the following:

1) Upgrade your vulnerable system to a version dated after the
correction date.

2) Save the advisory into a file or download the patch and detached
PGP signature:

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-00:24/libedit.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-00:24/libedit.patch.asc

Verify the detached PGP signature using your PGP utility.

Apply the patch and rebuild as follows:

# cd /usr/src/lib/libedit
# patch -p < /path/to/patch/or/advisory

and rebuild your system as described in 

http://www.freebsd.org/handbook/makeworld.html

    --- el.c	1999/08/20 01:17:12	1.6
    +++ el.c	2000/05/22 05:55:22	1.7
    @@ -290,13 +294,10 @@
         char *ptr, path[MAXPATHLEN];
     
         if (fname == NULL) {
    -	fname = &elpath[1];
    -	if ((fp = fopen(fname, "r")) == NULL) {
    -	    if (issetugid() != 0 || (ptr = getenv("HOME")) == NULL)
    -		return -1;
    -	    (void)snprintf(path, sizeof(path), "%s%s", ptr, elpath);
    -	    fname = path;
    -	}
    +	if (issetugid() != 0 || (ptr = getenv("HOME")) == NULL)
    +	    return -1;
    +	(void) snprintf(path, sizeof(path), "%s%s", ptr, elpath);
    +	fname = path;
         }
     
         if ((fp = fopen(fname, "r")) == NULL)
    

- -----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBOWGmz1UuHi5z0oilAQF1rwP/QhuVAAmc1873YHkhTS8kMTPR63HoIlkc
8VRgf0PU6Z3AObVq6fjt3ZikCUXf7d8NhiTqRdL1Cb/Koai56yP+E5Fqbt2U5JCC
cNbWIlI8NYKxAybgOsx+9EJGSnGfrjjjvxG6MguwcyJ+W1DS3M41mDzv8C1hdpqw
/QAi9qToH+Q=
=TlZc
- -----END PGP SIGNATURE-----

- --------------------------END INCLUDED TEXT--------------------

This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content.  The decision to use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the original authors to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

	http://www.auscert.org.au/Information/advisories.html

If you believe that your system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security
Teams).

Internet Email: auscert@auscert.org.au
Facsimile:	(07) 3365 7031
Telephone:	(07) 3365 4417 (International: +61 7 3365 4417)
		AusCERT personnel answer during Queensland business hours
		which are GMT+10:00 (AEST).
		On call after hours for emergencies.


-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key

iQCVAwUBOXXT1ih9+71yA2DNAQE9bAP+LKj4P2FPsUO5udfKwJ+T1aCqQKIfH+ke
LASaoEe7BnSy8O6c4km7ICveAm16PjjChhliuui/xvJhvT3pjNiD1cTA54Y2xJLv
D9lWZv4ZPWFObhlhxl5S2fqs6FuT+XOe5qhXDsCl9mfENESL2PDBMGNiZI5xx5pp
r2CX9pZsoaM=
=2QpV
-----END PGP SIGNATURE-----