Redhat: 'tmpwatch' vulnerability
Posted by LinuxSecurity.com Team   
RedHat Linux tmpwatch as shipped in Red Hat Linux 6.1, 6.2, and 7.0 uses fork() to recursively process subdirectories, enabling a local user to perform a denial of service attack.

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

Synopsis:          tmpwatch has a local denial of service and root exploit
Advisory ID:       RHSA-2000:080-01
Issue date:        2000-10-06
Updated on:        2000-10-06
Product:           Red Hat Linux
Keywords:          tmpwatch, fuser, DoS, fork
Cross references:  N/A
---------------------------------------------------------------------

1. Topic:

tmpwatch as shipped in Red Hat Linux 6.1, 6.2, and 7.0 uses fork() to
recursively process subdirectories, enabling a local user to perform a
denial of service attack.  Tmpwatch from Red Hat Linux 6.2 and 7.0 also
contains an option to allow it to use the fuser command to check for open
files before removal. It executed fuser in an insecure fashion, allowing a
local root exploit.

2. Relevant releases/architectures:

Red Hat Linux 6.1 - i386, alpha, sparc
Red Hat Linux 6.2 - i386, alpha, sparc
Red Hat Linux 7.0 - i386

3. Problem description:

The tmpwatch program periodically cleans up files in temporary directories
by removing all files older than a certain age.  In Red Hat Linux 6.1, 6.2,
and 7.0, it used fork() to recursively process subdirectories.  If a
malicious user created many layers of subdirectories (thousands) in a
temporary directory monitored by tmpwatch, the system process table would
fill up, requiring a reboot.

Additionally, tmpwatch in 6.2 and 7.0 contains an option, "--fuser", that
attempts to user the fuser command to check if a file is in use before
removal.  However, it executed fuser with the system() call in an insecure
fashion.  A malicious user could construct an environment such that this
provided them a local root shell.  Tmpwatch now uses execle() to run fuser.

4. Solution:

For each RPM for your particular architecture, run:

rpm -Fvh [filename]

where filename is the name of the RPM.

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

17286 - tmpwatch run from cron allows locale DoS.


6. RPMs required:

Red Hat Linux 6.2:

alpha: 
ftp://updates.Red Hat.com/6.2/alpha/tmpwatch-2.6.2-1.6.2.alpha.rpm

sparc: 
ftp://updates.Red Hat.com/6.2/sparc/tmpwatch-2.6.2-1.6.2.sparc.rpm

i386: 
ftp://updates.Red Hat.com/6.2/i386/tmpwatch-2.6.2-1.6.2.i386.rpm

sources: 
ftp://updates.Red Hat.com/6.2/SRPMS/tmpwatch-2.6.2-1.6.2.src.rpm

Red Hat Linux 7.0:

i386: 
ftp://updates.Red Hat.com/7.0/i386/tmpwatch-2.6.2-1.7.i386.rpm

sources: 
ftp://updates.Red Hat.com/7.0/SRPMS/tmpwatch-2.6.2-1.7.src.rpm

7. Verification:

MD5 sum                           Package Name
--------------------------------------------------------------------------
b8a670944cc54fd39c9eefb79f147ec1  6.2/SRPMS/tmpwatch-2.6.2-1.6.2.src.rpm
39fe4fbf666e5f9a40503134c05046d8  6.2/alpha/tmpwatch-2.6.2-1.6.2.alpha.rpm
84609abc355fde23ce878e4d310766f8  6.2/i386/tmpwatch-2.6.2-1.6.2.i386.rpm
f4625e9bc27af011a614eaa146586917  6.2/sparc/tmpwatch-2.6.2-1.6.2.sparc.rpm
b1a9201c44a5f921209c9b648ba85ada  7.0/SRPMS/tmpwatch-2.6.2-1.7.src.rpm
8acf394469c47a98fcc589dd0d73b98c  7.0/i386/tmpwatch-2.6.2-1.7.i386.rpm

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

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

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 

8. References:

Thanks go to Internet Security System's X-Force team (xforce@iss.net) for
discovering and documenting the local root exploit.


Copyright(c) 2000 Red Hat, Inc.