Skip to content
Medium 6.9

Unbounded integer parsing in JSON.decode/1 enables CPU and memory exhaustion denial of service in Elixir

CVE-2026-115274 First seen on SecPulse

Affected packages

PackageAffected → Fixed
elixir-langelixir
≥ 793c1147210388587defb649f25f293ffbfa6b1b (no fix yet)→ 7154e8781da9fd016a973ea01776a011c8b5726a, c81f12265919c34a0d5134f1905a4eb4edaea1c2, cd158efacdc10b30232864251747dff9b8387dfe, ee5cc23f8928aa5a0f25bb7f28e42ecfc7b7d396

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

Summary

Improper Validation of Specified Quantity in Input vulnerability in the Elixir standard library's JSON module allows an unauthenticated attacker who supplies a JSON document to cause a denial of service through CPU and memory exhaustion.

JSON.decode/1 and JSON.decode!/1 convert each integer literal with erlang:binary_to_integer/1 and do not bound its length. A literal of one million digits decodes successfully but costs 100 to 300 times as much CPU as a string of the same length, so one request body of a few megabytes holds a scheduler for about a second. A literal of more than about 1.29 million digits raises SystemLimitError. Applications generated by phx.new decode request bodies with JSON in Plug.Parsers, before routing and authentication.

This issue affects elixir: from 1.18.0-rc.0 before 1.18.6, from 1.19.0-rc.0 before 1.19.7, and from 1.20.0-rc.0 before 1.20.5.

Details

1. Default integer decoder

JSON.decode/1 and JSON.decode!/1 call JSON.decode/3 without an integer decoder. Up to the removal of Erlang/OTP 26 support, JSON.decode/3 used the vendored elixir_json module, whose default is fun erlang:binary_to_integer/1. It now calls OTP's :json.decode/3, which has the same default. The JSON.decode/3 documentation names &String.to_integer/1 as the default, which converts the same way.

2. Unbounded conversion

The decoder scans the digits of an integer literal and passes the whole run to the conversion. Nothing…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details