# CVE-2026-13221: Perl integer overflow in regular expression trie compilation

Source: https://junglewise.ai/threats/cve-2026-13221-perl-integer-overflow-in-regular-expression-trie-compilation  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-13. Updated: 2026-07-13  
License: CC BY 4.0 with a link back

CVE-2026-13221 · Severity: info · CVSS 0 · Published 2026-07-13

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.

## Quick answers

**Is CVE-2026-13221 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-13221 being exploited in the wild.

**How severe is CVE-2026-13221?** Informational severity, with a CVSS score of 0, published 13 July 2026.

**Which products and versions are affected?** Perl Foundation Perl Through 5.43.9.

**Is there a fix for CVE-2026-13221?** A patch was published on 2026-03-26: Patch authored by Karl Williamson Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-13221 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-13221?** Check whether anything you run is named in the advisory. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## 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

## References

- [https://cpan.org/modules](https://cpan.org/modules)
- [https://github.com/Perl/perl5/commit/03f74bbbd3a68350d926ee93d56ee4808c28c4c7.patch](https://github.com/Perl/perl5/commit/03f74bbbd3a68350d926ee93d56ee4808c28c4c7.patch)
- [https://github.com/Perl/perl5/issues/23388](https://github.com/Perl/perl5/issues/23388)
