CVE-2024-56406
NoneCVSS
—
EPSS
0.5%
Published
Apr 13, 2025
CISA due date
—
Cloudanix analysis
A flaw in Perl can let specially crafted text processing commands crash programs or potentially allow attackers to run their own code.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Full Compromise
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Heap buffer overflow in S_do_trans_invmap triggered by non-ASCII bytes on the left-hand side of the tr operator, allowing the destination pointer d to be overflowed.
Why it matters to the business
Applications or services built with affected Perl versions may crash or be compromised, leading to service outages or unauthorized code execution on systems lacking memory protections.
How an attack unfolds
An attacker supplies crafted input containing repeated non-ASCII bytes to the tr operator in Perl code, causing S_do_trans_invmap to overflow the destination buffer and potentially hijack control flow on platforms without sufficient mitigations.
How to fix it
Upgrade perl/perl5 to the commit 87f42aa0e0096e9a346c9672aa3a0bd3bef8c1dd or apply the equivalent patch from the 5.34, 5.36, 5.38, or 5.40 maintenance branches.
How to confirm the fix worked
Confirm the installed Perl source matches the fixed commit hash, recompile, and verify the provided one-line reproduction no longer causes a segmentation fault.
Typical attack path
- Identify Perl code paths that use the tr operator with user-controlled or external data on the left-hand side.
- Craft input containing a large number of non-ASCII bytes such as \xFF.
- Trigger the tr operation to invoke S_do_trans_invmap and overflow the destination pointer.
- Leverage the overflow for denial of service via crash or attempt code execution on vulnerable platforms.
How to detect it
Monitor for Perl process crashes or segmentation faults in logs, especially around string translation operations, and inspect core dumps or stack traces referencing S_do_trans_invmap.
- Segmentation fault (core dumped) in perl process
- tr/\xFF/\x{100}/
What your security team should do
- Prioritize upgrade of all Perl 5.34-5.40 installations to the patched commit.
- Scan build and CI pipelines for use of affected Perl versions and enforce updated builds.
- Review applications for tr operator usage with untrusted data and add input validation as a temporary control.
The record
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.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:10 | perl | 0 | 4:5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-Attribute-Handlers | 0 | 1.03-512.1.el10_0 |
| AlmaLinux:10 | perl-AutoLoader | 0 | 5.74-512.1.el10_0 |
| AlmaLinux:10 | perl-AutoSplit | 0 | 5.74-512.1.el10_0 |
| AlmaLinux:10 | perl-B | 0 | 1.89-512.1.el10_0 |
| AlmaLinux:10 | perl-Benchmark | 0 | 1.25-512.1.el10_0 |
| AlmaLinux:10 | perl-Class-Struct | 0 | 0.68-512.1.el10_0 |
| AlmaLinux:10 | perl-Config-Extensions | 0 | 0.03-512.1.el10_0 |
| AlmaLinux:10 | perl-DBM_Filter | 0 | 0.06-512.1.el10_0 |
| AlmaLinux:10 | perl-Devel-Peek | 0 | 1.34-512.1.el10_0 |
| AlmaLinux:10 | perl-Devel-SelfStubber | 0 | 1.06-512.1.el10_0 |
| AlmaLinux:10 | perl-DirHandle | 0 | 1.05-512.1.el10_0 |
| AlmaLinux:10 | perl-Dumpvalue | 0 | 2.27-512.1.el10_0 |
| AlmaLinux:10 | perl-DynaLoader | 0 | 1.56-512.1.el10_0 |
| AlmaLinux:10 | perl-English | 0 | 1.11-512.1.el10_0 |
| AlmaLinux:10 | perl-Errno | 0 | 1.38-512.1.el10_0 |
| AlmaLinux:10 | perl-ExtUtils-Constant | 0 | 0.25-512.1.el10_0 |
| AlmaLinux:10 | perl-ExtUtils-Embed | 0 | 1.35-512.1.el10_0 |
| AlmaLinux:10 | perl-ExtUtils-Miniperl | 0 | 1.14-512.1.el10_0 |
| AlmaLinux:10 | perl-Fcntl | 0 | 1.18-512.1.el10_0 |
| AlmaLinux:10 | perl-File-Basename | 0 | 2.86-512.1.el10_0 |
| AlmaLinux:10 | perl-File-Compare | 0 | 1.100.800-512.1.el10_0 |
| AlmaLinux:10 | perl-File-Copy | 0 | 2.41-512.1.el10_0 |
| AlmaLinux:10 | perl-File-DosGlob | 0 | 1.12-512.1.el10_0 |
| AlmaLinux:10 | perl-File-Find | 0 | 1.44-512.1.el10_0 |
| AlmaLinux:10 | perl-File-stat | 0 | 1.14-512.1.el10_0 |
| AlmaLinux:10 | perl-FileCache | 0 | 1.10-512.1.el10_0 |
| AlmaLinux:10 | perl-FileHandle | 0 | 2.05-512.1.el10_0 |
| AlmaLinux:10 | perl-FindBin | 0 | 1.54-512.1.el10_0 |
| AlmaLinux:10 | perl-GDBM_File | 0 | 1:1.24-512.1.el10_0 |
| AlmaLinux:10 | perl-Getopt-Std | 0 | 1.14-512.1.el10_0 |
| AlmaLinux:10 | perl-Hash-Util | 0 | 0.32-512.1.el10_0 |
| AlmaLinux:10 | perl-Hash-Util-FieldHash | 0 | 1.27-512.1.el10_0 |
| AlmaLinux:10 | perl-I18N-Collate | 0 | 1.02-512.1.el10_0 |
| AlmaLinux:10 | perl-I18N-LangTags | 0 | 0.45-512.1.el10_0 |
| AlmaLinux:10 | perl-I18N-Langinfo | 0 | 0.24-512.1.el10_0 |
| AlmaLinux:10 | perl-IO | 0 | 1.55-512.1.el10_0 |
| AlmaLinux:10 | perl-IPC-Open3 | 0 | 1.22-512.1.el10_0 |
| AlmaLinux:10 | perl-Locale-Maketext-Simple | 0 | 1:0.21-512.1.el10_0 |
| AlmaLinux:10 | perl-Math-Complex | 0 | 1.62-512.1.el10_0 |
| AlmaLinux:10 | perl-Memoize | 0 | 1.16-512.1.el10_0 |
| AlmaLinux:10 | perl-Module-Loaded | 0 | 1:0.08-512.1.el10_0 |
| AlmaLinux:10 | perl-NDBM_File | 0 | 1.17-512.1.el10_0 |
| AlmaLinux:10 | perl-NEXT | 0 | 0.69-512.1.el10_0 |
| AlmaLinux:10 | perl-Net | 0 | 1.04-512.1.el10_0 |
| AlmaLinux:10 | perl-ODBM_File | 0 | 1.18-512.1.el10_0 |
| AlmaLinux:10 | perl-Opcode | 0 | 1.65-512.1.el10_0 |
| AlmaLinux:10 | perl-POSIX | 0 | 2.20-512.1.el10_0 |
| AlmaLinux:10 | perl-Pod-Functions | 0 | 1.14-512.1.el10_0 |
| AlmaLinux:10 | perl-Pod-Html | 0 | 1.35-512.1.el10_0 |
| AlmaLinux:10 | perl-Safe | 0 | 2.46-512.1.el10_0 |
| AlmaLinux:10 | perl-Search-Dict | 0 | 1.07-512.1.el10_0 |
| AlmaLinux:10 | perl-SelectSaver | 0 | 1.02-512.1.el10_0 |
| AlmaLinux:10 | perl-SelfLoader | 0 | 1.27-512.1.el10_0 |
| AlmaLinux:10 | perl-Symbol | 0 | 1.09-512.1.el10_0 |
| AlmaLinux:10 | perl-Sys-Hostname | 0 | 1.25-512.1.el10_0 |
| AlmaLinux:10 | perl-Term-Complete | 0 | 1.403-512.1.el10_0 |
| AlmaLinux:10 | perl-Term-ReadLine | 0 | 1.17-512.1.el10_0 |
| AlmaLinux:10 | perl-Test | 0 | 1.31-512.1.el10_0 |
| AlmaLinux:10 | perl-Text-Abbrev | 0 | 1.02-512.1.el10_0 |
| AlmaLinux:10 | perl-Thread | 0 | 3.05-512.1.el10_0 |
| AlmaLinux:10 | perl-Thread-Semaphore | 0 | 2.13-512.1.el10_0 |
| AlmaLinux:10 | perl-Tie | 0 | 4.6-512.1.el10_0 |
| AlmaLinux:10 | perl-Tie-File | 0 | 1.09-512.1.el10_0 |
| AlmaLinux:10 | perl-Tie-Memoize | 0 | 1.1-512.1.el10_0 |
| AlmaLinux:10 | perl-Time | 0 | 1.04-512.1.el10_0 |
| AlmaLinux:10 | perl-Time-Piece | 0 | 1.3401-512.1.el10_0 |
| AlmaLinux:10 | perl-Unicode-UCD | 0 | 0.78-512.1.el10_0 |
| AlmaLinux:10 | perl-User-pwent | 0 | 1.05-512.1.el10_0 |
| AlmaLinux:10 | perl-autouse | 0 | 1.11-512.1.el10_0 |
| AlmaLinux:10 | perl-base | 0 | 2.27-512.1.el10_0 |
| AlmaLinux:10 | perl-blib | 0 | 1.07-512.1.el10_0 |
| AlmaLinux:10 | perl-debugger | 0 | 1.60-512.1.el10_0 |
| AlmaLinux:10 | perl-deprecate | 0 | 0.04-512.1.el10_0 |
| AlmaLinux:10 | perl-devel | 0 | 4:5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-diagnostics | 0 | 1.40-512.1.el10_0 |
| AlmaLinux:10 | perl-doc | 0 | 5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-encoding-warnings | 0 | 0.14-512.1.el10_0 |
| AlmaLinux:10 | perl-fields | 0 | 2.27-512.1.el10_0 |
| AlmaLinux:10 | perl-filetest | 0 | 1.03-512.1.el10_0 |
| AlmaLinux:10 | perl-if | 0 | 0.61.000-512.1.el10_0 |
| AlmaLinux:10 | perl-interpreter | 0 | 4:5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-less | 0 | 0.03-512.1.el10_0 |
| AlmaLinux:10 | perl-lib | 0 | 0.65-512.1.el10_0 |
| AlmaLinux:10 | perl-libnetcfg | 0 | 4:5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-libs | 0 | 4:5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-locale | 0 | 1.12-512.1.el10_0 |
| AlmaLinux:10 | perl-macros | 0 | 4:5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-meta-notation | 0 | 5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-mro | 0 | 1.29-512.1.el10_0 |
| AlmaLinux:10 | perl-open | 0 | 1.13-512.1.el10_0 |
| AlmaLinux:10 | perl-overload | 0 | 1.37-512.1.el10_0 |
| AlmaLinux:10 | perl-overloading | 0 | 0.02-512.1.el10_0 |
| AlmaLinux:10 | perl-ph | 0 | 5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-sigtrap | 0 | 1.10-512.1.el10_0 |
| AlmaLinux:10 | perl-sort | 0 | 2.05-512.1.el10_0 |
| AlmaLinux:10 | perl-subs | 0 | 1.04-512.1.el10_0 |
| AlmaLinux:10 | perl-utils | 0 | 5.40.2-512.1.el10_0 |
| AlmaLinux:10 | perl-vars | 0 | 1.05-512.1.el10_0 |
| AlmaLinux:10 | perl-vmsish | 0 | 1.04-512.1.el10_0 |
| Alpine:v3.18 | perl | 0 | 5.36.2-r1 |
| Alpine:v3.19 | perl | 0 | 5.38.3-r1 |
| Alpine:v3.20 | perl | 0 | 5.38.3-r1 |
| Alpine:v3.21 | perl | 0 | 5.40.1-r1 |
| Alpine:v3.22 | perl | 0 | 5.40.1-r1 |
| Debian:12 | perl | 0 | 5.36.0-7+deb12u2 |
| Debian:13 | perl | 0 | No fix |
| Debian:14 | perl | 0 | 5.40.1-3 |
| Mageia:9 | perl | 0 | 5.36.0-1.2.mga9 |
| openSUSE:Tumbleweed | perl | 0 | 5.40.2-1.1 |
Related vulnerabilities
- CVE-2017-12883 Buffer overflow in the S_grok_bslash_N function in regcomp.c in Perl 5 before 5.24.3-RC1… Also affects perl
- CVE-2017-12837 Heap-based buffer overflow in the S_regatom function in regcomp.c in Perl 5 before… Also affects perl
- CVE-2025-40909 Perl threads have a working directory race condition where file operations may target… Also affects perl
- CVE-2020-16156 CPAN 2.28 allows Signature Verification Bypass. Also affects perl
- CVE-2017-6512 Race condition in the rmtree and remove_tree functions in the File-Path module before… Also affects perl
- CVE-2016-6185 The XSLoader::load method in XSLoader in Perl does not properly locate .so files when… Also affects perl
- CVE-2016-1238 (1) cpan/Archive-Tar/bin/ptar, (2) cpan/Archive-Tar/bin/ptardiff, (3)… Also affects perl
- CVE-2015-8853 The (1) S_reghop3, (2) S_reghop4, and (3) S_reghopmaybe3 functions in regexec.c in Perl… Also affects perl