CVE-2026-12844: Heap Buffer Overflow in List::Util::XS pairwise() Function
List::Util::XS, a Perl module used to optimize list processing operations, contains a critical memory safety flaw in its pairwise() function. When the function processes pairs of values, it allocates memory to store results but fails to allocate enough space if a single block invocation returns a large amount of data. Specifically, the memory allocation strategy grows by only four times the current size in one step, but if a block returns more than that, the function writes beyond the allocated buffer, corrupting heap memory. Any application using pairwise() with a block that can produce large outputs in a single call is at risk of denial of service or potential code execution.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 7.5 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-122, CWE-787
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-25 / 2026-06-25
NVD description (verbatim)
List::SomeUtils::XS versions before 0.59 for Perl have a heap buffer overflow in the pairwise function. pairwise() collects the values returned by the block into a heap buffer sized to the longer input array, then grows the buffer before each copy with a single quadrupling (alloc <<= 2) instead of a loop. A block call that returns more than four times the current allocation in one invocation outgrows that one quadrupling, and the copy writes past the end of the buffer. Any caller of pairwise() whose block returns, for a single pair, more than four times the longer input array's length writes past the buffer and corrupts the heap.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-12844 describes a heap buffer overflow in List::Util::XS versions prior to 0.59. The pairwise() function allocates a heap buffer sized to accommodate the longer of two input arrays. When storing the return values from the user-supplied block, the allocation grows using a single quadrupling operation (alloc <<= 2) before copying results. The vulnerability manifests when a block call returns more than four times the current allocation in a single invocation; this single quadrupling step is insufficient to contain the output, causing the copy operation to write past the buffer boundary and corrupt heap memory. The affected code path requires that the block's return value for a single pair exceeds four times the size of the longer input array. This is classified as a heap-based buffer overflow (CWE-122, CWE-787).
Business impact
Denial of service is the primary risk: a crafted or unexpected block return value triggers heap corruption, causing the Perl process to crash and interrupt service. In environments where pairwise() is used to process user-controlled data or dynamic inputs, this becomes a reliable DoS vector. Secondary risk depends on heap layout and attacker control; memory corruption in the heap can theoretically be leveraged for code execution, though no public exploitation techniques are documented. For organizations maintaining Perl-based infrastructure (data pipelines, automation, CPAN-dependent applications), this creates operational instability if the vulnerable module version is in active use.
Affected systems
List::Util::XS versions before 0.59 are affected. Any Perl application or service that explicitly imports and calls the pairwise() function from this module is at risk. This includes CPAN-dependent ecosystems, Perl-based web frameworks, data processing pipelines, and automation scripts. The vulnerability does not affect List::Util's pure-Perl fallback implementation, only the XS (C extension) accelerated version. Systems running older Perl distributions that bundle pre-0.59 List::Util::XS are particularly vulnerable. Verify your installed version using 'perl -MList::Util::XS -e "print \$List::Util::XS::VERSION"'.
Exploitability
Exploitation requires an attacker to control or influence the block code passed to pairwise() or to supply input data that causes the block to return a sufficiently large result. The barrier to exploitation depends on the application's architecture: if pairwise() is called with static, known-safe blocks, the risk is lower. If the block is derived from user input, configuration, or plugin code, or if input arrays are user-controlled and influence block output size, exploitation becomes more straightforward. The CVSS 3.1 score of 7.5 (HIGH) reflects a network-accessible attack vector with no authentication required and a denial-of-service impact. Code execution is theoretically possible but not straightforward without additional heap feng shui or information disclosure.
Remediation
Upgrade List::Util::XS to version 0.59 or later. For CPAN-managed installations, run 'cpan -i List::Util::XS' or 'cpanm List::Util::XS' to fetch and install the patched version. Alternatively, use the pure-Perl fallback by uninstalling the XS module (though this sacrifices performance). Verify the upgrade with 'perl -MList::Util::XS -e "print \$List::Util::XS::VERSION"' to confirm version 0.59+. If immediate patching is not possible, audit all calls to pairwise() in your codebase to understand whether untrusted input flows into the function or whether block return sizes are bounded.
Patch guidance
Update List::Util::XS to version 0.59 or later through your Perl module manager (cpan, cpanm, conda, or your distribution's package manager). Verify the patch by checking the module version after installation. In containerized environments, rebuild images with the patched dependency. In monolithic Perl installations, update the module and restart affected services (web servers, daemons, cron jobs). Test that pairwise() continues to function correctly in your application post-patch; the fix aligns memory allocation with actual buffer requirements, so behavior should be identical for legitimate use cases.
Detection guidance
Monitor for process crashes or segmentation faults in Perl applications, particularly those known to use List::Util::XS. Review application logs for abnormal termination. If possible, instrument pairwise() calls to log block invocations and return value sizes; a return size exceeding four times the input array length is a warning sign. Scan your CPAN dependency tree and lock files (cpanfile, Makefile.PL, dist.ini) to identify which projects or services depend on List::Util::XS and their current version constraints. Use 'perl -MList::Util::XS -e' to query installed versions across your infrastructure.
Why prioritize this
This vulnerability warrants prompt patching due to its HIGH severity, the ease of triggering a denial of service (no authentication or interaction required), and the commonality of pairwise() in data processing workflows. While exploitation for code execution is not straightforward, heap corruption is unpredictable and can occasionally be weaponized. The fix is mature (version 0.59 was released to address this specific flaw) and carries minimal upgrade risk. Prioritize systems running Perl-based services, batch jobs, or automation that depend on List::Util::XS.
Risk score, explained
The CVSS 3.1 score of 7.5 (HIGH) assigns HIGH severity due to the high impact of availability loss (the denial-of-service consequence of heap corruption) combined with a network attack vector (AV:N), low attack complexity (AC:L), and no privilege or interaction requirements (PR:N/UI:N). Confidentiality and integrity are scored as not impacted (C:N/I:N) because the vulnerability does not leak secrets or directly enable arbitrary writes, though heap corruption can theoretically lead to information disclosure or code execution under specific heap layout conditions. This score appropriately reflects the practical threat: an attacker can reliably crash a service but cannot obviously steal data or gain command execution without additional exploitation techniques.
Frequently asked questions
Does this affect my application if we use pure Perl or avoid pairwise()?
No. The vulnerability is specific to the XS (compiled C extension) version of List::Util. If your environment uses only the pure-Perl List::Util implementation or does not call pairwise(), you are not affected. You can check by running 'perl -e "print $INC{\"List/Util.pm\"}"' to verify which implementation is loaded.
Can this be exploited remotely, or is it internal only?
The CVSS vector (AV:N) indicates a network-accessible attack surface, meaning it can be triggered from the network if pairwise() processes untrusted input (e.g., from a web request or API call). However, exploitation requires that the data passed to pairwise()'s block code causes an output overflow, so it is not universally exploitable in all applications—only those that use pairwise() on user-controlled data.
What does 'buffer overflow' mean in practical terms for my operations?
A buffer overflow means the function writes data beyond the memory it allocated, corrupting adjacent data on the heap. In practice, this causes the process to crash (crash = denial of service). In rare cases, with careful input, attackers can overwrite adjacent data structures to execute arbitrary code, but this requires deep knowledge of heap layout and is not a guaranteed outcome.
Is there a workaround if we cannot patch immediately?
The pure-Perl fallback is available and not vulnerable. You can uninstall List::Util::XS and rely on the slower pure-Perl implementation. Alternatively, audit your code to confirm pairwise() is not called with untrusted or unbounded inputs, reducing the attack surface while you plan your patch deployment.
This analysis is based on published vulnerability data and the CVE record as of June 2026. Patch availability, version numbers, and vendor timelines may change; always verify against official vendor advisories before deploying patches. No exploit code or weaponized proof-of-concept is provided. This page is for informational purposes and does not constitute security advice for your specific environment. Conduct your own risk assessment, consult your security team, and test patches in a controlled environment before production deployment. Source: NVD (public-domain), retrieved 2026-08-03. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-0149HIGHAndroid RTP Heap Buffer Overflow Leading to Remote Code Execution
- CVE-2026-42055HIGHNGINX HTTP/2 Heap Buffer Overflow Vulnerability – Exploit & Remediation
- CVE-2026-44421HIGHFreeRDP Heap Buffer Overflow in RDPGFX (CVSS 8.8)
- CVE-2026-46520HIGHImageMagick Out-of-Bounds Heap Write Denial of Service
- CVE-2026-47747HIGHstable-diffusion.cpp Heap Buffer Overflow in .ckpt Parser
- CVE-2026-47749HIGHHeap Buffer Overflow in stable-diffusion.cpp Checkpoint Parser
- CVE-2026-53465MEDIUMImageMagick Heap Buffer Overflow in SF3 Encoder
- CVE-2020-9695HIGHAdobe Acrobat Reader Out-of-Bounds Write RCE Vulnerability