search menu icon-carat-right cmu-wordmark

CERT Coordination Center

HP-UX shar utility creates files with predictable names in "/tmp" directory

Vulnerability Note VU#509454

Original Release Date: 2004-01-23 | Last Revised: 2004-01-23

Overview

The shar program distributed with some versions of the HP-UX operating system creates files insecurely. This vulnerability could allow local users to gain escalated privilege on the system.

Description

shar is a program commonly available on UNIX systems to create a shell script that will recreate a file hierarchy specified by the command line operands. The shar program is often used for distributing a directory of files by FTP or email. The shar program distributed with some versions of the HP-UX operating system creates files with predictable names in the /tmp directory. In environments where multiple users have write access to the /tmp directory, this behavior could be exploited by an attacker to overwrite files with another user's privileges.

Impact

An attacker with the ability to create symbolic links for predictable filenames in the /tmp directory may be able to overwrite files owned by another user. When a shell script generated by the flawed version of the shar program is executed, the symbolic links would be followed and the target files created with the permissions of the user who ran the script.

Solution

Apply a patch from the vendor

Patches that address this vulnerability have been released. Please see the vendor information in the Systems Affected section of this document for more details.

NOTE: After the patches have been applied, Hewlett-Packard recommends that users always specify a secure directory in the TMPDIR environment variable when creating shar archives. Hewlett-Packard also states that shar archives created with previous versions of the shar program will still use the /tmp directory even after the recommended patches are installed. Users are encouraged to inspect existing shar archives and replace references to /tmp with $TMPDIR. This can be accomplished by manually editing the files or with the simple script provided in the Hewlett-Packard bulletin.

Vendor Information

509454
 

Hewlett-Packard Company Affected

Updated:  January 22, 2004

Status

Affected

Vendor Statement

                        HP Support Information Digests

===============================================================================
o  Security Bulletin Digest Split
  ------------------------------


   The security bulletins digest has been split into multiple digests
  based on the operating system (HP-UX, MPE/iX, and HP Secure OS
  Software for Linux).  You will continue to receive all security
  bulletin digests unless you choose to update your subscriptions.  
 
  To update your subscriptions, use your browser to access the
  IT Resource Center on the World Wide Web at:


     http://support.itrc.hp.com/

   Under the Maintenance and Support Menu, click on the "more..." link.
  Then use the 'login' link at the left side of the screen to login
  using your IT Resource Center User ID and Password.


   Under the notifications section (near the bottom of the page), select
  ITRC Maintenance/Support.


   To subscribe or unsubscribe to a specific security bulletin digest,
  select or unselect the checkbox beside it. Then click the
  "Update Subscriptions" button at the bottom of the page.


o  IT Resource Center World Wide Web Service
  ---------------------------------------------------


   If you subscribed through the IT Resource Center and would
  like to be REMOVED from this mailing list, access the
  IT Resource Center on the World Wide Web at:


     http://support.itrc.hp.com/

   Login using your IT Resource Center User ID and Password.
  Then select ITRC Maintenance/Support (located under
  Maintenance and Support).  You may then unsubscribe from the
  appropriate digest.
===============================================================================



Digest Name:  daily HP-UX security bulletins digest
   Created:  Tue Dec  2  6:19:32 EST 2003


Table of Contents:

Document ID      Title
---------------  -----------
HPSBUX0312-304   SSRT3630 Security Vulnerability in shar(1)


The documents are listed below.
-------------------------------------------------------------------------------



Document ID:  HPSBUX0312-304
Date Loaded:  20031201
     Title:  SSRT3630 Security Vulnerability in shar(1)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


 -----------------------------------------------------------------
Source: HEWLETT-PACKARD COMPANY
SECURITY BULLETIN: HPSBUX0312-304
Originally issued: 01 Dec 2003
SSRT3630 Security Vulnerability in shar(1)
-----------------------------------------------------------------


NOTICE: There are no restrictions for distribution of this
Bulletin provided that it remains complete and intact.


The information in the following Security Bulletin should be
acted upon as soon as possible.  Hewlett-Packard Company will
not be liable for any consequences to any customer resulting
from customer's failure to fully implement instructions in this
Security Bulletin as soon as possible.


 -----------------------------------------------------------------
PROBLEM:  shar(1) creates tmp files insecurely.


IMPACT:   Possible filesystem damage, execution of arbitrary
         code, or Denial of Service.


PLATFORM: HP9000 servers running HP-UX versions B.11.00, B.11.04,
         and B.11.11.


SOLUTION: Apply the appropriate patch from itrc.hp.com:
          PHCO_29010    B.11.11
          PHCO_29697    B.11.04
          PHCO_28954    B.11.00


MANUAL ACTIONS: Yes
               If the /tmp directory is not trusted
               specify a trusted directory in the
               TMPDIR environment variable. Shar archives
               which do not use TMPDIR should be modified
               as discussed below.


AVAILABILITY:  All patches are available now on <itrc.hp.com>
-----------------------------------------------------------------
A. Background
   The shar(1) utility, which among other things is used to
   package HP-UX patches, creates temporary files with
   predictable names on /tmp.  If shar files are unpacked on
   a system where /tmp cannot be trusted a potential
   vulnerability exists.


    Shar archives created with the new version of shar(1) can
   specify a safe directory for temporary file creation
   using the TMPDIR environment variable.  Shar archives created
   with previous versions of shar(1) will still use /tmp
   even after the recommended patches are installed.


    There are additions to the man page for shar(1) describing
   the new environment variable TMPDIR.


    The following procedure can be used to replace references to
   /tmp with TMPDIR in existing shar archives.


  $ cat addTMPDIR.awk
 /..@EOF/ {scan_off=1}
 /^@EOF/  {scan_off=0}
 /unpacker <<.@eof./ {scan_off=1}
 {
    if(scan_off != 1) {
      gsub ("/tmp",  "$TMPDIR")
    }
    print $0
 }


  $ cp PHCO_29010 PHCO_29010.orig
 $ export TMPDIR=$HOME
 $ awk -f addTMPDIR.awk PHCO_29010.orig >PHCO_29010
 $ sh PHCO_29010
 x - PHCO_29010.text
 x - PHCO_29010.depot [non-ascii]



    NOTE: This issue does not impact HP Tru64 UNIX nor
         HP NonStop Servers.


    AFFECTED VERSIONS
   The following is a list by HP-UX revision of affected
   filesets and the fileset revision or patch containing the
   fix.  To determine if a system has an affected version,
   search the output of "swlist -a revision -l fileset"
   for an affected fileset, then determine if a fixed
   revision or the applicable patch is installed.


    HP-UX B.11.11
   =============
   OS-Core.CMDS-AUX
   fix: install PHCO_29010 or subsequent and unpack patches
        using the new procedure.


    HP-UX B.11.04
   =============
   OS-Core.CMDS-AUX
   fix: install PHCO_29697 or subsequent and unpack patches
        using the new procedure.


    HP-UX B.11.00
   =============
   OS-Core.CMDS-AUX
   fix: install PHCO_28954 or subsequent and unpack patches
        using the new procedure.


    END AFFECTED VERSIONS

 B. Recommended solution

    Retrieve and install the patches for each applicable release
   from <itrc.hp.com>:


           PHCO_29010    B.11.11
          PHCO_29697    B.11.04
          PHCO_28954    B.11.00


 C. To subscribe to automatically receive future NEW HP Security
   Bulletins from the HP IT Resource Center via electronic
   mail, do the following:


    Use your browser to get to the HP IT Resource Center page
   at:


       http://itrc.hp.com

    Use the 'Login' tab at the left side of the screen to login
   using your ID and password.  Use your existing login or the
   "Register" button at the left to create a login, in order to
   gain access to many areas of the ITRC.  Remember to save the
   User ID assigned to you, and your password.


    In the left most frame select "Maintenance and Support".

    Under the "Notifications" section (near the bottom of
   the page), select "Support Information Digests".


    To -subscribe- to future HP Security Bulletins or other
   Technical Digests, click the check box (in the left column)
   for the appropriate digest and then click the "Update
   Subscriptions" button at the bottom of the page.


    or

    To -review- bulletins already released, select the link
   (in the middle column) for the appropriate digest.


    NOTE: Using your itrc account security bulletins can be
         found here:
   
http://itrc.hp.com/cki/bin/doc.pl/screen=ckiSecurityBulletin


    To -gain access- to the Security Patch Matrix, select
   the link for "The Security Bulletins Archive".  (near the
   bottom of the page)  Once in the archive the third link is
   to the current Security Patch Matrix. Updated daily, this
   matrix categorizes security patches by platform/OS release,
   and by bulletin topic.  Security Patch Check completely
   automates the process of reviewing the patch matrix for
   11.XX systems.  Please note that installing the patches
   listed in the Security Patch Matrix will completely
   implement a security bulletin _only_ if the MANUAL ACTIONS
   field specifies "No."


    The Security Patch Check tool can verify that a security
   bulletin has been implemented on HP-UX 11.XX systems providing
   that the fix is completely implemented in a patch with no
   manual actions required.  The Security Patch Check tool cannot
   verify fixes implemented via a product upgrade.


    For information on the Security Patch Check tool, see:
   
http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/
   displayProductInfo.pl?productNumber=B6834AA


    The security patch matrix is also available via anonymous
   ftp:


    ftp://ftp.itrc.hp.com/export/patches/hp-ux_patch_matrix/

    On the "Support Information Digest Main" page:
   click on the "HP Security Bulletin Archive".


    The PGP key used to sign this bulletin is available from
   several PGP Public Key servers.  The key identification
   information is:


       2D2A7D59
      HP Security Response Team (Security Bulletin signing only)
      <security-alert@hp.com>
      Fingerprint =
        6002 6019 BFC1 BC62 F079 862E E01F 3AFC 2D2A 7D59


    If you have problems locating the key please write to
   security-alert@hp.com.  Please note that this key is
   for signing bulletins only and is not the key returned
   by sending 'get key' to security-alert@hp.com.



 D. To report new security vulnerabilities, send email to

    security-alert@hp.com

    Please encrypt any exploit information using the
   security-alert PGP key, available from your local key
   server, or by sending a message with a -subject- (not body)
   of 'get key' (no quotes) to security-alert@hp.com.


 -----------------------------------------------------------------

(c)Copyright 2003 Hewlett-Packard Company
Hewlett-Packard Company shall not be liable for technical or
editorial errors or omissions contained herein. The information
in this document is subject to change without notice.
Hewlett-Packard Company and the names of HP products referenced
herein are trademarks and/or service marks of Hewlett-Packard
Company.  Other product and company names mentioned herein may be
trademarks and/or service marks of their respective owners.
________________________________________________________________


-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0


iQA/AwUBP8vV7uAfOvwtKn1ZEQIqjQCg2j6mR0i/oAZZgku1hucFqCBW6t8AoMhw
f/vCWtKr9XU89oU2j+WejZ4L
=Vv9D
-----END PGP SIGNATURE-----
-----End of Document ID:  HPSBUX0312-304--------------------------------------

Vendor Information

The vendor has not provided us with any further information regarding this vulnerability.

Addendum

NOTE: The Hewlett-Packard bulletin included above states that shar archives created with previous versions of the shar program will still use the /tmp directory even after the recommended patches are installed. Users are encouraged to inspect existing shar archives and replace references to /tmp with $TMPDIR either manually or with a script.

If you have feedback, comments, or additional information about this vulnerability, please send us email.


CVSS Metrics

Group Score Vector
Base
Temporal
Environmental

References

Acknowledgements

Thanks to the Hewlett-Packard Company for reporting this vulnerability.

This document was written by Chad R Dougherty.

Other Information

CVE IDs: None
Severity Metric: 2.13
Date Public: 2003-12-02
Date First Published: 2004-01-23
Date Last Updated: 2004-01-23 16:12 UTC
Document Revision: 9

Sponsored by CISA.