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: 4.4 Medium
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. 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 identified as CWE‑125, an out‑of‑bounds read. The EPSS score indicates a very low probability of exploitation (<1%), and the issue is not listed in the CISA KEV catalog. The CVSS score of 4.4 classifies the overall impact as low‑to‑moderate; however, its effect is a process termination that results in a denial of service. An attacker can supply numeric or non‑string input to the matches, first_match or match_details methods 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 defect 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 November 9, 2026 at 19:36 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 November 9, 2026 at 19:36 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 10 Nov 2026 21:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Mon, 09 Nov 2026 17:30:00 +0000

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 4.4, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:L'}


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-11-09T16:29:32.325Z

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

Link: CVE-2026-80490

cve-icon Vulnrichment

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

cve-icon NVD

Status : Deferred

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

Modified: 2026-11-09T17:17:33.200

Link: CVE-2026-80490

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-11-09T19:45:15Z

Weaknesses