Executive brief
Perl, a widely used programming language, contains a flaw in how it processes complex text-matching rules (regular expressions). When a program uses an extremely large list of specific words to match against, the system may provide incorrect results—either failing to find a match that exists or incorrectly identifying a match that does not. This can lead to security failures if the software relies on these matches to make access control or data filtering decisions.
Technical details
An integer overflow vulnerability exists in Perl's regular expression compiler, specifically within the `Perl_study_chunk` function in `regcomp_study.c`. When a regular expression contains an alternation of more than 65,535 fixed-string branches, the engine attempts to compile them into a trie optimization structure. The delta between the first branch and the shared tail is stored in a 16-bit field; exceeding this limit causes a silent overflow and truncation of the match decision table. This results in false positives and false negatives during pattern matching. If such patterns are used for security-critical tasks like input validation or access control, the logic can be bypassed. A patch has been developed to prevent trie optimization when an overflow would occur.
Affected products
- Perl Foundation Perl Through 5.43.9
Timeline
- 2026-03-26: patched: Patch authored by Karl Williamson
- 2026-07-13: advisory: CVE-2026-13221 published