Security Advisories (19)
CVE-2016-6185 (2016-08-02)

The XSLoader::load method in XSLoader in Perl does not properly locate .so files when called in a string eval, which might allow local users to execute arbitrary code via a Trojan horse library under the current working directory.

CVE-2020-12723 (2020-06-05)

regcomp.c in Perl before 5.30.3 allows a buffer overflow via a crafted regular expression because of recursive S_study_chunk calls.

CVE-2020-10878 (2020-06-05)

Perl before 5.30.3 has an integer overflow related to mishandling of a "PL_regkind[OP(n)] == NOTHING" situation. A crafted regular expression could lead to malformed bytecode with a possibility of instruction injection.

CVE-2020-10543 (2020-06-05)

Perl before 5.30.3 on 32-bit platforms allows a heap-based buffer overflow because nested regular expression quantifiers have an integer overflow.

CVE-2018-6798 (2018-04-17)

An issue was discovered in Perl 5.22 through 5.26. Matching a crafted locale dependent regular expression can cause a heap-based buffer over-read and potentially information disclosure.

CVE-2018-6797 (2018-04-17)

An issue was discovered in Perl 5.18 through 5.26. A crafted regular expression can cause a heap-based buffer overflow, with control over the bytes written.

CVE-2018-6913 (2018-04-17)

Heap-based buffer overflow in the pack function in Perl before 5.26.2 allows context-dependent attackers to execute arbitrary code via a large item count.

CVE-2018-18314 (2018-12-07)

Perl before 5.26.3 has a buffer overflow via a crafted regular expression that triggers invalid write operations.

CVE-2018-18313 (2018-12-07)

Perl before 5.26.3 has a buffer over-read via a crafted regular expression that triggers disclosure of sensitive information from process memory.

CVE-2018-18312 (2018-12-05)

Perl before 5.26.3 and 5.28.0 before 5.28.1 has a buffer overflow via a crafted regular expression that triggers invalid write operations.

CVE-2018-18311 (2018-12-07)

Perl before 5.26.3 and 5.28.x before 5.28.1 has a buffer overflow via a crafted regular expression that triggers invalid write operations.

CVE-2017-12883 (2017-09-19)

Buffer overflow in the S_grok_bslash_N function in regcomp.c in Perl 5 before 5.24.3-RC1 and 5.26.x before 5.26.1-RC1 allows remote attackers to disclose sensitive information or cause a denial of service (application crash) via a crafted regular expression with an invalid '\\N{U+...}' escape.

CVE-2017-12837 (2017-09-19)

Heap-based buffer overflow in the S_regatom function in regcomp.c in Perl 5 before 5.24.3-RC1 and 5.26.x before 5.26.1-RC1 allows remote attackers to cause a denial of service (out-of-bounds write) via a regular expression with a '\\N{}' escape and the case-insensitive modifier.

CVE-2015-8853 (2016-05-25)

The (1) S_reghop3, (2) S_reghop4, and (3) S_reghopmaybe3 functions in regexec.c in Perl before 5.24.0 allow context-dependent attackers to cause a denial of service (infinite loop) via crafted utf-8 data, as demonstrated by "a\x80."

CVE-2023-47100

In Perl before 5.38.2, S_parse_uniprop_string in regcomp.c can write to unallocated space because a property name associated with a \p{...} regular expression construct is mishandled. The earliest affected version is 5.30.0.

CVE-2024-56406 (2025-04-13)

A heap buffer overflow vulnerability was discovered in Perl. When there are non-ASCII bytes in the left-hand-side of the `tr` operator, `S_do_trans_invmap` can overflow the destination pointer `d`.    $ perl -e '$_ = "\x{FF}" x 1000000; tr/\xFF/\x{100}/;'    Segmentation fault (core dumped) It is believed that this vulnerability can enable Denial of Service and possibly Code Execution attacks on platforms that lack sufficient defenses.

CVE-2025-40909 (2025-05-30)

Perl threads have a working directory race condition where file operations may target unintended paths. If a directory handle is open at thread creation, the process-wide current working directory is temporarily changed in order to clone that handle for the new thread, which is visible from any third (or more) thread already running. This may lead to unintended operations such as loading code or accessing files from unexpected locations, which a local attacker may be able to exploit. The bug was introduced in commit 11a11ecf4bea72b17d250cfb43c897be1341861e and released in Perl version 5.13.6

CVE-2023-47039 (2023-10-30)

Perl for Windows relies on the system path environment variable to find the shell (cmd.exe). When running an executable which uses Windows Perl interpreter, Perl attempts to find and execute cmd.exe within the operating system. However, due to path search order issues, Perl initially looks for cmd.exe in the current working directory. An attacker with limited privileges can exploit this behavior by placing cmd.exe in locations with weak permissions, such as C:\ProgramData. By doing so, when an administrator attempts to use this executable from these compromised locations, arbitrary code can be executed.

CVE-2016-1238 (2016-08-02)

(1) cpan/Archive-Tar/bin/ptar, (2) cpan/Archive-Tar/bin/ptardiff, (3) cpan/Archive-Tar/bin/ptargrep, (4) cpan/CPAN/scripts/cpan, (5) cpan/Digest-SHA/shasum, (6) cpan/Encode/bin/enc2xs, (7) cpan/Encode/bin/encguess, (8) cpan/Encode/bin/piconv, (9) cpan/Encode/bin/ucmlint, (10) cpan/Encode/bin/unidump, (11) cpan/ExtUtils-MakeMaker/bin/instmodsh, (12) cpan/IO-Compress/bin/zipdetails, (13) cpan/JSON-PP/bin/json_pp, (14) cpan/Test-Harness/bin/prove, (15) dist/ExtUtils-ParseXS/lib/ExtUtils/xsubpp, (16) dist/Module-CoreList/corelist, (17) ext/Pod-Html/bin/pod2html, (18) utils/c2ph.PL, (19) utils/h2ph.PL, (20) utils/h2xs.PL, (21) utils/libnetcfg.PL, (22) utils/perlbug.PL, (23) utils/perldoc.PL, (24) utils/perlivp.PL, and (25) utils/splain.PL in Perl 5.x before 5.22.3-RC2 and 5.24 before 5.24.1-RC2 do not properly remove . (period) characters from the end of the includes directory array, which might allow local users to gain privileges via a Trojan horse module under the current working directory.

NAME

Porting/pod_lib.pl - functions for building and installing POD

SYNOPSIS

require './Porting/pod_lib.pl';

DESCRIPTION

This program, when required into other programs in the Perl 5 core distribution, provides functions useful during building and, secondarily, testing.

As of this writing, the functions in this program are used in these other programs:

installman
installperl
pod/buildtoc
pod/perl.pod
Porting/new-perldelta.pl
Porting/pod_rules.pl

Note: Since these functions are used during the Perl build process, they must work with miniperl. That necessarily implies that these functions must not rely on XS modules, either directly or indirectly (e.g., autodie).

SUBROUTINES

my_die()

  • Purpose

    Exit from a process with an error code and a message.

  • Arguments

    List of arguments to be passed with the error message. Example:

    close $fh or my_die("close 'utils.lst': $!");
  • Return Value

    Exit code 255.

  • Comment

    Prints ABORTED to STDERR.

open_or_die()

  • Purpose

    Opens a file or fails if it cannot.

  • Arguments

    String holding filename to be opened. Example:

    $fh = open_or_die('utils.lst');
  • Return Value

    Handle to opened file.

slurp_or_die()

  • Purpose

    Read the contents of a file into memory as a single string.

  • Arguments

    String holding name of file to be read into memory.

    $olddelta = slurp_or_die('pod/perldelta.pod');
  • Return Value

    String holding contents of file.

write_or_die()

  • Purpose

    Write out a string to a file.

  • Arguments

    List of two arguments: (i) String holding name of file to be written to; (ii) String holding contents to be written.

    write_or_die($olddeltaname, $olddelta);
  • Return Value

    Implicitly returns true value upon success.

verify_contiguous()

  • Purpose

    Verify that a file contains exactly one contiguous run of lines which matches the passed in pattern. croak()s if the pattern is not found, or found in more than one place.

  • Arguments

    • Name of file

    • Contents of file

    • Pattern of interest

    • Name to report on error

  • Return Value

    The contents of the file, with qr/\0+/ substituted for the pattern.

process()

  • Purpose

    Read a file from disk, pass the contents to the callback, and either update the file on disk (if changed) or generate TAP output to confirm that the version on disk is up to date. dies if the file contains any NUL bytes. This permits the callback routine to use NUL bytes as placeholders while manipulating the file's contents.

  • Arguments

    • Description for use in error messages

    • Name of file

    • Callback

      Passed description and file contents, should return updated file contents.

    • Test number

      If defined, generate TAP output to STDOUT. If defined and false, generate an unnumbered test. Otherwise this is the test number in the ok line.

    • Verbose flag

      If true, generate verbose output.

  • Return Value

    Does not return anything.

pods_to_install()

  • Purpose

    Create a lookup table holding information about PODs to be installed.

  • Arguments

    None.

  • Return Value

    Reference to a hash with a structure like this:

    $found = {
      'MODULE' => {
        'CPAN::Bundle' => 'lib/CPAN/Bundle.pm',
        'Locale::Codes::Script_Retired' =>
            'lib/Locale/Codes/Script_Retired.pm',
        'Pod::Simple::DumpAsText' =>
            'lib/Pod/Simple/DumpAsText.pm',
        # ...
        'Locale::Codes::LangVar' =>
            'lib/Locale/Codes/LangVar.pod'
      },
      'PRAGMA' => {
        'fields' => 'lib/fields.pm',
        'subs' => 'lib/subs.pm',
        # ...
      },
  • Comment

    Broadly speaking, the function assembles a list of all .pm and .pod files in the distribution and then excludes certain files from installation.

get_pod_metadata()

  • Purpose

  • Arguments

    List of one or more arguments.

    • Boolean true or false

    • Reference to a subroutine.

    • Various other arguments.

    Example:

    $state = get_pod_metadata(
        0, sub { warn @_ if @_ }, 'pod/perltoc.pod');
    
    get_pod_metadata(
        1, sub { warn @_ if @_ }, values %Build);
  • Return Value

    Hash reference; each element provides either a list or a lookup table for information about various types of POD files.

    'aux'             => [ # utility programs like
                              'h2xs' and 'perlbug' ]
    'generated'       => { # lookup table for generated POD files
                              like 'perlapi.pod' }
    'ignore'          => { # lookup table for files to be ignored }
    'pods'            => { # lookup table in "name" =>
                              "short description" format }
    'readmes'         => { # lookup table for OS-specific
                              and other READMEs }
    'delta_version'   => [ # major version number, minor no.,
                              patch no. ]
    'delta_target'    => 'perl<Mmmpp>delta.pod',
    'master'          => [ # list holding entries for files callable
                          by 'perldoc' ]
    'copies'          => { # patch version perldelta =>
                          minor version perldelta }