Security Advisories (6)
CVE-2025-40929 (2025-09-08)

Cpanel::JSON::XS before version 4.40 for Perl has an integer buffer overflow causing a segfault when parsing crafted JSON, enabling denial-of-service attacks or other unspecified impact

CPANSA-Cpanel-JSON-XS-2016-02 (2016-11-23)

Overflow during processing of ill-formed UTF-8 strings.

CPANSA-Cpanel-JSON-XS-2016-01

Possible overflows in av and hv length types.

CVE-2022-48623 (2023-02-21)

Wrong error messages/sometimes crashes or endless loops with invalid JSON in relaxed mode

CVE-2026-9334 (2026-06-03)

Cpanel::JSON::XS versions before 4.41 for Perl allow type confusion via duplicate object keys when dupkeys_as_arrayref is enabled. decode_hv() collapses duplicate object keys into an array reference under dupkeys_as_arrayref. The branch reached for a duplicate key tests `SvTYPE (old_value) != SVt_RV && SvTYPE (SvRV (old_value)) != SVt_PVAV`, which evaluates SvRV(old_value) before establishing that old_value is a reference. When the existing value is a plain scalar rather than an array reference, a non-reference scalar is dereferenced as a reference. A caller decoding untrusted JSON with dupkeys_as_arrayref enabled is crashed, and the incompatible access follows a pointer taken from attacker controlled scalar contents.

CVE-2026-9516 (2026-06-03)

Cpanel::JSON::XS versions before 4.41 for Perl allow denial of service via UTF-8 BOM prefixed input when a decode filter callback throws. To skip a leading 3-byte UTF-8 BOM, decode_json() advances the input scalar's string pointer past the mark with SvPV_set() and restores it only on the normal return path. When decoding aborts through a Perl exception, for example a filter_json_object callback that croaks, the restore is skipped and the scalar is left with its string pointer offset into its own buffer and a shortened length. When that scalar is later freed, the allocator receives an invalid pointer and the interpreter aborts. A single BOM prefixed document decoded with a throwing filter callback crashes any caller.

Changes for version 3.0217_05 - 2016-10-07

  • fix t/gh70-asan.t for older perls < 5.14

Changes for version 3.0217_04 - 2016-10-07

  • fix and document wrong strEQc usage in new(). #70 (ilmari)

Changes for version 3.0217_03 - 2016-10-06

  • expect_false() macro fix for MSVC
  • fix av and hv length types: protect from security sensitive overflows, add HVMAX_T and RITER_T
  • add new "Hash key too large" error. perl5 silently truncates it, we prefer errors, cperl 5.25.1 does error also.
  • fix broken 5.8.1 SvPOK_only, i.e. assert_not_ROK

Changes for version 3.0217_02 - 2016-10-04

  • Use faster strEQc macros from cperl with constant strings.
  • prefer memEQ for systems without memcmp, to use bcmp there.
  • add more expect_false() to inf/nan branches.

Changes for version 3.0217_01 - 2016-10-04

  • Detect INF/NAN: ?/++/-?/--- on HP-UX (#56)
  • New stringify_infnan(3) infnan_mode. Easy to detect platform independent "inf", "-inf" or "nan" strings with double quotes, with qnan, snan or negative nan unified to "nan".

Documentation

Cpanel::JSON::XS commandline utility

Modules

cPanel fork of JSON::XS, fast and correct serializing
dummy module providing JSON::XS::Boolean

Examples