Security Advisories (14)
CVE-2026-110672 (2026-10-19)

Cpanel::JSON::XS versions before 4.80 for Perl leak the decoded key of an object rejected for a duplicate key or a missing colon in decode_hv. A quoted key of 24 or more bytes, or one containing a non-ASCII byte or an escape sequence, is decoded into a new scalar. Nothing frees that scalar when the object is rejected for a missing ':' after the key or, from 4.09, for a duplicate key. Duplicate keys are an error unless allow_dupkeys, dupkeys_as_arrayref or relaxed is set. A process that keeps running after a failed decode retains one key per rejected document, with its size chosen by the sender. Repeated requests exhaust process memory.

CVE-2026-110673 (2026-10-19)

Cpanel::JSON::XS versions before 4.80 for Perl allow stack exhaustion via nested tagged values under allow_tags in decode_tag. With allow_tags, "(" starts a tagged value. Its tag and value are decoded recursively, and each can start another tagged value. Unlike arrays and objects, this nesting is not counted against max_depth. A run of "(" bytes exhausts the C stack and triggers an uncatchable segmentation fault regardless of max_depth.

CVE-2026-110674 (2026-10-19)

Cpanel::JSON::XS versions from 4.33 before 4.80 for Perl miss duplicate non-ASCII bare keys, allowing type confusion under dupkeys_as_arrayref in decode_hv. With allow_barekey, which relaxed enables, a bare key containing a non-ASCII byte is stored as UTF-8 but looked up as raw bytes, so a repeated key escapes the duplicate-key check and replaces the earlier value. From 4.41, under dupkeys_as_arrayref, a bare repeat replaces the array that collects a key's values with a plain value, and the next quoted repeat pushes onto that value as if it were an array. A JSON integer there is dereferenced as a pointer. Untrusted JSON decoded with relaxed and dupkeys_as_arrayref can crash the process or dereference an address chosen by a JSON number.

CVE-2026-110675 (2026-10-19)

Cpanel::JSON::XS versions from 4.33 before 4.80 for Perl accept malformed UTF-8 in bare hash keys under allow_barekey in decode_hv. With utf8 and allow_barekey, which relaxed enables, a quoted key is validated as UTF-8 but a bare key's bytes are stored as a UTF-8 flagged string without any check. Malformed UTF-8, control bytes and backslashes reach the decoded hash, while malformed UTF-8 and control bytes in a quoted key or a value are rejected. Later operations on the key, including lc, uc or encoding the hash again, die with a malformed UTF-8 error.

CVE-2026-110676 (2026-10-19)

Cpanel::JSON::XS versions before 4.80 for Perl allow memory exhaustion by encoding exponent notation as full decimal digits under allow_bignum. With allow_bignum, a JSON number with a fraction or exponent decodes to a Math::BigFloat, which stores the exponent separately and so decodes cheaply. Encoding it untyped or as JSON_TYPE_FLOAT writes the plain decimal form with one digit per unit of exponent. Nothing bounds the exponent, so the 12-byte text [1e30000000] encodes to 30 MB. Untrusted JSON decoded with allow_bignum and encoded again can exhaust memory and CPU.

CVE-2026-110677 (2026-10-19)

Cpanel::JSON::XS versions from 4.28 before 4.80 for Perl leak the array collecting duplicate key values under dupkeys_as_arrayref in decode_hv. With dupkeys_as_arrayref, the values of a duplicate object key are collected into a new array. An extra reference is never released, so the array and every value in it outlive the decoded structure. The array also leaks when decoding fails after a duplicate key. Repeatedly decoding untrusted JSON with a duplicate key holding a large value exhausts process memory.

CVE-2026-110678 (2026-10-19)

Cpanel::JSON::XS versions before 4.80 for Perl allow memory exhaustion by buffering incremental input past max_size in incr_parse. The parser appends each chunk to its buffer. In scalar or list context, it compares max_size with how far it has progressed, not with the buffer length. A chunk that starts with a NUL byte stops the parser before it progresses, and a call in void context skips the check, so the buffer grows without limit. A peer streaming data to an incr_parse consumer can exhaust process memory regardless of max_size.

CVE-2026-110680 (2026-10-19)

Cpanel::JSON::XS versions from 4.20 before 4.80 for Perl write out of bounds when a tied or shared hash grows during canonical encoding in encode_hv. With canonical, the keys of a tied or threads::shared hash are counted before a second pass collects them for sorting. The encoder uses a fixed 64-entry stack array or, for larger counts, a heap array sized from the first pass. If the second pass exceeds that capacity, entries are written out of bounds before the counts are compared. This corrupts stack or heap memory and can crash the process.

CVE-2026-110681 (2026-10-19)

Cpanel::JSON::XS versions before 4.80 for Perl use the parent interpreter's scalars from a parser object cloned into a new ithread. A parser object holds its callbacks and its incremental parse buffer as raw scalar pointers. When a thread is created, these are copied into the new interpreter unchanged, so the child's parser uses, and later frees, scalars that belong to the parent and may already have been freed there. A parser created before a thread starts and used inside it can call freed callbacks, corrupt reference counts and crash the process.

CVE-2026-110682 (2026-10-19)

Cpanel::JSON::XS versions from 4.42 before 4.80 for Perl let input chunking change the decoded value of top-level numbers in incr_parse. allow_nonref is enabled by default and incr_parse inherits it. A top-level number, true, false or null has no closing delimiter, so the incremental parser decodes whatever has arrived. The bytes 12 decode as one value when read together, but as 1 and then 2 when split across two reads. A peer that can influence read boundaries can change how many messages a stream consumer decodes and what values they carry.

CVE-2026-110684 (2026-10-19)

Cpanel::JSON::XS versions from 3.0202 before 4.80 for Perl leak memory and retain overloaded objects when encoding values as strings in encode_stringify. encode_stringify writes a value in its string form under allow_stringify, under convert_blessed for objects without TO_JSON, and under allow_bignum. For an array or hash object with a "" overload, and from 4.20 a scalar object, it takes an extra reference that is never released, so the object and everything it references are never freed. From 4.10 it also never frees its copy of the string. Repeatedly encoding data that contains such values grows process memory without bound.

CVE-2026-110685 (2026-10-19)

Cpanel::JSON::XS versions before 4.80 for Perl leak the decoded arguments of a tagged value when its THAW method dies in decode_tag. With allow_tags, a tagged value's class name and argument array are decoded and passed to the class's THAW method. Both are released only after THAW returns, so a THAW that dies leaves the whole decoded argument structure allocated. Each rejected document leaks data of a size the sender chooses, so a process that catches the error and keeps running exhausts its memory.

CVE-2026-110686 (2026-10-19)

Cpanel::JSON::XS versions before 4.80 for Perl use freed filter callbacks when a filter removes itself during decoding in decode_hv. A decode copies the parser's filter_json_object and filter_json_single_key_object callbacks without taking references to them. A filter callback that removes the last single-key filter frees the callback table while the decode in progress still uses it. The next object is dispatched through freed memory and can crash the process.

CVE-2026-110687 (2026-10-19)

Cpanel::JSON::XS versions from 4.43 before 4.80 for Perl misorder byte-string keys during canonical encoding in utf16_cmp. canonical sorts keys by UTF-16 code units. When any key in a hash is UTF-8 flagged, every key is decoded as UTF-8 for the comparison, including byte-string keys that the encoder writes out as Latin-1 characters. A byte-string key whose bytes are valid UTF-8 is sorted out of order, and two keys that encode differently can compare equal and are left in hash order. The same data can encode to different canonical documents across processes.

NAME

cpanel_json_xs - Cpanel::JSON::XS commandline utility

SYNOPSIS

cpanel_json_xs [-v] [-f inputformat] [-t outputformat]

DESCRIPTION

cpanel_json_xs converts between some input and output formats (one of them is JSON).

The default input format is json and the default output format is json-pretty.

OPTIONS

-v

Be slightly more verbose.

-f fromformat

Read a file in the given format from STDIN.

fromformat can be one of:

json - a json text encoded, either utf-8, utf16-be/le, utf32-be/le
json-nonref - json according to RFC 7159
json-relaxed - json with all relaxed options
json-unknown - json with allow_unknown
storable - a Storable frozen value
storable-file - a Storable file (Storable has two incompatible formats)
bencode - uses one of Net::BitTorrent::Protocol::BEP03::Bencode, Bencode or the broken Convert::Bencode, if available (used by torrent files, among others)
clzf - Compress::LZF format (requires that module to be installed)
eval - evaluate the given code as (non-utf-8) Perl, basically the reverse of "-t dump"
yaml - loose YAML (requires YAML)
yaml-tiny - loose YAML (requires YAML::Tiny or CPAN::Meta::YAML)
yaml-xs - strict YAML 1.2 (requires YAML::XS)
yaml-syck - YAML (requires YAML::Syck)
cbor - CBOR (via CBOR::XS)
string - do not attempt to decode the file data
sereal - Sereal (via Sereal::Decoder)
none - nothing is read, creates an undef scalar - mainly useful with -e
-t toformat

Write the file in the given format to STDOUT.

toformat can be one of:

json, json-utf-8 - json, utf-8 encoded
json-pretty - as above, but pretty-printed with sorted object keys
json-stringify - as json-pretty with allow_stringify
json-relaxed - as json-pretty, but with the additional options

->allow_stringify->allow_blessed->convert_blessed->allow_unknown ->allow_tags->stringify_infnan(1)

json-utf-16le, json-utf-16be - little endian/big endian utf-16
json-utf-32le, json-utf-32be - little endian/big endian utf-32
storable - a Storable frozen value in network format
storable-file - a Storable file in network format (Storable has two incompatible formats)
bencode - uses one of Net::BitTorrent::Protocol::BEP03::Bencode, Bencode or the broken Convert::Bencode, if available (used by torrent files, among others)
clzf - Compress::LZF format
yaml - loose YAML (requires YAML)
yaml-tiny - loose YAML (requires YAML::Tiny or CPAN::Meta::YAML)
yaml-xs - strict YAML 1.2 (requires YAML::XS)
yaml-syck - YAML (requires YAML::Syck)
dump - Data::Dump
dumper - Data::Dumper
string - writes the data out as if it were a string
sereal - Sereal (via Sereal::Encoder)
none - nothing gets written, mainly useful together with -e

Note that Data::Dumper doesn't handle self-referential data structures correctly - use "dump" instead.

-e code

Evaluate perl code after reading the data and before writing it out again - can be used to filter, create or extract data. The data that has been read is in $_, and whatever is in there is written out afterwards.

EXAMPLES

cpanel_json_xs -t none <isitreally.json

"JSON Lint" - tries to parse the file isitreally.json as JSON - if it is valid JSON, the command outputs nothing, otherwise it will print an error message and exit with non-zero exit status.

<src.json cpanel_json_xs >pretty.json

Prettify the JSON file src.json to dst.json.

cpanel_json_xs -f storable-file <file

Read the serialized Storable file file and print a human-readable JSON version of it to STDOUT.

cpanel_json_xs -f storable-file -t yaml <file

Same as above, but write YAML instead (not using JSON at all :)

cpanel_json_xs -f none -e '$_ = [1, 2, 3]'

Dump the perl array as UTF-8 encoded JSON text.

<torrentfile cpanel_json_xs -f bencode -e '$_ = join "\n", map @$_, @{$_->{"announce-list"}}' -t string

Print the tracker list inside a torrent file.

lwp-request http://cpantesters.perl.org/show/Cpanel-JSON-XS.json | cpanel_json_xs

Fetch the cpan-testers result summary Cpanel::JSON::XS and pretty-print it.

cpanel_json_xs -f yaml-xs -t yaml-tiny <META.yml   >MYMETA.yml
cpanel_json_xs -f yaml-tiny -t yaml-xs <MYMETA.yml >XSMETA.yml
cpanel_json_xs -f yaml -t yaml <XSMETA.yml #BOOM!
Error: YAML_LOAD_ERR_BAD_MAP_ELEMENT

Compare YAML en- and decoders, and see that YAML::XS generates unparsable YAML https://github.com/ingydotnet/yaml-libyaml-pm/issues/9

AUTHOR

Copyright (C) 2008 Marc Lehmann <json@schmorp.de> Copyright (C) 2016 Cpanel Inc