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

Published Apr 13, 2025
·
Updated

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, Sdotransinvmap 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.

Other sources

A heap buffer overflow vulnerability was discovered in Perl.

When there are non-ASCII bytes in the left-hand-side of the tr operator, Sdotransinvmap 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.

— Red Hat

Perl is vulnerable to a heap buffer overflow when transliterating non-ASCII bytes

— Microsoft

Affected Software

18 affected componentsFixes available
Perl Perl=5.34, =5.36, =5.38, =5.40, >=5.33.1<5.41.10
Perl Perl>=5.33.1<5.38.4
Perl Perl>=5.39.0<5.40.2
Perl Perl>=5.41.0<=5.41.10
Microsoft azl3 perl 5.38.2-508
Microsoft azl3 perl 5.38.2-507
Microsoft cbl2 perl 5.34.1-490
alpine/perl>=5.33.1<5.36.2-r1
5.36.2-r1
alpine/perl>=5.33.1<5.38.3-r1
5.38.3-r1
alpine/perl>=5.33.1<5.38.3-r1
5.38.3-r1
alpine/perl>=5.33.1<5.40.1-r1
5.40.1-r1
alpine/perl>=5.33.1<5.40.1-r1
5.40.1-r1
alpine/perl>=5.33.1<5.40.1-r1
5.40.1-r1
alpine/perl>=5.33.1<5.40.1-r1
5.40.1-r1
debian/perl<5.36.0-7+deb12u2
5.36.0-7+deb12u2
debian/perl<5.40.1-3
5.40.1-3
debian/perl<5.40.1-3
5.40.1-3
debian/perl
5.36.0-7+deb12u35.36.0-7+deb12u45.40.1-6+deb13u15.42.3-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade alpine/perl to a version that resolves this vulnerability.

    Fixed in 5.36.2-r1
  2. Upgrade

    Upgrade alpine/perl to a version that resolves this vulnerability.

    Fixed in 5.38.3-r1
  3. Upgrade

    Upgrade alpine/perl to a version that resolves this vulnerability.

    Fixed in 5.40.1-r1
  4. Upgrade

    Upgrade debian/perl to a version that resolves this vulnerability.

    Fixed in 5.36.0-7+deb12u2
  5. Upgrade

    Upgrade debian/perl to a version that resolves this vulnerability.

    Fixed in 5.40.1-3
  6. Upgrade

    Upgrade debian/perl to a version that resolves this vulnerability.

    Fixed in 5.36.0-7+deb12u3Fixed in 5.36.0-7+deb12u4Fixed in 5.40.1-6+deb13u1Fixed in 5.42.3-1
  7. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 5.40.2
  8. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 5.38.4

Event History

Apr 13, 2025
CVE Published
via MITRE·01:16 PM
Data Sourced
via MITRE·01:16 PM
RemedyDescriptionWeakness
Data Sourced
via Red Hat·02:01 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·02:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·02:15 PM
DescriptionSeverityAffected Software
Apr 19, 2025
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeaknessAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the severity of CVE-2024-56406?

CVE-2024-56406 has a high severity due to its potential to cause a heap buffer overflow in Perl.

2

How do I fix CVE-2024-56406?

To fix CVE-2024-56406, upgrade to Perl version 5.40 or later, or apply the provided patches.

3

What versions of Perl are affected by CVE-2024-56406?

CVE-2024-56406 affects Perl versions from 5.34 up to and including 5.40.

4

What kind of vulnerability is CVE-2024-56406?

CVE-2024-56406 is a heap buffer overflow vulnerability that can lead to segmentation faults.

5

What operation in Perl triggers CVE-2024-56406?

The `tr` operator with non-ASCII bytes on the left-hand side triggers CVE-2024-56406.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203