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

CVE-2026-110686: Cpanel::JSON::XS Use-After-Free Vulnerability

CVE-2026-110686 is a use-after-free vulnerability in Cpanel::JSON::XS for Perl that occurs when filter callbacks remove themselves during JSON decoding, potentially causing process crashes through freed memory access.

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-110686 Overview

CVE-2026-110686 is a use-after-free vulnerability [CWE-416] in Cpanel::JSON::XS versions before 4.80, a widely used Perl JSON parser. The flaw resides in the decode_hv function, which handles hash (object) decoding. During decoding, the parser copies the filter_json_object and filter_json_single_key_object callbacks without taking references to them. When a filter callback removes the last single-key filter during execution, the callback table is freed while decoding is still in progress. Subsequent object dispatch occurs through freed memory, which can crash the process or lead to further memory corruption.

Critical Impact

An attacker who can influence JSON input processed by a Perl application using filter callbacks can trigger process crashes and potentially achieve controlled memory corruption through the freed callback table.

Affected Products

  • Cpanel::JSON::XS Perl module versions prior to 4.80
  • Perl applications that register filter_json_single_key_object or filter_json_object callbacks
  • Downstream distributions and container images bundling vulnerable Cpanel::JSON::XS releases

Discovery Timeline

  • 2026-10-19 - CVE-2026-110686 published to NVD
  • 2026-10-19 - Last updated in NVD database

Technical Details for CVE-2026-110686

Vulnerability Analysis

The vulnerability occurs in the hash decoding path of Cpanel::JSON::XS. When the decoder encounters a single-key object matching a registered filter, it dispatches to the user-supplied callback via call_sv. The decoder holds a raw pointer into the parser's filter callback table but does not increment the reference count on the specific callback SV before invocation.

If the callback mutates parser state by calling filter_json_single_key_object(k => undef) on itself, the filter table is freed. When control returns to decode_hv and the decoder continues processing nested objects using the stale pointer, it operates on freed memory. The attacker-controlled JSON determines which freed slot is dereferenced next.

Root Cause

The root cause is missing reference counting on filter callback scalars during active use. The decoder treats HeVAL(cb) as a borrowed reference valid for the lifetime of the decode, but Perl's reference counting semantics do not guarantee this when the callback itself can mutate the owning table. This is a classic use-after-free [CWE-416] caused by lifetime assumptions that break under reentrancy.

Attack Vector

Exploitation requires that a Perl application register a filter callback that can be removed during decoding, and that the application decode attacker-influenced JSON. In server-side contexts, this includes web APIs, message queue consumers, and configuration loaders that use Cpanel::JSON::XS with filter hooks. The result ranges from denial of service through process crash to potential memory corruption depending on heap layout.

perl
# Proof-of-concept test case from the upstream patch
use strict;
use Test::More tests => 1;

use Cpanel::JSON::XS;

my $called = 0;
sub Ghost::run { $called++ }

# the callback removes itself; the hash it returns may reuse the freed table
my $json = Cpanel::JSON::XS->new;
$json->filter_json_single_key_object(k => sub {
  $json->filter_json_single_key_object(k => undef);
  return { outer => $_[0] };
});
$json->decode('{"outer":{"k":"Ghost::run"}}');
is( $called, 0, "callback removed itself in filter" );

Source: GitHub Patch Commit

Detection Methods for CVE-2026-110686

Indicators of Compromise

  • Unexpected segmentation faults or SIGSEGV crashes in Perl processes that parse untrusted JSON input
  • Core dumps referencing decode_hv, call_sv, or filter callback addresses within Cpanel::JSON::XS
  • Repeated worker restarts in Perl web stacks (Mojolicious, Catalyst, Dancer) correlated with specific JSON payloads

Detection Strategies

  • Inventory installed Perl modules and flag any Cpanel::JSON::XS installation older than 4.80 using cpanm --info or perldoc -m
  • Review application source for calls to filter_json_single_key_object or filter_json_object combined with handling of external JSON
  • Enable Perl crash telemetry and parse dmesg for userspace segfaults attributable to the Perl interpreter

Monitoring Recommendations

  • Monitor process exit codes and crash frequency on hosts running Perl services that accept JSON
  • Forward application and system logs to a centralized SIEM for correlation of crashes with inbound request payloads
  • Track package manager events for upgrades or installations of Cpanel-JSON-XS to confirm patch rollout

How to Mitigate CVE-2026-110686

Immediate Actions Required

  • Upgrade Cpanel::JSON::XS to version 4.80 or later across all Perl environments
  • Audit application code for filter callbacks that can remove themselves or other filters during decoding
  • Restrict exposure of JSON parsing endpoints to trusted input sources until the patch is deployed

Patch Information

The fix is included in Cpanel::JSON::XS 4.80. The patch wraps callback invocation with sv_2mortal(SvREFCNT_inc(HeVAL(cb))), which increments the reference count and schedules decrement after the call completes. This ensures the callback SV remains valid even if the owning filter table is freed mid-decode. See the GitHub Patch Commit and MetaCPAN Release Changes for full details.

text
// Upstream fix in XS.xs - retain callback across call_sv
               XPUSHs (HeVAL (he));
               sv_2mortal (sv);
 
-              PUTBACK; count = call_sv (HeVAL (cb), G_ARRAY); SPAGAIN;
+              PUTBACK; count = call_sv (sv_2mortal (SvREFCNT_inc (HeVAL (cb))), G_ARRAY); SPAGAIN;
 
               if (!json_validate (&dec->json))
                   croak (NULL);

Source: GitHub Patch Commit

Workarounds

  • Refactor filter callbacks so they do not deregister themselves or other filters during decoding
  • Use JSON::PP or an alternative pure-Perl parser for untrusted input until the upgrade is applied
  • Place a validating proxy or schema check in front of Perl JSON endpoints to reject deeply nested single-key objects
bash
# Upgrade via cpanm
cpanm Cpanel::JSON::XS@4.80

# Verify installed version
perl -MCpanel::JSON::XS -e 'print $Cpanel::JSON::XS::VERSION, "\n"'

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.