Write-up: Unauthenticated DoS in the Elixir JSON decoder via unbounded integer parsing (CVE-2026-115274)

Summary. Elixir's standard-library JSON module parses integer literals with no bound on their length, so a crafted number in a request body can force disproportionate work in the decoder. A new Phoenix application runs this decoder on request bodies before it routes or authenticates them, so an unauthenticated client can trigger the flaw to mount a denial of service against the server. It is tracked as CVE-2026-115274 and GHSA-rp5q-xqhq-926h (Moderate, CVSS 4.0 of 6.9, CWE-1284), and is fixed in Elixir 1.18.6, 1.19.7 and 1.20.5.

The attack at a glance nothing checks who is asking Attacker no account, no login Phoenix app decodes the body first [ 999...9 ] small body, long number what one request costs a normal request under a microsecond of CPU this attack, same endpoint about a second of a CPU core, millions of times more The body still fits the size limit, so nothing turns it away before the cost is paid
A small, unauthenticated JSON request carries one very long number into the app on the same endpoint a normal client uses. A normal number parses in under a microsecond, but this one costs about a second of a CPU core, millions of times more, while the body still fits inside the sizes a server accepts.

Background: Elixir and the BEAM

Elixir is a functional language built on the Erlang virtual machine, the BEAM. The BEAM was designed for telephone switches that must stay up and stay responsive under load, and it carries that design into every program that runs on it. Code runs inside lightweight processes, each with its own tiny heap, and a set of schedulers, normally one per CPU core, runs those processes. The scheduler does not wait for a process to cooperate. It gives each process a small budget of work, counted in units called reductions, and when the budget runs out it parks that process and picks up another. This preemption is what lets a single node juggle hundreds of thousands of processes and still answer every one of them quickly.

That model has one soft spot. The budget is spent by ordinary function calls, so a single operation that runs for a long time without being broken into reductions keeps the scheduler to itself until it finishes. Most built-in operations are small or know how to yield partway through. A few do a large amount of work in one call. The runtime even keeps a separate pool of dirty schedulers for long native work that is expected to block, but an operation that is not marked to use them, and does not yield on its own, simply runs to the end on a normal scheduler. When one of those runs on attacker-controlled input, the usual guarantee that every process gets a turn no longer holds for the processes that share that scheduler.

BEAM schedulers (one per core) budget: ~4000 reductions Scheduler 1 binary_to_integer running Scheduler 2 binary_to_integer( 1,000,000 digits ) processes waiting their turn Scheduler 3 binary_to_integer running held ~1s server stalls Each process gets a short budget, then yields, so thousands stay responsive One million-digit conversion runs as a single long step that does not yield Enough such requests tie up every scheduler and the node stops answering
The BEAM stays responsive by preempting each process after a small budget of work. A single long conversion that does not yield holds a scheduler until it finishes, and the processes sharing that scheduler wait.

JSON parsing in Elixir

For most of its life Elixir had no JSON parser in the standard library, and the community settled on an external one called Jason. From version 1.18 Elixir ships a built-in JSON module, and recent Phoenix generators wire it in as the default. Under the hood the module leans on the Erlang/OTP :json parser that OTP itself now provides.

A JSON parser has to turn each kind of literal into a runtime value. Strings become binaries, true and false become booleans, and a run of digits becomes an integer. Elixir lets you supply your own function for each of these, which is a clean design, but the interesting part is the default. For an integer the default converts the digit run with erlang:binary_to_integer/1, which the documentation also describes as String.to_integer/1. Both do the same thing. They take the whole run of digits and produce an exact integer, however long the run is.

This is where Jason and the new module part ways. Jason has a setting called decoding_integer_digit_limit, 1024 by default, and it refuses an integer literal longer than that before it tries to convert it. The built-in module, up to the patched releases, had no such limit.

Where the decoder sits in a request

A parser that is slow on hostile input is only a problem if hostile input can reach it. In a generated Phoenix application it can, and early. The generator sets config :phoenix, :json_library, JSON, and the endpoint hands that module to Plug.Parsers as the JSON decoder. Plug.Parsers sits near the front of the request pipeline, before the router matches a route and before any authentication plug runs, and it reads and decodes the body up to a default limit of 8 MB.

Attacker [external] Unauthenticated HTTPS POST JSON body, up to 8 MB 9999... Phoenix application (BEAM) Plug.Parsers [plug] JSON.decode Reads and decodes the body first runs first ~1s CPU, big bignums Phoenix.Router Matches the route Authentication Checks the session or token Controller Handles the request The body is decoded before the router and authentication ever run
A C4-style view of the request path. Plug.Parsers decodes the JSON body at the front of the pipeline, so the decoding cost is spent on behalf of an unauthenticated request, before routing or authentication could reject it.

The vulnerability: unbounded integer parsing

Put the two facts together. The decoder will convert an integer literal of any length, and an unauthenticated request can carry several megabytes of such a literal to the decoder before anything checks who is asking. The only question left is how expensive that conversion is, and the answer is what makes this more than a curiosity.

Why a long number is so expensive

A string of a million bytes is cheap to handle. The parser scans it once and keeps the bytes, which is linear work. An integer literal of a million digits is a different matter, because the decimal text has to be turned into a real number, and a number that large does not fit in a machine word. It becomes a bignum, an arbitrary-precision integer made of many machine-word limbs.

The straightforward way to build that number, and the one this implementation uses, walks the digits from left to right and keeps a running total, multiplying the total by ten and adding the next digit at each step. Early on the total is small and the multiply is cheap. As the total grows it spans more and more limbs, and multiplying a number that is already thousands of limbs wide by ten touches every one of those limbs. By the end almost every step is working on a number near its full width. The cheap early steps do not save you. Summed over all the digits, that work grows with the square of the digit count rather than in step with it. An asymptotically optimal base conversion, the divide-and-conquer method used by libraries such as GMP, is sub-quadratic, but Erlang's integer conversion uses the straightforward accumulation and so pays the full quadratic cost.

Building the number, one digit at a time total = total * 10 + digit 9 9 9 9 9 9 9 9 9 ... a million of them running total (machine-word limbs) more digits, wider total, costlier multiply cost of one step Work against number of digits digits work string: linear integer: quadratic 1,000,000 digits: 100 to 300x A string of the same length is scanned once. The integer is rebuilt digit by digit.
Converting a decimal run into a bignum multiplies a steadily widening total at every step, so the total work grows with the square of the digit count. At a million digits that is 100 to 300 times the cost of handling the same bytes as a string.

The advisory puts numbers on this. At a million digits the integer literal costs 100 to 300 times as much CPU as a string literal of the same length, and a single request body of a few megabytes ties up a core for roughly a second. Past about 1.29 million digits the conversion crosses an internal limit and raises SystemLimitError, which the decoder does not catch, so the cost is spent and then the request fails anyway.

Proof of concept

The whole attack fits in a handful of lines. The body is a JSON array of seven numbers, each a million nines, which comes to about 7 MB.

a 7 MB body of long integer literals
body = "[" <> Enum.map_join(1..7, ",", fn _ -> String.duplicate("9", 1_000_000) end) <> "]"
# about 7 MB

JSON.decode(body)
# {:ok, [...]} after about one second of CPU

# the same digits as a string are cheap, the integer is not
JSON.decode(String.duplicate("9", 1_000_000))
# 100 to 300 times slower than
JSON.decode("\"" <> String.duplicate("9", 1_000_000) <> "\"")

# past the internal limit it raises instead
JSON.decode(String.duplicate("9", 1_400_000))
# ** (SystemLimitError)

Impact

An unauthenticated client that sends a body with integer literals of about a million digits makes the server spend roughly a second of CPU per request and allocate large bignums along the way. Because Plug.Parsers runs before routing and authentication, there is no login to pass and no route to find.

To see what a second of CPU means here, compare it to a real request. An ordinary number, the kind a genuine client sends, has a handful of digits, fits in a single machine word, and is not a bignum at all, so it parses in a fraction of a microsecond. The crafted literal is about a million digits, and because the cost grows with the square of the length, converting it costs roughly a second, millions of times the work of a normal number, for a body that still fits inside the sizes a server normally accepts. The fix makes that same body cheap again. The decoder counts the digits and rejects anything past 310 of them before any conversion runs, so even a few megabytes of digits cost one linear pass of a couple of milliseconds rather than a second. Measured on a patched build, Elixir 1.20.5 on OTP 29, a normal integer decoded in about 0.2 microseconds and the million-digit body was turned away in about two milliseconds, while the one second belongs to the vulnerable path the advisory reports.

A steady stream of these requests keeps every scheduler busy and starves the processes that do real work, which is a denial of service against any application that decodes untrusted JSON with the default module, new Phoenix applications included. This does not take a flood. The BEAM runs one scheduler per core, and each request holds one scheduler for about a second, so the number a client must keep in flight is only about the server's core count, on the order of ten a second on a typical eight to sixteen core machine. That is a trickle, well under normal traffic and ordinary rate limits. Responsiveness for everyone else degrades for as long as the client keeps sending, and the server recovers on its own within about a second after the traffic stops, so the effect is lost availability while the attack runs rather than a crash. A deployment that caps the request body, sets a request timeout, or rate limits its unauthenticated endpoints narrows the window, and because the cost is quadratic in the digit count a tighter body limit helps out of proportion to its size.

One request pins one core for about a second CPU cores, one BEAM scheduler each about one request per core busies them all every core busy while the attack runs real traffic has to wait for a free core The cores free up within about a second after the attack stops. A request timeout, a smaller body limit, or rate limiting bound how long they stay busy. Each core answers many small requests and stays free About one crafted request per core pins them all for about a second Stop the attack and the cores drain back to idle within about a second
Each crafted request pins one core, one BEAM scheduler, for about a second, so only about as many requests as the node has cores are needed to busy them all and make real traffic wait. The effect lasts while the attack runs, and the cores free up within about a second after it stops. A request timeout, a smaller body limit, or rate limiting all bound it.

It is rated Moderate, CVSS 4.0 of 6.9 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N), classed as CWE-1284 and matching the Excessive Allocation pattern, CAPEC-130.

Unpatched [ "999...9" x7 ] about 7 MB CPU ~100% for ~1s per request Patched (1.18.6, 1.19.7, 1.20.5) digit count: over 310 rejected: {:integer_too_large, digits} CPU stays low The bound is checked before the conversion, so the expensive path is never entered
Before the fix, each request pins a scheduler for about a second. After the fix, the decoder counts the digits first and rejects any integer literal longer than 310 digits, so the quadratic conversion never runs.

The fix

The patched releases give the default integer decoder a limit. The JSON module now carries a constant, @max_integer_digits 310, and an integer literal with more digits than that is rejected with a new error, {:integer_too_large, digits}, before any conversion happens. The documentation notes that 310 digits is enough to cover every 64-bit float, so ordinary numbers are untouched while the pathological ones are turned away cheaply. A caller who genuinely needs very large integers can still pass a custom integer decoder and opt back in.

lib/elixir/lib/json.ex, patched releases (commit c81f122)
@max_integer_digits 310

# default integer decoder: &String.to_integer/1, except integers with more
# than 310 digits (enough to cover all 64-bit floats) are rejected with
# {:integer_too_large, digits}

Remediation

Upgrade to Elixir 1.18.6, 1.19.7 or 1.20.5 or later. If you cannot upgrade at once, wrap the decoder with an integer function that rejects long digit runs before conversion, and hand that to Plug.Parsers in place of the default.

workaround: a bounded integer decoder
defmodule SafeJSON do
  def decode!(binary) do
    case JSON.decode(binary, :ok, integer: &safe_integer/1) do
      {decoded, :ok, ""} -> decoded
      _ -> raise ArgumentError, "invalid JSON"
    end
  end

  defp safe_integer(digits) when byte_size(digits) <= 1024, do: String.to_integer(digits)
  defp safe_integer(_digits), do: raise(ArgumentError, "integer too long")
end

# in the endpoint, pass SafeJSON to Plug.Parsers as json_decoder

Either way, the usual outer defences still earn their keep. A smaller body limit on endpoints that take JSON, a request timeout, and rate limiting all reduce how much an attacker can ask the decoder to do, independently of this particular literal.

Disclosure and acknowledgements

This was a coordinated disclosure through the Erlang Ecosystem Foundation, which acts as the CVE Numbering Authority for the Erlang and Elixir ecosystem, and it is the best-run process I have taken part in. I reported the issue on 10 October 2026, and Eric Meadows-Jonsson responded and credited the report the same day, bringing Jonatan Maennchen in to coordinate the disclosure for the Foundation. The vulnerability was confirmed the next day. Peter Ullrich shared in finding the issue, and Jose Valim developed the remediation. Everyone involved was extremely friendly, fast, competent and transparent at every step. The patched releases for all three supported lines shipped on 29 October 2026, the GHSA was published the same day, and the CVE record followed on 30 October, with every role, version, commit and date set out in the open. Coordination of a CVE and GHSA publication of this quality is second to none, and it deserves to be held up as a model for the field. My sincere thanks to all of them.

Timeline

timeline
2026-10-10: reported privately, and Eric Meadows-Jonsson responded and credited the report the same day
2026-10-11: the maintainers confirmed the vulnerability
2026-10-29: fix released in Elixir 1.18.6, 1.19.7 and 1.20.5, and advisory GHSA-rp5q-xqhq-926h published
2026-10-30: CVE-2026-115274 published by the Erlang Ecosystem Foundation CNA
2026-11-12: this write-up published

References

The SVG illustrations in this write-up were produced with the help of Claude.