Vulnerability Note VU#722414

Perl vulnerable to buffer overflow in win32_stat()

Original Release date: 09 Jun 2004 | Last revised: 16 Jul 2004


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:

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

Systems Affected (Learn More)

No information available. If you are a vendor and your product is affected, let us know.

CVSS Metrics (Learn More)

Group Score Vector
Base N/A N/A
Temporal N/A N/A
Environmental N/A N/A



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: CAN-2004-0377
  • Date Public: 05 May 2004
  • Date First Published: 09 Jun 2004
  • Date Last Updated: 16 Jul 2004
  • Severity Metric: 13.50
  • Document Revision: 20


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