# CVE-2024-56406: Perl is vulnerable to a heap buffer overflow when transliterating non-ASCII bytes

> Attackers can trigger a heap buffer overflow in Perl's transliteration operator, causing crashes or potentially executing arbitrary code.

- **Severity:** High 8.4 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 Apr 2025
- **Updated:** 16 Oct 2025
- **Also known as:** ALPINE-CVE-2024-56406, ALSA-2025:7500, AZL-60384, AZL-60409, BELL-CVE-2024-56406, DEBIAN-CVE-2024-56406, DSA-5902-1, GHSA-p6jf-pv8c-623c, MINI-9chw-ggjf-xhp4, MINI-9g43-q5q5-gw9j, MINI-rchm-g487-qw2c, OESA-2025-1470, OESA-2025-1471, OESA-2025-1472, OESA-2025-1473, RHSA-2025:7500, RLSA-2025:7500, SUSE-SU-2025:20334-1, UBUNTU-CVE-2024-56406, USN-7434-1, USN-7434-2, openSUSE-SU-2025:15003-1

## What is CVE-2024-56406?

CVE-2024-56406 is a high-severity memory corruption vulnerability in perl, published on 13 Apr 2025. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

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.

Weakness: CWE-787 (Out-of-bounds Write), CWE-122 (Heap-based Buffer Overflow)

## Which versions are affected by CVE-2024-56406?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `perl` | AlmaLinux:10 | All versions | 4:5.40.2-512.1.el10_0 |
| `perl-Attribute-Handlers` | AlmaLinux:10 | All versions | 1.03-512.1.el10_0 |
| `perl-AutoLoader` | AlmaLinux:10 | All versions | 5.74-512.1.el10_0 |
| `perl-AutoSplit` | AlmaLinux:10 | All versions | 5.74-512.1.el10_0 |
| `perl-B` | AlmaLinux:10 | All versions | 1.89-512.1.el10_0 |
| `perl-Benchmark` | AlmaLinux:10 | All versions | 1.25-512.1.el10_0 |
| `perl-Class-Struct` | AlmaLinux:10 | All versions | 0.68-512.1.el10_0 |
| `perl-Config-Extensions` | AlmaLinux:10 | All versions | 0.03-512.1.el10_0 |
| `perl-DBM_Filter` | AlmaLinux:10 | All versions | 0.06-512.1.el10_0 |
| `perl-Devel-Peek` | AlmaLinux:10 | All versions | 1.34-512.1.el10_0 |
| `perl-Devel-SelfStubber` | AlmaLinux:10 | All versions | 1.06-512.1.el10_0 |
| `perl-DirHandle` | AlmaLinux:10 | All versions | 1.05-512.1.el10_0 |
| `perl-Dumpvalue` | AlmaLinux:10 | All versions | 2.27-512.1.el10_0 |
| `perl-DynaLoader` | AlmaLinux:10 | All versions | 1.56-512.1.el10_0 |
| `perl-English` | AlmaLinux:10 | All versions | 1.11-512.1.el10_0 |
| `perl-Errno` | AlmaLinux:10 | All versions | 1.38-512.1.el10_0 |
| `perl-ExtUtils-Constant` | AlmaLinux:10 | All versions | 0.25-512.1.el10_0 |
| `perl-ExtUtils-Embed` | AlmaLinux:10 | All versions | 1.35-512.1.el10_0 |
| `perl-ExtUtils-Miniperl` | AlmaLinux:10 | All versions | 1.14-512.1.el10_0 |
| `perl-Fcntl` | AlmaLinux:10 | All versions | 1.18-512.1.el10_0 |
| `perl-File-Basename` | AlmaLinux:10 | All versions | 2.86-512.1.el10_0 |
| `perl-File-Compare` | AlmaLinux:10 | All versions | 1.100.800-512.1.el10_0 |
| `perl-File-Copy` | AlmaLinux:10 | All versions | 2.41-512.1.el10_0 |
| `perl-File-DosGlob` | AlmaLinux:10 | All versions | 1.12-512.1.el10_0 |
| `perl-File-Find` | AlmaLinux:10 | All versions | 1.44-512.1.el10_0 |
| `perl-File-stat` | AlmaLinux:10 | All versions | 1.14-512.1.el10_0 |
| `perl-FileCache` | AlmaLinux:10 | All versions | 1.10-512.1.el10_0 |
| `perl-FileHandle` | AlmaLinux:10 | All versions | 2.05-512.1.el10_0 |
| `perl-FindBin` | AlmaLinux:10 | All versions | 1.54-512.1.el10_0 |
| `perl-GDBM_File` | AlmaLinux:10 | All versions | 1:1.24-512.1.el10_0 |
| `perl-Getopt-Std` | AlmaLinux:10 | All versions | 1.14-512.1.el10_0 |
| `perl-Hash-Util` | AlmaLinux:10 | All versions | 0.32-512.1.el10_0 |
| `perl-Hash-Util-FieldHash` | AlmaLinux:10 | All versions | 1.27-512.1.el10_0 |
| `perl-I18N-Collate` | AlmaLinux:10 | All versions | 1.02-512.1.el10_0 |
| `perl-I18N-LangTags` | AlmaLinux:10 | All versions | 0.45-512.1.el10_0 |
| `perl-I18N-Langinfo` | AlmaLinux:10 | All versions | 0.24-512.1.el10_0 |
| `perl-IO` | AlmaLinux:10 | All versions | 1.55-512.1.el10_0 |
| `perl-IPC-Open3` | AlmaLinux:10 | All versions | 1.22-512.1.el10_0 |
| `perl-Locale-Maketext-Simple` | AlmaLinux:10 | All versions | 1:0.21-512.1.el10_0 |
| `perl-Math-Complex` | AlmaLinux:10 | All versions | 1.62-512.1.el10_0 |

Products: Perl Perl.

## How do I fix CVE-2024-56406?

Apply the vendor's patch.

## Is CVE-2024-56406 being exploited?

There is no known exploitation of CVE-2024-56406 in the wild and no public exploit code.

## Other vulnerabilities in perl

- [CVE-2026-4176](https://insights.sbomify.com/CVE-2026-4176/): Supply chain in perl (critical 9.8)
- [CVE-2022-48522](https://insights.sbomify.com/CVE-2022-48522/): Memory corruption in n/a (critical 9.8)
- [CVE-2017-12814](https://insights.sbomify.com/CVE-2017-12814/): Memory corruption in n/a (critical 9.8)
- [CVE-2015-8608](https://insights.sbomify.com/CVE-2015-8608/): Memory corruption in n/a (critical 9.8)
- [CVE-2026-13221](https://insights.sbomify.com/CVE-2026-13221/): Integer overflow in perl:perl (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-56406 and fix it if it is affected.

What it is: CVE-2024-56406 is a high-severity memory corruption vulnerability in perl, published on 13 Apr 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-56406 in the wild and no public exploit code.

Affected product: perl. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-56406/ (Markdown: https://insights.sbomify.com/CVE-2024-56406/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-56406
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-56406
- OSV: https://osv.dev/vulnerability/CVE-2024-56406

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-56406/
Summaries are generated and may contain mistakes; the official description above is the record.
