PHP2Shell: Read our blog on the critical RCE vulnerabilities affecting 70% of the Internet

CVE-2025-40912: 
Linux Debian vulnerability analysis and mitigation

Overview

CVE-2025-40912 is a vulnerability in CryptX for Perl (before version 0.065) stemming from an embedded dependency — the LibTomCrypt library — that is susceptible to malformed Unicode input. Specifically, it inherits the flaw described in CVE-2019-17362, which affects the der_decode_utf8_string function in LibTomCrypt 1.18.2 and earlier. The vulnerability was published on June 11, 2025, and assigned by CPANSec (Red Hat Advisory, NVD). It carries a CVSS v3.1 base score of 9.8 (Critical), assessed by CISA-ADP (NVD).

Technical details

The root cause lies in the der_decode_utf8_string function within LibTomCrypt's DER (Distinguished Encoding Rules) decoder, which fails to properly validate certain invalid UTF-8 byte sequences — specifically, sequences beginning with 10xxxxxx (continuation bytes) that are not valid as leading bytes (libtomcrypt GitHub). This flaw allows an attacker to craft DER-encoded data (e.g., a malicious X.509 certificate) such that der_length_utf8_string reports a length larger than the actual encoded string, causing pointer arithmetic to underflow the remaining buffer size. The result is an out-of-bounds read that can crash the application (denial of service) or, in a two-step attack scenario, expose adjacent memory contents to the attacker (libtomcrypt GitHub). The attack vector is network-based, requires no authentication or user interaction, and is triggered by supplying crafted DER-encoded input to any code path that processes X.509 certificates or similar structures via CryptX.

Impact

Successful exploitation can result in a denial of service via application crash (out-of-bounds read of invalid memory) or information disclosure by leaking adjacent heap/stack memory contents into a decoded DER structure that may subsequently be exported or transmitted (libtomcrypt GitHub). The CVSS score reflects high impact across confidentiality, integrity, and availability, meaning that in the worst case an attacker could read sensitive cryptographic material or other in-memory data from affected Perl applications using CryptX for certificate processing (Red Hat Advisory). Applications that import and then re-export X.509 certificates using CryptX are at elevated risk of information disclosure.

Exploitability

No public proof-of-concept exploit specifically targeting CVE-2025-40912 in CryptX has been identified, and there is no evidence of in-the-wild exploitation at this time (Red Hat Advisory). However, proof-of-concept code for the underlying CVE-2019-17362 flaw in LibTomCrypt was published in 2019 and is available in the libtomcrypt GitHub issue tracker, demonstrating both crash and memory-leak scenarios (libtomcrypt GitHub). The EPSS score is approximately 0.043%, indicating low current exploitation probability. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. Qualys has a detection for this vulnerability (ID: 6260219).

Exploitation steps

  1. Identify target: Locate Perl applications using CryptX versions before 0.065 that process externally supplied DER-encoded data, such as X.509 certificate import functionality.
  2. Craft malicious DER input: Construct a DER-encoded structure containing a UTF-8 string entry that begins with an invalid continuation byte (e.g., 0xBF), such as the sequence \x0c\x02\xbf\xbf. This causes der_decode_utf8_string to misinterpret the byte count.
  3. Trigger denial of service (poc1): Append a DER sequence with a very large declared length (e.g., \x30\x84\xff\xff\xff\xff) after the malformed UTF-8 entry. When processed, the pointer arithmetic underflows, causing the decoder to attempt reading ~4GB of memory, likely crashing the process: \x30\x04\x0c\x02\xbf\xbf\xaa\x30\x84\xff\xff\xff\xff.
  4. Trigger information disclosure (poc2): Alternatively, use a crafted OCTET STRING of length 0xFFFF after the malformed UTF-8 entry (\x30\x04\x0c\x02\xbf\xbf\xaa\x04\x82\xff\xff). This causes the decoder to include up to 65535 bytes of adjacent memory in the decoded certificate structure.
  5. Exfiltrate data: In a two-step attack, submit the crafted certificate for import, then trigger an export operation. The exported certificate will contain the leaked adjacent memory, which the attacker can retrieve (libtomcrypt GitHub).

Indicators of compromise

  • Logs: Application logs showing repeated crashes or unexpected termination of Perl processes handling certificate or DER data; error messages referencing memory access violations or segmentation faults in CryptX/LibTomCrypt operations.
  • Network: Unusual or malformed X.509 certificate data submitted to services that use CryptX for certificate import/export; unexpectedly large certificate export responses that may contain memory artifacts.
  • Process: Perl interpreter processes crashing unexpectedly when processing cryptographic input; core dump files generated by Perl applications using CryptX.
  • File System: Presence of CryptX versions older than 0.065 on the system (verifiable via cpan -D CryptX or package manager queries).

Mitigation and workarounds

The primary remediation is to upgrade CryptX for Perl to version 0.065 or later, which bundles a patched version of the LibTomCrypt library that correctly validates UTF-8 sequences in DER-encoded data (Red Hat Advisory). Ubuntu users should apply the fix via USN-8128-1 (Ubuntu Advisory). As a workaround where immediate upgrade is not possible, restrict or sanitize externally supplied DER-encoded input (e.g., X.509 certificates) before passing it to CryptX, and implement network segmentation to limit exposure of affected services. Audit all Perl applications in your environment that use CryptX for certificate processing to prioritize patching efforts.

Community reactions

Red Hat tracked the issue via Bugzilla (Bug 2372334) and classified it as medium severity internally, noting it as a denial-of-service vector (Red Hat Bugzilla). Ubuntu issued security notice USN-8128-1 addressing the vulnerability in their CryptX package (Ubuntu Advisory). The CPAN Security Advisory Database (CPANSA-DB) also catalogued the issue, reflecting community awareness within the Perl ecosystem. No significant broader media coverage or notable researcher commentary beyond standard advisory channels has been observed.

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

libcryptx-perl: 0.066-1

Fixed

sid

libcryptx-perl: 0.066-1

Fixed

trixie

libcryptx-perl: 0.066-1

Fixed

Source: This report was generated using AI

Related Linux Debian vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-89419MEDIUM5.4
  • Linux Debian logoLinux Debian
  • ironic
NoNoOct 23, 2026
CVE-2026-90458MEDIUM4.7
  • Linux Debian logoLinux Debian
  • ironic
NoNoOct 23, 2026
CVE-2026-85559NONEN/A
  • Linux Debian logoLinux Debian
  • pdns-recursor
NoYesOct 23, 2026
CVE-2026-85558NONEN/A
  • Linux Debian logoLinux Debian
  • pdns-recursor
NoYesOct 23, 2026
CVE-2026-85557NONEN/A
  • Linux Debian logoLinux Debian
  • pdns-recursor
NoYesOct 23, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management