Security Advisories (8)
CVE-2024-56406 (2025-04-13)

A heap buffer overflow vulnerability was discovered in Perl. Release branches 5.34, 5.36, 5.38 and 5.40 are affected, including development versions from 5.33.1 through 5.41.10. 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-2026-13221 (2026-07-13)

Perl versions through 5.43.9 produce silently incorrect regular expression matches when an alternation of more than 65535 fixed string branches is compiled into a trie in Perl_study_chunk. When such branches are combined into a trie, the delta between the first branch and the shared tail is stored in a 16-bit field. A branch count above 65535 overflows the field, and the trie's match decision table is truncated with no warning or error. A pattern of this shape produces false positive matches (matching strings it should not) and false negative matches (failing to match strings it should). When such a pattern gates an access or filtering decision, the result is wrong.

CVE-2026-15534 (2026-08-09)

Perl versions through 5.45.1 have out-of-bounds heap reads and writes during regular expression matching via an undersized superlinear cache in S_regmatch. The regex engine's superlinear cache holds one bit per subject position for each participating WHILEM node, so the bit count is the subject length plus one times the number of nodes. Nothing checks that product for positive overflow of the signed 32-bit count: a 286331153 byte subject matched against a pattern with 15 participating nodes stores the count as 14, leaving a two byte cache. The cache is then indexed from the real match position and node number, so reads go past the end of the allocation, and on failure CACHEsayNO sets a bit past it. A caller that matches an attacker controlled subject of this size against a pattern of this shape can crash the process or corrupt heap memory.

CVE-2026-19487 (2026-08-13)

Perl versions from 5.9.4 before 5.41.9 produce incorrect regular expression match results when a stale failure flag ends the Aho-Corasick prescan early in S_find_byclass. The prescan walks the subject for positions where the full pattern could match, and the engine tries it from the leftmost one recorded. A failing transition sets the failed flag, and a later successful transition does not clear it, so the prescan reads the stale flag as a failure and stops before it can record a candidate that starts earlier. It takes a subject where one candidate is recorded and a later character then forces a fallback through a fail link that succeeds. Example: "ABCDE" =~ m/ABCF|BCDE|C/; # matches C at offset 2, not BCDE "ABCDE" =~ m/ABCF|BCDE|C(G)/; # no match, BCDE missed An alternation like this can miss input it should match, or match it on the wrong branch, so an access or filtering decision made from the result can be wrong.

CVE-2026-4176 (2026-03-29)

Perl versions from 5.9.4 before 5.40.4-RC1, from 5.41.0 before 5.42.2-RC1, from 5.43.0 before 5.43.9 contain a vulnerable version of Compress::Raw::Zlib. Compress::Raw::Zlib is included in the Perl package as a dual-life core module, and is vulnerable to CVE-2026-3381 due to a vendored version of zlib which has several vulnerabilities, including CVE-2026-27171. The bundled Compress::Raw::Zlib was updated to version 2.221 in Perl blead commit c75ae9cc164205e1b6d6dbd57bd2c65c8593fe94.

CVE-2026-57432 (2026-07-13)

Perl versions through 5.43.10 have an integer overflow in S_measure_struct leading to an out-of-bounds heap read in pack and unpack. S_measure_struct adds each item's size times its repeat count to a running total with no overflow check, so a large repeat count in a pack or unpack template wraps the signed SSize_t total negative. The @, X, and x position codes then guard their moves with a signed length comparison that passes when the length is negative, advancing the buffer pointer out of bounds. A template derived from untrusted input can read heap memory past the buffer and return it to the caller.

CVE-2026-8376 (2026-05-25)

Perl versions through 5.43.10 have a heap buffer overflow when compiling regular expressions with a repeated fixed string on 32-bit builds. Perl_study_chunk in regcomp_study.c checked the size of the joined substring buffer in characters rather than bytes. For a quantified fixed substring with a large minimum count, the byte length mincount * l could overflow SSize_t, producing an undersized SvGROW allocation; the subsequent copy writes past the end of the buffer. A caller that compiles an attacker-controlled regular expression on a 32-bit perl build triggers a heap buffer overflow at compile time.

NAME

CPAN::Meta - the distribution metadata for a CPAN dist

VERSION

version 2.150010

SYNOPSIS

use v5.10;
use strict;
use warnings;
use CPAN::Meta;
use Module::Load;

my $meta = CPAN::Meta->load_file('META.json');

printf "testing requirements for %s version %s\n",
$meta->name,
$meta->version;

my $prereqs = $meta->effective_prereqs;

for my $phase ( qw/configure runtime build test/ ) {
    say "Requirements for $phase:";
    my $reqs = $prereqs->requirements_for($phase, "requires");
    for my $module ( sort $reqs->required_modules ) {
        my $status;
        if ( eval { load $module unless $module eq 'perl'; 1 } ) {
            my $version = $module eq 'perl' ? $] : $module->VERSION;
            $status = $reqs->accepts_module($module, $version)
                    ? "$version ok" : "$version not ok";
        } else {
            $status = "missing"
        };
        say "  $module ($status)";
    }
}

DESCRIPTION

Software distributions released to the CPAN include a META.json or, for older distributions, META.yml, which describes the distribution, its contents, and the requirements for building and installing the distribution. The data structure stored in the META.json file is described in CPAN::Meta::Spec.

CPAN::Meta provides a simple class to represent this distribution metadata (or distmeta), along with some helpful methods for interrogating that data.

The documentation below is only for the methods of the CPAN::Meta object. For information on the meaning of individual fields, consult the spec.

METHODS

new

my $meta = CPAN::Meta->new($distmeta_struct, \%options);

Returns a valid CPAN::Meta object or dies if the supplied metadata hash reference fails to validate. Older-format metadata will be up-converted to version 2 if they validate against the original stated specification.

It takes an optional hashref of options. Valid options include:

  • lazy_validation -- if true, new will attempt to convert the given metadata to version 2 before attempting to validate it. This means than any fixable errors will be handled by CPAN::Meta::Converter before validation. (Note that this might result in invalid optional data being silently dropped.) The default is false.

create

my $meta = CPAN::Meta->create($distmeta_struct, \%options);

This is same as new(), except that generated_by and meta-spec fields will be generated if not provided. This means the metadata structure is assumed to otherwise follow the latest CPAN::Meta::Spec.

load_file

my $meta = CPAN::Meta->load_file($distmeta_file, \%options);

Given a pathname to a file containing metadata, this deserializes the file according to its file suffix and constructs a new CPAN::Meta object, just like new(). It will die if the deserialized version fails to validate against its stated specification version.

It takes the same options as new() but lazy_validation defaults to true.

load_yaml_string

my $meta = CPAN::Meta->load_yaml_string($yaml, \%options);

This method returns a new CPAN::Meta object using the first document in the given YAML string. In other respects it is identical to load_file().

load_json_string

my $meta = CPAN::Meta->load_json_string($json, \%options);

This method returns a new CPAN::Meta object using the structure represented by the given JSON string. In other respects it is identical to load_file().

load_string

my $meta = CPAN::Meta->load_string($string, \%options);

If you don't know if a string contains YAML or JSON, this method will use Parse::CPAN::Meta to guess. In other respects it is identical to load_file().

save

$meta->save($distmeta_file, \%options);

Serializes the object as JSON and writes it to the given file. The only valid option is version, which defaults to '2'. On Perl 5.8.1 or later, the file is saved with UTF-8 encoding.

For version 2 (or higher), the filename should end in '.json'. JSON::PP is the default JSON backend. Using another JSON backend requires JSON 2.5 or later and you must set the $ENV{PERL_JSON_BACKEND} to a supported alternate backend like JSON::XS.

For version less than 2, the filename should end in '.yml'. CPAN::Meta::Converter is used to generate an older metadata structure, which is serialized to YAML. CPAN::Meta::YAML is the default YAML backend. You may set the $ENV{PERL_YAML_BACKEND} to a supported alternative backend, though this is not recommended due to subtle incompatibilities between YAML parsers on CPAN.

meta_spec_version

This method returns the version part of the meta_spec entry in the distmeta structure. It is equivalent to:

$meta->meta_spec->{version};

effective_prereqs

my $prereqs = $meta->effective_prereqs;

my $prereqs = $meta->effective_prereqs( \@feature_identifiers );

This method returns a CPAN::Meta::Prereqs object describing all the prereqs for the distribution. If an arrayref of feature identifiers is given, the prereqs for the identified features are merged together with the distribution's core prereqs before the CPAN::Meta::Prereqs object is returned.

should_index_file

... if $meta->should_index_file( $filename );

This method returns true if the given file should be indexed. It decides this by checking the file and directory keys in the no_index property of the distmeta structure. Note that neither the version format nor release_status are considered.

$filename should be given in unix format.

should_index_package

... if $meta->should_index_package( $package );

This method returns true if the given package should be indexed. It decides this by checking the package and namespace keys in the no_index property of the distmeta structure. Note that neither the version format nor release_status are considered.

features

my @feature_objects = $meta->features;

This method returns a list of CPAN::Meta::Feature objects, one for each optional feature described by the distribution's metadata.

feature

my $feature_object = $meta->feature( $identifier );

This method returns a CPAN::Meta::Feature object for the optional feature with the given identifier. If no feature with that identifier exists, an exception will be raised.

as_struct

my $copy = $meta->as_struct( \%options );

This method returns a deep copy of the object's metadata as an unblessed hash reference. It takes an optional hashref of options. If the hashref contains a version argument, the copied metadata will be converted to the version of the specification and returned. For example:

my $old_spec = $meta->as_struct( {version => "1.4"} );

as_string

my $string = $meta->as_string( \%options );

This method returns a serialized copy of the object's metadata as a character string. (The strings are not UTF-8 encoded.) It takes an optional hashref of options. If the hashref contains a version argument, the copied metadata will be converted to the version of the specification and returned. For example:

my $string = $meta->as_string( {version => "1.4"} );

For version greater than or equal to 2, the string will be serialized as JSON. For version less than 2, the string will be serialized as YAML. In both cases, the same rules are followed as in the save() method for choosing a serialization backend.

The serialized structure will include a x_serialization_backend entry giving the package and version used to serialize. Any existing key in the given $meta object will be clobbered.

STRING DATA

The following methods return a single value, which is the value for the corresponding entry in the distmeta structure. Values should be either undef or strings.

  • abstract

  • description

  • dynamic_config

  • generated_by

  • name

  • release_status

  • version

LIST DATA

These methods return lists of string values, which might be represented in the distmeta structure as arrayrefs or scalars:

  • authors

  • keywords

  • licenses

The authors and licenses methods may also be called as author and license, respectively, to match the field name in the distmeta structure.

MAP DATA

These readers return hashrefs of arbitrary unblessed data structures, each described more fully in the specification:

  • meta_spec

  • resources

  • provides

  • no_index

  • prereqs

  • optional_features

CUSTOM DATA

A list of custom keys are available from the custom_keys method and particular keys may be retrieved with the custom method.

say $meta->custom($_) for $meta->custom_keys;

If a custom key refers to a data structure, a deep clone is returned.

BUGS

Please report any bugs or feature using the CPAN Request Tracker. Bugs can be submitted through the web interface at http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/Perl-Toolchain-Gang/CPAN-Meta

git clone https://github.com/Perl-Toolchain-Gang/CPAN-Meta.git

AUTHORS

  • David Golden <dagolden@cpan.org>

  • Ricardo Signes <rjbs@cpan.org>

  • Adam Kennedy <adamk@cpan.org>

CONTRIBUTORS

  • Ansgar Burchardt <ansgar@cpan.org>

  • Avar Arnfjord Bjarmason <avar@cpan.org>

  • Benjamin Noggle <agwind@users.noreply.github.com>

  • Christopher J. Madsen <cjm@cpan.org>

  • Chuck Adams <cja987@gmail.com>

  • Cory G Watson <gphat@cpan.org>

  • Damyan Ivanov <dam@cpan.org>

  • David Golden <xdg@xdg.me>

  • Eric Wilhelm <ewilhelm@cpan.org>

  • Graham Knop <haarg@haarg.org>

  • Gregor Hermann <gregoa@debian.org>

  • Karen Etheridge <ether@cpan.org>

  • Kenichi Ishigaki <ishigaki@cpan.org>

  • Kent Fredric <kentfredric@gmail.com>

  • Ken Williams <kwilliams@cpan.org>

  • Lars Dieckow <daxim@cpan.org>

  • Leon Timmermans <leont@cpan.org>

  • majensen <maj@fortinbras.us>

  • Mark Fowler <markf@cpan.org>

  • Matt S Trout <mst@shadowcat.co.uk>

  • Michael G. Schwern <mschwern@cpan.org>

  • Mohammad S Anwar <mohammad.anwar@yahoo.com>

  • mohawk2 <mohawk2@users.noreply.github.com>

  • moznion <moznion@gmail.com>

  • Niko Tyni <ntyni@debian.org>

  • Olaf Alders <olaf@wundersolutions.com>

  • Olivier Mengué <dolmen@cpan.org>

  • Randy Sims <randys@thepierianspring.org>

  • Tomohiro Hosaka <bokutin@bokut.in>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.