Home    |    View Topics    |    Search    |    Contact Us    |   



Category:   Application (Generic)  >   Perl Vendors:   Wall, Larry
Perl win32_stat() Buffer Overflow May Let Users Execute Arbitrary Code
SecurityTracker Alert ID:  1009663
SecurityTracker URL:
CVE Reference:   CVE-2004-0377   (Links to External Site)
Date:  Apr 5 2004
Impact:   Execution of arbitrary code via local system, Execution of arbitrary code via network, Root access via local system, Root access via network, User access via local system, User access via network
Vendor Confirmed:  Yes  
Version(s): 5.8.3 and prior versions
Description:   iDEFENSE reported a buffer overflow vulnerability in Perl in the win32_stat() function, affecting Windows-based platforms. A user may be able to execute arbitrary code. The specific impact depends on the Perl script implementing the vulnerable function.

It is reported that when a specially crafted filename ending with a backslash character is passed to the function, a buffer overflow can be triggered, potentially resulting in the execution of arbitrary code.

The vendor was reportedly notified on February 25, 2004.

Greg MacManus is credited with discovering this flaw.

Impact:   A user may be able to execute arbitrary code. The specific impact depends on the Perl script implementing the vulnerable function.
Solution:   The vendor reportedly plans to include the fix into core Perl 5.8.4.
Cause:   Boundary error
Underlying OS:  Windows (Any)

Message History:   None.

 Source Message Contents

Subject:  iDEFENSE Security Advisory 04.05.04: Perl win32_stat Function Buffer

Perl win32_stat Function Buffer Overflow Vulnerability

iDEFENSE Security Advisory 04.05.04
April 5, 2004


Perl is a popular programming language due to its text manipulation
capabilities and rapid development cycle. It is open source, cross
platform and used for mission critical projects in the public and
private sector.


Remote exploitation of a buffer overflow in the 'win32_stat' function of
ActiveState's ActivePerl and Larry Wall's Perl could allow for the
execution of arbitrary commands.

If the filename passed to the function ends with a backslash character,
it is copied into a fixed length buffer. There is no check made on the
length of the string before the copy, allowing an excessively long
string to overwrite control information, allowing execution of arbitrary

The problem specifically exists within the win32 wrapper to the stat()
routine and hence the Unix builds of Perl are not affected.


The 'win32_stat' function is a wrapper around the 'stat' function and
the file test operators ('-r', '-w', '-e', '-d' etc) on Win32 based

If a web site contains a Perl script that uses any of these functions
with user supplied pathnames, it may be possible to remotely execute


All versions of Perl for Win32 operating systems up to and including
5.8.3 are affected.


The fix will be incorporated into core Perl 5.8.4. Patches are currently
available at the following locations:

Committed to the Perl 5.9.x development branch:

Integrated into Perl 5.8.x maintenance branch as part of:


The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CAN-2004-0377 to this issue. This is a candidate for inclusion in
the CVE list (, which standardizes names for
security problems.


January 09, 2004     Vulnerability discovered by iDEFENSE
February 25, 2004    Initial vendor contact
February 26, 2004    iDEFENSE clients notified
February 26, 2004    Vendor response
April 05, 2004       Public disclosure


Greg MacManus (iDEFENSE Labs) is credited with this discovery.

Get paid for vulnerability research


Copyright (c) 2004 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email for permission.

Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.


Go to the Top of This SecurityTracker Archive Page

Home   |    View Topics   |    Search   |    Contact Us

This web site uses cookies for web analytics. Learn More

Copyright 2021, LLC