Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!

TUCoPS :: Unix :: General :: ciacg28a.txt

Update Suidperl Vulnerability


                       The U.S. Department of Energy
                    Computer Incident Advisory Capability
                           ___  __ __    _     ___
                          /       |     /_\   /
                          \___  __|__  /   \  \___

                             INFORMATION BULLETIN

                             suidperl Vulnerability

June 28, 1996 17:00 GMT                                            Number G-28a
PROBLEM:       A vulnerability has been discovered in systems that contain the
               suidperl program and that support saved set_user_ID and saved
PLATFORM:      Any system that Perl versions 4 and 5 can be compiled and
               installed in such a way that they will be vulnerable.
DAMAGE:        By exploiting this vulnerability, anyone with access to an
               account on such a system may gain root access.
SOLUTION:      Install the proper patches and/or use the workarounds provided
VULNERABILITY  Knowledge of how to exploit these vulnerabilities are becoming
ASSESSMENT:    widely known.

CIAC has obtained information from CERT pertaining to vulnerabilities
in systems that contain the suidperl program and that support saved set_user_ID
and saved set_group_ID.  CIAC recommends that you install the proper patch 
and/or follow the solutions described below.

[Begin CERT Bulletin]

The CERT Coordination Center has received reports of a vulnerability in
systems that contain the suidperl program and that support saved
set-user-ID and saved set-group-ID. By exploiting this vulnerability,
anyone with access to an account on such a system may gain root access.

Saved set-user-IDs and set-group-IDs are sometimes referred to as POSIX
saved IDs. suidperl is also known as sperl followed by a version number,
as in sperl5.002.

Perl versions 4 and 5 can be compiled and installed in such a way that
they will be vulnerable on some systems. If you have installed the
suidperl or sperl programs on a system that supports saved set-user-ID and
set-group-ID, you may be at risk.

The CERT Coordination Center recommends that you first disable the
suidperl and sperl programs (Section III.A). If you need the
functionality, we further recommend that you either apply a patch for
this problem or install Perl version 5.003 (Section III.B). If neither
a patch nor a new version are viable alternatives, we recommend 
installing the wrapper written by Larry Wall as a workaround for this
problem (Section III.C).

As we receive additional information relating to this advisory, we will
place it in

We encourage you to check our README files regularly for updates on
advisories that relate to your site.

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

I.   Description

     On some systems, setuid and setgid scripts (scripts written in the
     C shell, Bourne shell, or Perl, for example, with the set user or
     group ID permissions enabled) are insecure due to a race condition in
     the kernel. For those systems, Perl versions 4 and 5 attempt to work
     around this vulnerability with a special program named suidperl, also 
     known as sperl. Even on systems that do provide a secure mechanism for
     setuid and setgid scripts, suidperl may also be installed--although it 
     is not needed. 

     suidperl attempts to emulate the set-user-ID and set-group-ID
     features of the kernel. Depending on whether the script is
     set-user-ID, set-group-ID, or both, suidperl achieves this emulation
     by first changing its effective user or group ID to that of the
     original Perl script. suidperl then reads and executes the script as
     that effective user or group. To do these user and group ID changes
     correctly, suidperl must be installed as set-user-ID root.

     On systems that support saved set-user-ID and set-group-ID, suidperl
     does not properly relinquish its root privileges when changing its
     effective user and group IDs.

II.  Impact

     On a system that has the suidperl or sperl program installed and
     that supports saved set-user-ID and saved set-group-ID, anyone with
     access to an account on the system can gain root access.

III. Solution

     The command in Section A helps you determine if your system is
     vulnerable and, if it is, optionally disables the suidperl and
     sperl programs that it locates. After you have run this command
     on all of your systems, your system will no longer be vulnerable.

     If you find that your system is vulnerable, then you need to replace
     the suidperl and sperl programs with new versions. Section B describes
     how to do that.

     Finally, Section C identifies a wrapper that can be used in place of
     the suidperl program.

     A. How to determine if your system is vulnerable

        To determine if a system is vulnerable to this problem and to
        disable the programs that are believed to be vulnerable, use the
        following find command or a variant. Consult your local system
        documentation to determine how to tailor the find program on your

        You will need to run the find command on each system you maintain
        because the command examines files on the local disk only. Substitute
        the names of your local file systems for FILE_SYSTEM_NAMES in the
        example. Example local file system names are /, /usr, and /var.
        You must do this as root.

        Note that this is one long command, though we have separated
        it onto three lines using back-slashes.

             find FILE_SYSTEM_NAMES -xdev -type f -user root \
                    \( -name 'sperl[0-9].[0-9][0-9][0-9]' -o -name \
                    'suidperl' \) -perm -04000 -print -ok chmod ug-s '{}' \;

        This command will find all files on a system that are
            - only in the file system you name (FILE_SYSTEM_NAMES -xdev)
            - regular files (-type f)
            - owned by root (-user root)
            - named appropriately (-name 'sperl[0-9].[0-9][0-9][0-9]'
                                    -o -name 'suidperl')
            - setuid root (-perm -04000)

        Once found, those files will
            - have their names printed (-print)
            - have their modes changed, but only if you type `y'
              in response to the prompt (-ok chown ug-s '{}' \;)

     B. Obtain and install the appropriate patch according to the
        instructions included with the patch.

        Vendor information
        Apple Computer, Inc.
        A/UX 3.1.1 and earlier support saved set-{user,group}-ids.

        A/UX 3.1.1 and earlier do not have Perl as part of the standard

        Data General Corporation
        Data General does support saved set-user-IDs and set-group-IDs on
        Data General does not ship suidperl or sperl* with DG/UX.

        Digital Equipment Corporation
        Digital UNIX and Digital's ULTRIX Operating systems do support
 	saved suid and saved guid in the process context.
	Digital does not ship Perl with any operating system.

        Hewlett-Packard Company
        HP/UX versions 8.X, 9.X, and 10.X all support saved set-user-id.

        None of HP/UX versions 8.X, 9.X, and 10.X have Perl as part of the
        standard product.

        IBM Corporation
        AIX versions 3.2.5 and 4.X support saved set-user-id.

        AIX versions 3.2.5 and 4.X do not have Perl as part of the standard
        product. However, the SP2's PSSP software does contain suidperl, but
        the program is not installed with the setuid bit set.

        Linux 1.2 and 2.0 support saved set-user-id.

        Most distributions of Linux provide suidperl and sperl.

        The fixsperl script works on linux, and it is recommended that this
        fix be applied until a new Perl release is made.

        Open Software Foundation
        OSF/1 1.3 or later support saved set-user-id

        OSF/1 1.3 or later does not have Perl as part of the standard

        Sony Corporation
        NEWS-OS 4.X does not support saved set-user-id and therefore any
        version of Perl on that system is not vulnerable.

        NEWS-OS 6.X does support saved set-user-id.

        None of's development systems are vulnerable to the saved
        set-user-IDs and set-group-IDs problems, and suidperl is not shipped
        with either of our products.

        Vendor patches
        You may be vulnerable if your vendor supports saved set-user-ID
        and set-group-ID and ships suidperl or sperl. You need to get
        a patched version from your vendor. Appendix A contains
        information provided by vendors as of the date of this advisory.
        When we receive updated information, we will put it in CA-96.12.README.

        Until you can install a patch, we recommend disabling suidperl.
        The find command above will help you do that. If you need
        suidperl or sperl, an alternative is to install the wrapper
        described in Section C.

        Source code patches
        If you have installed Perl from source code, you should install
        source code patches. Patches are available from the CPAN
        (Comprehensive Perl Archive Network) archives.

        Patch for Perl Version 4:
            File                src/fixsuid4-0.pat
            MD5 Checksum        af3e3c40bbaafce134714f1381722496

        Patch for Perl Version 5:
            File                src/fixsuid5-0.pat
            MD5 Checksum        135c96ee400fd37a38a7ef37edd489e9

        In addition, Perl version 5.003 contains this patch, so installing
        it on your system also addresses this vulnerability. Perl 5.003 is
        available from the CPAN archives. Here are the specifics:

            File                src/5.0/perl5.003.tar.gz
            MD5 Checksum        b1bb23995cd25e5b750585bfede0e8a5

        The CPAN archives can be found at the following locations:

        CPAN master site





        North America

        C. If you need setuid or setgid Perl scripts and are unable to apply
           the source code patches listed in Section B, we suggest that you
           retrieve Larry Wall's fixsperl script noted below. fixsperl is a
           script that replaces the suidperl and sperl programs with a wrapper
           that eliminates the vulnerability. The script is available from the
           CPAN archives as

            File                src/fixsperl-0
            MD5 Checksum        f13900d122a904a8453a0af4c1bdddc6

           Note that this script should be run one time, naming every suidperl
           or sperl file on your system. If you add another version of
           suidperl or sperl to your system, then you must run fixsperl 
           on those newly installed versions.


The CERT Coordination Center staff thanks Paul Traina, Larry Wall, Eric
Allman, Tom Christiansen, and AUSCERT for their support in the development
of this advisory.

[End CERT Bulletin]

CIAC has received additional information from FreeBSD, Inc. regarding the
suidperl vulnerability.

[Start FreeBSD Bulletin]

FreeBSD-SA-96:12					    Security Advisory
						        	FreeBSD, Inc.

Topic:		security compromise from perl (suidperl) utility

Category:	core and ports
Module:		perl
Announced:	1996-06-28
Affects:	FreeBSD 2.0, 2.0.5, 2.1, 2.1-stable, and 2.2-current
Corrected:	2.1-stable and 2.2-current as of 1996-06-03
FreeBSD only:	no



I.   Background    

     FreeBSD ships perl version 4 as part of the base level system,
     in addition, a port for perl version 5 is also provided with
     a similar vulnerability.  The vulnerability is specific to the
     suidperl flavors of perl installed on the system.

     This problem is present in all source code and binary
     distributions of FreeBSD version 2.0.5 and later released
     before 1996-05-21.  This problem is not present in FreeBSD
     2.0 and earlier versions of FreeBSD.

II.  Problem Description

     The authors of perl provide a "suidperl" program for proper
     processing of setuid perl scripts on systems where race
     conditions where setuid scripts could be exploited to gain
     unauthorized access.  FreeBSD installs this suidperl program
     (and a link) as part of the standard installation.  However,
     privilege processing done by this program does not take into
     account recent functionality extensions in the seteuid/setegid
     system calls.

III. Impact

     This vulnerability can only be exploited by users with a valid
     account on the local system to easily obtain superuser access.

     This vulnerability is present on all systems with the
     _POSIX_SAVED_IDS functionality extension where suidperl
     has been installed.

IV. Workaround

     One may simply disable the setuid bit on all copies of the setuid
     version of perl.  This will close the vulnerability but render
     inoperable setuid perl scripts.  No software currently shipping
     as part of FreeBSD relies on this functionality so the impact is
     only to third party software.

     As root, execute the commands:

	 # chmod 111 /usr/bin/suidperl
	 # chmod 111 /usr/bin/sperl4.036

     In addition, if you have installed the perl5 port:
	 # chmod 111 /usr/local/bin/suidperl
	 # chmod 111 /usr/local/bin/sperl5.001

     then verify that the setuid permissions of the files have been
     removed.  The permissions array should read "-r-xr-xr-x" as
     shown here:

	 # ls -l /usr/bin/s*perl*
	 ---x--x--x  2 root  bin  307200 Jun  1 17:16 /usr/bin/sperl4.036
	 ---x--x--x  2 root  bin  307200 Jun  1 17:16 /usr/bin/suidperl

     and for the perl5 port:

	 # ls -l /usr/local/bin/s*perl*
	 ---x--x--x  2 root  bin  397312 Jan 22 15:15 /usr/local/bin/sperl5.001
	 ---x--x--x  2 root  bin  397312 Jan 22 15:15 /usr/local/bin/suidperl

V. Solution

     *NOTE* A patch for perl is available directly from Larry Wall
     (the author of perl) which solves this vulnerability in a
     different fashion than the FreeBSD patches.  You may apply
     either the FreeBSD patches, or Larry's patches, or both.
     The patches solve the problem via two different mechanisms.

     Patches are available which eliminate this vulnerability.
     The following patch should be applied to the system sources and
     suidperl should be rebuilt and reinstalled.

     Apply the patch, then:
	# cd /usr/src/gnu/usr.bin/perl/sperl
	# make depend
	# make all
	# make install

     A similar patch is also available for the perl5 port.
     Apply the following patch by moving it into the patch
     directory for the port distribution and rebuilding and
     installing perl5:

	# cd /usr/ports/lang/perl5
	# cp <location of new patches>/patch-a[ab] patches
	# make all
	# make install

     NOTE: These patches do NOT solve the vulnerability for FreeBSD 2.0
	   or 2.0.5.  These only solve the problem for 2.1 and later.
	   Patches specific to FreeBSD 2.0 and 2.0.5 are available at
	   the URL listed at the top of this file.

FreeBSD, Inc.

Web Site:
Confidential contacts:
PGP Key:
Security notifications:
Security public discussion:

Notice: Any patches in this document may not apply cleanly due to
        modifications caused by digital signature or mailer software.
        Please reference the URL listed at the top of this document
        for original copies of all patches if necessary.

[End FreeBSD Bulletin]

CIAC wishes to acknowledge the contributions of CERT, AUSCERT, Paul Traina,
Larry Wall, Eric Allman, Tom Christiansen, FreeBSD, and all the other
vendors who provided information contained in this bulletin.

CIAC, the Computer Incident Advisory Capability, is the computer
security incident response team for the U.S. Department of Energy
(DOE) and the emergency backup response team for the National
Institutes of Health (NIH). CIAC is located at the Lawrence Livermore
National Laboratory in Livermore, California. CIAC is also a founding
member of FIRST, the Forum of Incident Response and Security Teams, a
global organization established to foster cooperation and coordination
among computer security teams worldwide.

CIAC services are available to DOE, DOE contractors, and the NIH. CIAC
can be contacted at:
    Voice:    +1 510-422-8193
    FAX:      +1 510-423-8002
    STU-III:  +1 510-423-2604

For emergencies and off-hour assistance, DOE, DOE contractor sites,
and the NIH may contact CIAC 24-hours a day. During off hours (5PM -
8AM PST), call the CIAC voice number 510-422-8193 and leave a message,
or call 800-759-7243 (800-SKY-PAGE) to send a Sky Page. CIAC has two
Sky Page PIN numbers, the primary PIN number, 8550070, is for the CIAC
duty person, and the secondary PIN number, 8550074 is for the CIAC
Project Leader.

Previous CIAC notices, anti-virus software, and other information are
available from the CIAC Computer Security Archive.

   World Wide Web:
   Anonymous FTP: (
   Modem access:        +1 (510) 423-4753 (28.8K baud)
                        +1 (510) 423-3331 (28.8K baud)

CIAC has several self-subscribing mailing lists for electronic
1. CIAC-BULLETIN for Advisories, highest priority - time critical
   information and Bulletins, important computer security information;
2. CIAC-NOTES for Notes, a collection of computer security articles;
3. SPI-ANNOUNCE for official news about Security Profile Inspector
   (SPI) software updates, new features, distribution and
4. SPI-NOTES, for discussion of problems and solutions regarding the
   use of SPI products.

Our mailing lists are managed by a public domain software package
called ListProcessor, which ignores E-mail header subject lines. To
subscribe (add yourself) to one of our mailing lists, send the
following request as the E-mail message body, substituting
valid information for LastName FirstName and PhoneNumber when sending

E-mail to
        subscribe list-name LastName, FirstName PhoneNumber
  e.g., subscribe ciac-notes OHara, Scarlett W. 404-555-1212 x36

You will receive an acknowledgment containing address, initial PIN,
and information on how to change either of them, cancel your
subscription, or get help.

PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing
communities receive CIAC bulletins.  If you are not part of these
communities, please contact your agency's response team to report
incidents. Your agency's team will coordinate with CIAC. The Forum of
Incident Response and Security Teams (FIRST) is a world-wide
organization. A list of FIRST member organizations and their
constituencies can be obtained by sending email to with an empty subject line and a message body
containing the line: send first-contacts.

This document was prepared as an account of work sponsored by an
agency of the United States Government. Neither the United States
Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any
legal liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process
disclosed, or represents that its use would not infringe privately
owned rights. Reference herein to any specific commercial products,
process, or service by trade name, trademark, manufacturer, or
otherwise, does not necessarily constitute or imply its endorsement,
recommendation or favoring by the United States Government or the
University of California. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the United States
Government or the University of California, and shall not be used for
advertising or product endorsement purposes.

LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC)

G-18: Digital OSF/1 dxconsole Security Vulnerability
G-19: IBM AIX rmail Vulnerability
G-20: Vulnerability in NCSA and Apache httpd Servers
G-21: Vulnerabilities in PCNFSD Program
G-22: rpc.statd Vulnerability
G-23: Solaris NIS+ Configuration Vulnerability
G-24: FreeBSD Security Vulnerabilities
G-25: SUN statd Program Vulnerability
G-26: IRIX Desktop Permissions Panel Vulnerability
G-27: SCO Kernel Security Vulnerability

RECENT CIAC NOTES ISSUED (Previous Notes available from CIAC)

Notes 07 - 3/29/95     A comprehensive review of SATAN

Notes 08 - 4/4/95      A Courtney update

Notes 09 - 4/24/95     More on the "Good Times" virus urban legend

Notes 10 - 6/16/95     PKZ300B Trojan, Logdaemon/FreeBSD, vulnerability
                       in S/Key, EBOLA Virus Hoax, and Caibua Virus

Notes 11 - 7/31/95     Virus Update, Hats Off to Administrators,
                       America On-Line Virus Scare, SPI 3.2.2 Released,
                       The Die_Hard Virus

Notes 12 - 9/12/95     Securely configuring Public Telnet Services, X
                       Windows, beta release of Merlin, Microsoft Word
                       Macro Viruses, Allegations of Inappropriate Data
                       Collection in Win95

Notes 96-01 - 3/18/96  Java and JavaScript Vulnerabilities, FIRST
                       Conference Announcement, Security and Web Search
                       Engines, Microsoft Word Macro Virus Update

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2014 AOH