|
![]() ![]() |
CERT® Advisory CA-1996-12 Vulnerability in suidperlOriginal issue date: June 26, 1996Last revised: September 24, 1997 Updated copyright statement A complete revision history is at the end of this file. 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). We will update this advisory as we receive additional information. Please check advisory files regularly for updates that relate to your site. I. DescriptionOn 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. ImpactOn 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. SolutionThe 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 vulnerableTo 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 system. 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
B. Obtain and install the appropriate patch according to the instructions included with the patch.Vendor patchesYou 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 the following vendors. If you vendor is not on this list, please contact the vendor directly. Vendor or Source
Data General Corp. Digital Equipment Corp. FreeBSD, Inc. Hewlett-Packard Company IBM Corporation Linux NEC Open Software Foundation Sony Corporation X.org Source code patchesIf 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:
Patch for Perl Version 5:
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:
The CPAN archives can be found at the following locations: CPAN master site
Africa Asia
Australasia
Europe
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
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.
Appendix A: Vendor InformationBelow is information we have received from vendors concerning the vulnerability described in this advisory. If you do not see your vendor's name, please contact the vendor directly for 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 product. Data General CorporationData General does support saved set-user-IDs and set-group-IDs on DG/UX.Data General does not ship suidperl or sperl* with DG/UX. Digital Equipment CorporationDigital 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. FreeBSD, Inc.This information is taken from FreeBSD advisory SA-96:12.For the complete text of the advisory, please refer to This vulnerability is present on all systems with the
One may 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/sperl4.036
# chmod 111 /usr/local/bin/sperl5.001 # ls -l /usr/bin/s*perl*
and for the perl5 port: # ls -l /usr/local/bin/s*perl*
Other information: *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:
Apply the following patch by moving it into the patch directory for the port distribution and rebuilding and installing perl5:
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 above. Hewlett-Packard CompanyHP/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 CorporationAIX 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. LinuxLinux 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. NEC
Open Software FoundationOSF/1 1.3 or later support saved set-user-idOSF/1 1.3 or later does not have Perl as part of the standard product. Sony CorporationNEWS-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. X.orgNone of X.org'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.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. This document is available from: http://www.cert.org/advisories/CA-1996-12.html CERT/CC Contact Information
Phone: +1 412-268-7090 (24-hour hotline) Fax: +1 412-268-6989 Postal address: CERT/CC personnel answer the hotline 08:00-17:00 EST(GMT-5) / EDT(GMT-4) Monday through Friday; they are on call for emergencies during other hours, on U.S. holidays, and on weekends. Using encryptionWe strongly urge you to encrypt sensitive information sent by email. Our public PGP key is available from If you prefer to use DES, please call the CERT hotline for more information. Getting security informationCERT publications and other security information are available from our web site
* "CERT" and "CERT Coordination Center" are registered in the U.S. Patent and Trademark Office.
NO WARRANTY Conditions for use, disclaimers, and sponsorship information
Copyright 1996 Carnegie Mellon University. Revision History
Sep. 24, 1997 Updated copyright statement
Aug. 30, 1996 Information previously in the README was inserted into
the advisory.
July 01, 1996 Appendix, FreeBSD - added an entry for this vendor.
June 27, 1996 Appendix, NEC - added an entry for this vendor.
June 26, 1996 Appendix, Digital - added an entry for this vendor.
|










