UBUNTU-CVE-2026-129115: Medium severity ubuntu/libjson-xs-perl vulnerability
JSON::XS versions from 3.0 before 4.05 for Perl read freed stack memory when a FREEZE result's serialisation grows the Perl stack under allowtags in encoderv. With allowtags, an object's FREEZE method is called in list context and each returned value is encoded through a saved Perl stack pointer. When encoding a returned value calls back into Perl, through TOJSON under convertblessed or another FREEZE, and that callback grows the stack, the stack is reallocated while the saved pointer still refers to the freed block. Encoding such objects reads freed memory, and encode can return undef without an error.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
JSON::XSto a version that resolves this vulnerability.Fixed in 4.05
Event History
Frequently Asked Questions
What conditions are required to trigger this issue?
Encoding must use allow_tags, causing an object's FREEZE method to run. A value returned by FREEZE must then invoke Perl again during encoding, such as through TO_JSON with convert_blessed or through another FREEZE, and grow the Perl stack.
Are applications that do not use tagged-object serialization affected?
The described vulnerable path requires allow_tags in encode_rv. Applications that do not enable allow_tags are not affected by this specific condition.
What observable behavior can indicate that the issue was triggered?
The encode operation can read freed memory and return undef without reporting an error. Code that treats an undef encoding result as successful or does not check it may mask the failure.
What can be done before updating JSON::XS?
Avoid using allow_tags for affected encoding operations. Where possible, also avoid serialization paths in which FREEZE-returned values call back into Perl during encoding, including TO_JSON under convert_blessed or nested FREEZE handling.