search menu icon-carat-right cmu-wordmark

CERT Coordination Center

util-linux package vulnerable to privilege escalation when "ptmptmp" file is not removed properly when using "chfn" utility

Vulnerability Note VU#405955

Original Release Date: 2002-07-29 | Last Revised: 2003-05-30

Overview

The util-linux package contains a race condition vulnerability that can be used to elevate privileges on the system.

Description

util-linux is shipped with Red Hat Linux and numerous other Linux distributions. It contains a collection of utility programs, such as fstab, mkfs, and chfn. The BindView RAZOR Team has discovered that because setpwnam.c inadequately locks a temporary file used when making changes to /etc/passwd, a race condition can be used to elevate privileges on the system.

For further details, please see the Bindview Advisory.

Impact

A local user may be able to elevate their privileges on the system.

Solution

Apply a patch from your vendor, or, an immediate workaround (provided by BindView) is to remove setuid flags from /usr/bin/chfn and /usr/bin/chsh. To remediate the vulnerability, patch the source code as follows.

--- util-linux-2.11n-old/login-utils/setpwnam.c Mon Jul 31 08:50:39 2000
+++ util-linux-2.11n/login-utils/setpwnam.c     Wed Jun 12 21:37:12 2002
@@ -98,7 +98,8 @@
    /* sanity check */
    for (x = 0; x < 3; x++) {
       if (x > 0) sleep(1);
-       fd = open(PTMPTMP_FILE, O_WRONLY|O_CREAT, 0644);
+        // Never share the temporary file.
+       fd = open(PTMPTMP_FILE, O_WRONLY|O_CREAT|O_EXCL, 0644);
       if (fd == -1) {
           umask(oldumask);
           return -1;

Vendor Information

405955
 

View all 43 vendors View less vendors


CVSS Metrics

Group Score Vector
Base
Temporal
Environmental

References

Acknowledgements

Thanks to Michal Zalewski, BindView RAZOR, for reporting this vulnerability.

This document was written by Ian A Finlay.

Other Information

CVE IDs: CVE-2002-0638
Severity Metric: 10.97
Date Public: 2002-07-29
Date First Published: 2002-07-29
Date Last Updated: 2003-05-30 17:13 UTC
Document Revision: 19

Sponsored by CISA.