Description
Algorithm::AhoCorasick::XS versions through 0.04 for Perl read the haystack string length before the scalar is stringified.

The matches, first_match and match_details methods use the T_STD_STRING typemap to translate Perl scalars (SVs) into strings via the std::string constructor, using the SvPV macro to stringify the haystack input, and the SvCUR macro to determine the length of the SV.

When the input SVs are references, integers (IVs) or floats (NVs), the SvCUR macro will return an invalid length if it is run before the input is stringified, leading to an out-of-bounds read which can abort the process.

Note that the evaluation order of arguments to std::string is unspecified. Depending on the compiler, SvCUR may be run first and lead to an abort that cannot be caught within Perl.

This can be triggered when the haystack is a numeric value, for example,

my $ac = Algorithm::AhoCorasick::XS->new( [ "11", "22" ] );
$ac->matches( 211 );

This can occur when the haystack is the result of reading data from decoded JSON or a numeric database column. It can also be triggered when using a blessed object as a haystack.
Published: 2026-09-30
Score: n/a
EPSS: < 1% Very Low
KEV: No
Impact: Denial of Service
Action: Patch Now
AI Analysis

Impact

Algorithm::AhoCorasick::XS in Perl versions through 0.04 uses a typemap that reads the haystack string length before converting a Perl scalar to a string. When the input scalar is a reference, an integer, or a floating point value, the length macro returns an invalid value before stringification, causing an out‑of‑bounds read that can abort the process. Because the evaluation order of the std::string constructor arguments is unspecified, a compiler that evaluates the length first will immediately trigger a crash that cannot be caught in Perl code. The result is a denial of service through process termination.

Affected Systems

Perl environments that use the CPAN module Algorithm::AhoCorasick::XS at version 0.04 or earlier. The vulnerability applies to any script or application that creates an Algorithm::AhoCorasick::XS object with a haystack containing numeric values, objects, or values obtained from decoded JSON or database columns.

Risk and Exploitability

The vulnerability is unpatched at present and is categorized as CWE‑125, an out‑of‑bounds read. EPSS information is unavailable and the issue is not listed in the CISA KEV catalog, but the potential impact of an abrupt process termination makes it a high‑severity risk for services relying on that module. An attacker can supply a numeric input to the matches, first_match or match_details methods, or any other interface that forwards haystack data, to trigger the crash. Deployment scenarios that expose the module to untrusted input – such as web applications or services processing external data – are most susceptible. Because the flaw cannot be mitigated locally within Perl, the recommended defense is to apply the provided patch or to ensure that all inputs are explicitly stringified before being processed by the module.

Generated by OpenCVE AI on September 30, 2026 at 19:14 UTC.

Remediation

Vendor Workaround

No fixed release is available. Apply the patch or the change in the linked pull request. For deployments that cannot apply the patch, ensure that all input passed to the matching functions is stringified, for example $ac->matches( "$input" );


OpenCVE Recommended Actions

  • Apply the vendor‑supplied patch or upgrade to a version of Algorithm::AhoCorasick::XS that incorporates the fix.
  • For workloads that cannot be upgraded immediately, force all input values to be stringified before calling matching functions, for example by using $ac->matches("$input").
  • Validate and sanitize all arguments to the matches, first_match, and match_details methods so that only legitimate string scalars are passed in, rejecting numeric or blessed objects that could trigger the defect.
  • Consider temporarily substituting Algorithm::AhoCorasick::XS with a safer pure‑Perl implementation or disabling its usage until the fix is applied.

Generated by OpenCVE AI on September 30, 2026 at 19:14 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 30 Sep 2026 18:30:00 +0000

Type Values Removed Values Added
References

Wed, 30 Sep 2026 15:30:00 +0000

Type Values Removed Values Added
Description Algorithm::AhoCorasick::XS versions through 0.04 for Perl read the haystack string length before the scalar is stringified. The matches, first_match and match_details methods use the T_STD_STRING typemap to translate Perl scalars (SVs) into strings via the std::string constructor, using the SvPV macro to stringify the haystack input, and the SvCUR macro to determine the length of the SV. When the input SVs are references, integers (IVs) or floats (NVs), the SvCUR macro will return an invalid length if it is run before the input is stringified, leading to an out-of-bounds read which can abort the process. Note that the evaluation order of arguments to std::string is unspecified. Depending on the compiler, SvCUR may be run first and lead to an abort that cannot be caught within Perl. This can be triggered when the haystack is a numeric value, for example, my $ac = Algorithm::AhoCorasick::XS->new( [ "11", "22" ] ); $ac->matches( 211 ); This can occur when the haystack is the result of reading data from decoded JSON or a numeric database column. It can also be triggered when using a blessed object as a haystack.
Title Algorithm::AhoCorasick::XS versions through 0.04 for Perl read the haystack string length before the scalar is stringified
Weaknesses CWE-125
References

Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: CPANSec

Published:

Updated: 2026-09-30T17:07:30.931Z

Reserved: 2026-08-26T13:32:56.300Z

Link: CVE-2026-80490

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Deferred

Published: 2026-09-30T16:19:10.127

Modified: 2026-09-30T19:57:08.043

Link: CVE-2026-80490

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-09-30T19:15:07Z

Weaknesses