Security Advisories (7)
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-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-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-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-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-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.

Foo

Bar

Baz

Drink

Sip

Ouch

Drip EOF

is $results, <<'EOF', 'And it should work!'; <ul id="index"> <li> <ul> <li><a href="#Foo">Foo</a> <ul> <li><a href="#Bar">Bar</a></li> </ul> </li> </ul> </li> <li><a href="#Baz">Baz</a> <ul> <li> <ul> <li> <ul> <li><a href="#Drink">Drink</a></li> </ul> </li> <li><a href="#Sip">Sip</a> <ul> <li><a href="#Ouch">Ouch</a></li> </ul> </li> </ul> </li> </ul> </li> <li><a href="#Drip">Drip</a></li> </ul>

<h2 id="Foo">Foo</h2>

<h3 id="Bar">Bar</h3>

<h1 id="Baz">Baz</h1>

<h4 id="Drink">Drink</h4>

<h3 id="Sip">Sip</h3>

<h4 id="Ouch">Ouch</h4>

<h1 id="Drip">Drip</h1>

EOF

initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); ok $parser->parse_string_document( '=head1 Foo' ), 'Parse a header'; is $results, <<'EOF', 'Should have the index and a backlink';

<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">

<ul id="index"> <li><a href="#Foo">Foo</a></li> </ul>

<a href="#_podtop_"><h1 id="Foo">Foo</h1></a>

</body> </html>

EOF

initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); ok $parser->parse_string_document( "=head1 Foo \n\n=head2 Bar \n\n=head1 Baz" ), 'Parse headers'; is $results, <<'EOF', 'Should have the index and backlinks';

<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">

<ul id="index"> <li><a href="#Foo">Foo</a> <ul> <li><a href="#Bar">Bar</a></li> </ul> </li> <li><a href="#Baz">Baz</a></li> </ul>

<a href="#_podtop_"><h1 id="Foo">Foo</h1></a>

<h2 id="Bar">Bar</h2>

<a href="#_podtop_"><h1 id="Baz">Baz</h1></a>

</body> </html>

EOF

initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->index(0); $parser->backlink(1); ok $parser->parse_string_document( "=head1 Foo \n\n=head1 Bar" ), 'Parse headers'; is $results, <<'EOF', 'Should have backlinks but no index';

<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">

<a href="#_podtop_"><h1 id="Foo">Foo</h1></a>

<a href="#_podtop_"><h1 id="Bar">Bar</h1></a>

</body> </html>

EOF

initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); $parser->html_h_level(2); ok $parser->parse_string_document( "=head1 Foo \n\n=head1 Bar" ), 'Parse headers'; is $results, <<'EOF', 'Should have index and backlinks around h2 elements';

<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">

<ul id="index"> <li> <ul> <li><a href="#Foo">Foo</a></li> <li><a href="#Bar">Bar</a></li> </ul> </li> </ul>

<a href="#_podtop_"><h2 id="Foo">Foo</h2></a>

<a href="#_podtop_"><h2 id="Bar">Bar</h2></a>

</body> </html>

EOF

initialize($parser, $results); $parser->anchor_items(1); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo

test
Test 2

body of item

  • not anchored

  1. still not anchored

is $results, <<'EOF', 'Anchor =item directives'; <ul id="index"> <li><a href="#Foo">Foo</a></li> </ul>

<h1 id="Foo">Foo</h1>

<dl>

<dt id="test">test</dt> <dd>

</dd> <dt id="Test-2">Test 2</dt> <dd>

<p>body of item</p>

</dd> </dl>

<ul>

<li><p>not anchored</p>

</li> </ul>

<ol>

<li><p>still not anchored</p>

</li> </ol>

EOF

initialize($parser, $results); $parser->anchor_items(0); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo

test
Test 2

body of item

  • not anchored

  1. still not anchored

<h1 id="Foo">Foo</h1>

<dl>

<dt>test</dt> <dd>

</dd> <dt>Test 2</dt> <dd>

<p>body of item</p>

</dd> </dl>

<ul>

<li><p>not anchored</p>

</li> </ul>

<ol>

<li><p>still not anchored</p>

</li> </ol>

EOF

$ENV{FOO}= 1;

initialize($parser, $results); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo

Test links from perlpodspec: "About L<...> Codes"

About L<...> Codes

Here it is EOPOD

my $id = 'About-L...-Codes'; # what should this be?

is $results, <<EOF, 'anchor and h1 use same section id for complex sections'; <ul id="index"> <li><a href="#Foo">Foo</a></li> <li><a href="#$id">About L&lt;...&gt; Codes</a></li> </ul>

<h1 id="Foo">Foo</h1>

<p>Test links from perlpodspec: <a href="#$id">&quot;About L&lt;...&gt; Codes&quot;</a></p>

<h1 id="$id">About L&lt;...&gt; Codes</h1>

<p>Here it is</p>

EOF

sub initialize { $_[0] = Pod::Simple::XHTML->new; $_[0]->html_header(''); $_[0]->html_footer(''); $_[0]->index(1); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; }

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 565:

=back doesn't take any parameters, but you said =back EOPOD

Around line 634:

=back doesn't take any parameters, but you said =back EOPOD is $results, <<'EOF', 'Do not anchor =item directives'; <ul id="index"> <li><a href="#Foo">Foo</a></li> </ul>