Perl regex engine flaw yields incorrect match results via stale failure flag
CVSS 3.1
5.3medium
EPSS
<1%p35
Published
()
Modified
AI analysis
Perl versions from 5.9.4 before 5.41.9 can produce incorrect regular-expression match results because a stale failure flag in the Aho-Corasick prescan (S_find_byclass) is not cleared when a later transition succeeds, causing the prescan to stop before it records an earlier valid match position. The flaw is triggered by alternation patterns where one candidate position is recorded and a later character then forces a fallback through a fail link that succeeds; for example, 'ABCDE' =~ m/ABCF|BCDE|C/ matches C at offset 2 instead of BCDE, and m/ABCF|BCDE|C(G/) fails to match at all. An attacker who controls input to such a regex can make an access-control, validation, or filtering decision resolve incorrectly, either matching the wrong alternative branch or missing a match entirely, with impact rated low (CVSS 5.3, medium). Any application running an affected Perl interpreter whose security-relevant regexes use alternations is exposed, and because Perl ships by default with virtually all Linux and Unix systems the installed base is enormous even though only specific pattern shapes trigger the bug. No public proof-of-concept is known, the issue is not in CISA KEV, and EPSS puts the 30-day exploitation probability at 0.4%, so no exploitation is currently known.
What to do: Upgrade to Perl 5.41.9 or later, or apply vendor backports such as Ubuntu's USN-8736-1 for affected distribution packages. Audit regex-based access-control, validation, and filtering rules that use alternations, and test them against inputs where a later alternative should match after an earlier one fails. No reliable workaround exists because the defect is inside the regex engine itself, so patching is the primary remediation.
Affected
Perl
>= 5.9.4 and < 5.41.9 (fixed in 5.41.9)
Ubuntu perl (distribution packages)
—
Estimated exposure
masshundreds of millions of installations (Perl is bundled by default with nearly all Linux/Unix distributions) — Perl's default presence on essentially every Linux and Unix server and workstation implies an installed base well over 100k systems, though only code that uses the specific alternation pattern shape in security-relevant matching is…
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
Description
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.
Ubuntu issued USN-8736-1 fixing two Perl regex flaws that could cause denial of service, code execution, or security-restriction bypass.
Ubuntu released a security notice addressing two Perl vulnerabilities in regular expression handling. CVE-2026-15534 involves mishandling of large inputs during regex matching, enabling out-of-bounds heap reads or writes that could lead to denial of service or arbitrary code execution. CVE-2026-19487 involves incorrect matching for regexes with alternative branches, allowing security restrictions to be bypassed. Users are advised to apply the updated packages.