Skip to main content
Vulnerability Database/CVE-2026-110680

CVE-2026-110680: Cpanel::JSON::XS Buffer Overflow Vulnerability

CVE-2026-110680 is a buffer overflow flaw in Cpanel::JSON::XS for Perl that corrupts memory and can crash processes during canonical encoding. This post explains its technical details, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-110680 Overview

CVE-2026-110680 is an out-of-bounds write vulnerability [CWE-787] in the Cpanel::JSON::XS Perl module, affecting versions from 4.20 before 4.80. The flaw resides in the encode_hv function during canonical JSON encoding of tied hashes or hashes shared via threads::shared. When such a hash grows between the counting pass and the collection pass, the encoder writes entries beyond its allocated stack or heap buffer. This corrupts memory and can crash the Perl process.

Critical Impact

Memory corruption via out-of-bounds write during canonical encoding of mutable tied or shared hashes, resulting in process crashes and potential heap corruption in long-running Perl services.

Affected Products

  • Cpanel::JSON::XS for Perl, versions 4.20 through 4.79
  • Perl applications relying on canonical JSON encoding of tied hashes
  • Perl applications using threads::shared hashes with Cpanel::JSON::XS

Discovery Timeline

  • 2026-10-19 - CVE-2026-110680 published to the National Vulnerability Database (NVD)
  • 2026-10-19 - Last updated in NVD database

Technical Details for CVE-2026-110680

Vulnerability Analysis

The vulnerability occurs in the canonical encoding path of encode_hv, the internal routine that serializes Perl hashes to JSON. Canonical mode requires sorted keys, so the encoder performs two passes over the hash. The first pass counts entries, and the second pass collects the hash entry (HE) pointers into a buffer for sorting.

For hashes with 64 or fewer keys, the encoder uses a fixed stack array of 64 entries. For larger hashes, it allocates a heap buffer sized according to the first-pass count. If the second pass yields more entries than the first pass counted, the encoder writes past the end of the array before any bounds comparison occurs.

Root Cause

Tied hashes and threads::shared hashes can mutate between iterations because external code controls their storage. The two-pass design of encode_hv assumed a stable key count across both passes. No guard prevented the collection loop from writing beyond the buffer when the hash grew between passes, resulting in an out-of-bounds write [CWE-787] into either the C stack frame or the heap allocation.

Attack Vector

Exploitation requires an attacker to influence the contents of a tied or shared hash that will be canonically encoded by Cpanel::JSON::XS. Scenarios include Perl web services that serialize session or cache data backed by tied storage, or multi-threaded Perl workers sharing state. Triggering a mutation during encoding corrupts memory and crashes the process. There are no public reports of exploitation in the wild, and the CISA Known Exploited Vulnerabilities catalog does not list this CVE.

text
/* Patch excerpt from XS.xs: encode_hv now bounds canonical key snapshots */
            /* fill the HE vector and check if SVKEY or UTF8 */
            while ((he = hv_iternext (hv)))
              {
+               if (UNLIKELY(i >= count))
+                 croak ("Unstable %shash key counts %d vs %d in subsequent runs",
+                        is_tied ? "tied " : "", (int)count, (int)i + 1);
                if (UNLIKELY(is_tied))
                  { // tied entries are completely freed in the next iteration
                    HE *he1;

Source: GitHub Commit 44c4591

Detection Methods for CVE-2026-110680

Indicators of Compromise

  • Unexpected SIGSEGV or SIGABRT termination of Perl processes that call encode_json or encode with canonical => 1 enabled.
  • Core dumps whose stack traces include encode_hv within Cpanel::JSON::XS.
  • Error messages containing the string Unstable hash key counts or Unstable tied hash key counts after patching to 4.80, indicating a prior exploitation attempt pattern.

Detection Strategies

  • Inventory installed Perl modules across hosts and flag Cpanel::JSON::XS versions between 4.20 and 4.79 inclusive.
  • Audit application code for canonical => 1 usage on hashes that are tied or declared with threads::shared.
  • Monitor crash telemetry and systemd journal entries for repeated Perl worker restarts correlated with JSON serialization code paths.

Monitoring Recommendations

  • Enable core dump collection on Perl application servers and route core files to a central analysis location.
  • Track CPAN module versions through configuration management tooling and alert on vulnerable version ranges.
  • Correlate process crash events with request logs to identify inputs that mutate tied hashes during serialization.

How to Mitigate CVE-2026-110680

Immediate Actions Required

  • Upgrade Cpanel::JSON::XS to version 4.80 or later on all hosts, including embedded Perl interpreters inside web applications and system utilities.
  • Rebuild and redeploy any Perl applications that statically link or bundle the module to ensure the patched XS code is loaded.
  • Review all call sites that enable canonical on hashes whose storage is externally controlled.

Patch Information

The fix is included in Cpanel::JSON::XS version 4.80. The patch adds a bounds check inside the encode_hv collection loop that raises a Perl exception via croak when the second-pass iteration count exceeds the first-pass count. See the upstream commit 44c4591cc62ea7f453a0ed931abf24394e1560a1 and the MetaCPAN release notes for 4.80.

Workarounds

  • Disable canonical encoding by removing canonical => 1 from encoder configurations where sorted key order is not strictly required.
  • Avoid passing tied hashes or threads::shared hashes directly to encode_json; copy the data into a plain Perl hash first using an atomic snapshot.
  • Serialize access to shared hashes with a mutex during JSON encoding to prevent concurrent mutation.
bash
# Verify the installed version on each host
perl -MCpanel::JSON::XS -e 'print $Cpanel::JSON::XS::VERSION, "\n"'

# Upgrade through cpanm
cpanm Cpanel::JSON::XS@4.80

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.