search menu icon-carat-right cmu-wordmark

CERT Coordination Center

Perl vulnerable to buffer overflow in win32_stat()

Vulnerability Note VU#722414

Original Release Date: 2004-06-09 | Last Revised: 2004-07-16


A flaw in a standard function in some Perl distributions could allow an attacker to execute arbitrary code on the vulnerable system.


The stat() Perl function, similar to the standard C stat() function, returns a list giving the status info for a file. Since the stat() function is UNIX-centric, some Perl distributions supply a function named win32_stat() that provides a wrapper around the stat() function for systems running Perl on Windows operating systems. A buffer overflow flaw in the way win32_stat() handles long filenames could allow an attacker to execute code on a system running an application that used the function.

Note that because this flaw exists in the Perl system itself, a vulnerability is only exposed through a Perl application that invokes win32_stat() (either explicitly or implicitly) on a filename supplied by the user. Since the flawed code does not get complied into Perl builds for UNIX systems, only systems running Perl on Windows are affected.


An attacker may be able to execute arbitrary code in the context of an application that uses the vulnerable function. The scope of the impact depends on how the affected application works. Applications that process filename input from the network, such as some web applications, would be vulnerable to a remote attacker. Applications that only process filename input from a local user would only be vulnerable to a local attacker.


Apply a patch

Patches have been developed to address this issue. For more information, see:

<> (for the 5.9.x branch)
<> (for the 5.8.x branch)

Note that these patches require the user to recompile the Perl interpreter for their system after application.

Vendor Information

CVSS Metrics

Group Score Vector



Thanks to Greg MacManus of iDEFENSE Labs for reporting this vulnerability.

This document was written by Chad R Dougherty based primarily on information provided by iDEFENSE.

Other Information

CVE IDs: CVE-2004-0377
Severity Metric: 13.50
Date Public: 2004-05-05
Date First Published: 2004-06-09
Date Last Updated: 2004-07-16 14:13 UTC
Document Revision: 21

Sponsored by CISA.