[LWN Logo]
[Timeline]
Date:         Wed, 4 Oct 2000 13:01:00 -0400
Subject:      [RHSA-2000:066-03] lpr has a format string security bug,
To: BUGTRAQ@SECURITYFOCUS.COM

---------------------------------------------------------------------
                   Red Hat, Inc. Security Advisory

Synopsis:          lpr has a format string security bug, LPRng compat issues, an
d a race cond.
Advisory ID:       RHSA-2000:066-03
Issue date:        2000-09-25
Updated on:        2000-10-04
Product:           Red Hat Linux
Keywords:          lpr security lpd LPRng
Cross references:  N/A
---------------------------------------------------------------------

1. Topic:

lpr has a format string security bug.  It also mishandles any extension to
the lpd communication protocol, and assumes that the instructions contained
in the extension are a file it should try to print.  It also has a race
condition in the handling of queue interactions that can cause the queue to
wedge.

2. Relevant releases/architectures:

Red Hat Linux 5.0 - i386, alpha
Red Hat Linux 5.1 - i386, alpha, sparc
Red Hat Linux 5.2 - i386, alpha, sparc
Red Hat Linux 6.0 - i386, alpha, sparc
Red Hat Linux 6.1 - i386, alpha, sparc
Red Hat Linux 6.2 - i386, alpha, sparc

3. Problem description:

The old BSD-based lpr which we shipped with Red Hat Linux 5.x and 6.x has a
recently discovered format string bug in its calls to the syslog facility.
While we are not aware of any exploits for this issue, it might be possible
for a user to gain local root access.  For this reason, upgrading to the
new lpr is strongly encouraged.

Additionally, lpr did not properly handle extensions to the lpd protocol.
LPRng, an advanced replacement for lpr included in Red Hat Linux 7, makes
use of extensions.  The lpr included in Red Hat Linux 6.2 and earlier will
not recognize these extensions, and attempt to handle the instructions as
if they were a file to be printed.  As a result, the lpr system sends out
three of the following email messages per print job:

Date: Thu, 10 Aug 2000 21:36:32 -0400
From: bin <bin@redhat.com>
Reply-To: root@yyyyy.redhat.com
To: xxxx@xxxxxx.redhat.com
Subject: lp printer job "(stdin)"

Your printer job ((stdin))
was not printed because the daemon could not stat the file

Additionaly, a race condition exists in the contention for the lock file,
making it posible for the queue to get into a wedged state.

These problems are now fixed.

4. Solution:

For each RPM for your particular architecture, run:

rpm -Fvh [filename]

where filename is the name of the RPM.

Additionally, after upgrading, you will want to restart your "lpd" service
by executing the following as root:

/etc/rc.d/init.d/lpd restart

If you do not need printing at all on your system, we recommend you remove
the lpr print system:

/etc/rc.d/init.d/lpd stop
rpm -e lpr

5. Bug IDs fixed (http://bugzilla.redhat.com/bugzilla for more info):

16032 - LPRng lpd/BSD lpd generate stat errors in LPRng->BSD queue interactions.
11740 - Race condition in locking for LPD
16725 - BSD lpr 0.50-5 Errata Tracking Bug


6. RPMs required:

Red Hat Linux 5.2:

alpha:
ftp://updates.redhat.com/5.2/alpha/lpr-0.50-7.alpha.rpm

sparc:
ftp://updates.redhat.com/5.2/sparc/lpr-0.50-7.sparc.rpm

i386:
ftp://updates.redhat.com/5.2/i386/lpr-0.50-7.i386.rpm

sources:
ftp://updates.redhat.com/5.2/SRPMS/lpr-0.50-7.src.rpm

Red Hat Linux 6.2:

alpha:
ftp://updates.redhat.com/6.2/alpha/lpr-0.50-7.alpha.rpm

sparc:
ftp://updates.redhat.com/6.2/sparc/lpr-0.50-7.sparc.rpm

i386:
ftp://updates.redhat.com/6.2/i386/lpr-0.50-7.i386.rpm

sources:
ftp://updates.redhat.com/6.2/SRPMS/lpr-0.50-7.src.rpm

7. Verification:

MD5 sum                           Package Name
--------------------------------------------------------------------------
8320299c73f4fb86ba0ff8738eb363b5  5.2/SRPMS/lpr-0.50-7.src.rpm
ed03f53623add36f3b6da694c49c89c2  5.2/alpha/lpr-0.50-7.alpha.rpm
bf72425f9ddb0f8d9e2643fbea360f23  5.2/i386/lpr-0.50-7.i386.rpm
cc2da623757572ed07ab4d88c57422ae  5.2/sparc/lpr-0.50-7.sparc.rpm
f6082e546a94575ab4c147bc9440bdd1  6.2/SRPMS/lpr-0.50-7.src.rpm
eaade33acd33346611b7171c2dd7ea03  6.2/alpha/lpr-0.50-7.alpha.rpm
542a70425ac1b75fb78880fc08f01986  6.2/i386/lpr-0.50-7.i386.rpm
81a48e5d2d91d54d4ea8a4f9c89d5a41  6.2/sparc/lpr-0.50-7.sparc.rpm

These packages are GPG signed by Red Hat, Inc. for security.  Our key
is available at:
    http://www.redhat.com/corp/contact.html

You can verify each package with the following command:
    rpm --checksig  <filename>

If you only wish to verify that each package has not been corrupted or
tampered with, examine only the md5sum with the following command:
    rpm --checksig --nogpg <filename>

8. References:

Thanks go to Chris Evans <chris@scary.beasts.org> for spotting this in the
OpenBSD lpr CVS commit logs, and verifying the problem existed for Linux as
well.


Copyright(c) 2000 Red Hat, Inc.