---
id: "CVE-2026-124541"
page: "https://infrastack.ai/live/CVE-2026-124541"
kind: "vulnerability"
aliases: ["CVE-2026-124541"]
title: "Perl JSON::XS: rejected long strings leak memory on each failed decode"
severity: "medium"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["json-xs", "package", "perl", "self-hosted"]
not_affected_if: ["short-lived-scripts", "trusted-input-only"]
published_at: "2026-11-14T12:17:43+00:00"
first_seen_at: "2026-11-14T12:28:30+00:00"
updated_at: "2026-11-14T12:30:32+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-124541", "first_seen_at": "2026-11-14T12:28:30+00:00"}]
exploit_sources: []
---

# Perl JSON::XS: rejected long strings leak memory on each failed decode

Link for people: https://infrastack.ai/live/CVE-2026-124541 (this .md is for agents)

JSON::XS for Perl versions before 4.05 keep the decoded part of a long string after the decoder rejects it, because a temporary scalar is never freed. A long-running process that keeps parsing bad input can have its memory exhausted by repeated requests.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Find JSON::XS in the Perl dependencies, for example with `perl -MJSON::XS -e 'print $JSON::XS::VERSION'`
- Check for `JSON::XS` in `cpanfile`, `Makefile.PL` or `META.json` of each deployed Perl application
- Confirm whether the service decodes untrusted JSON with `decode_json` or `JSON::XS->new->decode` in a long-running process

## Fix

- JSON::XS: move to version 4.05 or later (the sources say versions before 4.05 are affected)

## Timeline

- 2026-11-14T12:28:30+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-124541

## From the sources

JSON::XS versions before 4.05 for Perl leak the decoded part of a rejected long string in decode_str.

A string is decoded through a fixed-size buffer (16 KiB in 4.04), and each time the buffer fills its contents move into a new scalar. Nothing frees that scalar when the string is then rejected for a control character, an invalid escape, malformed UTF-8 or the end of the input.

A process that keeps running after a failed decode retains the decoded part of each rejected string, with its size chosen by the sender. Repeated requests exhaust process memory.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
