Skip to main content
Vulnerability Database/CVE-2026-97853

CVE-2026-97853: Decimal Library DOS Vulnerability

CVE-2026-97853 is a denial of service vulnerability in the ericmj decimal library caused by excessive memory allocation. Attackers can exploit unbounded decimal places arguments to exhaust system memory. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-97853 Overview

CVE-2026-97853 is a memory allocation flaw in the ericmj/decimal library for Elixir and Erlang. The Decimal.round/3 function builds the full intermediate result for the requested number of decimal places before applying the context precision, which defaults to 34 digits. The cost scales with the places argument rather than the size of the final result. A single call such as Decimal.round(Decimal.new("1.5"), -50_000_000) allocates approximately 5.5 GB of memory and can exhaust the host, terminating the BEAM virtual machine. The weakness is classified as [CWE-789] Memory Allocation with Excessive Size Value.

Critical Impact

Applications that pass user-supplied scale or decimal places to Decimal.round/2 or Decimal.round/3 without bounds can be forced to allocate multi-gigabyte memory and crash the BEAM VM.

Affected Products

  • ericmj/decimal library versions 0.1.0 through 3.1.1
  • Elixir and Erlang applications depending on vulnerable decimal releases
  • BEAM VM processes hosting applications that expose Decimal.round/2 or Decimal.round/3 to untrusted input

Discovery Timeline

  • 2026-10-10 - CVE-2026-97853 published to NVD
  • 2026-10-15 - Last updated in NVD database

Technical Details for CVE-2026-97853

Vulnerability Analysis

The Decimal.round/3 function in ericmj/decimal performs rounding by first constructing the full coefficient at the requested scale, then applying the configured context precision. For positive places, the implementation appends places zero digits to the coefficient as a charlist before converting it to an integer. For negative places, it builds a charlist of -places zero digits. Both paths allocate memory proportional to the places argument, not to the digits actually required for the final result.

An attacker who controls the places argument can force the library to allocate charlists and integers large enough to exhaust system memory. On older releases, the implementation instead looped once per decimal place, consuming CPU time proportional to places rather than memory. The input limits introduced for CVE-2026-32686 do not apply to the places argument, leaving this path unbounded.

Root Cause

The root cause is unbounded intermediate allocation inside do_round. The function used the requested target_exp to size the working digit list before the context precision clamped the result. The precision cap of 34 digits was only applied after construction, so allocations grew linearly with the attacker-controlled scale.

Attack Vector

Exploitation requires an application that forwards an untrusted integer to Decimal.round/2 or Decimal.round/3 as the number of decimal places or scale. Any API endpoint, form field, or configuration input accepting a scale value and passing it unchecked to the library is a candidate. The attack is local in CVSS terms but can be triggered through any interface that eventually reaches the vulnerable function.

text
# Patch excerpt - lib/decimal.ex
# Bound round/3 work by the precision instead of places

     %Decimal{sign: sign, coef: coef, exp: exp} = normalize(num)
     digits = :erlang.integer_to_list(coef)
     target_exp = -n
-    value = do_round(sign, digits, exp, target_exp, mode)
+    value = do_round(sign, digits, exp, target_exp, mode, Context.get().precision)
     context(value, [])
   end

Source: GitHub commit 338f42c8. The fix passes the context precision into do_round so the working set is bounded by precision rather than by the attacker-supplied places.

Detection Methods for CVE-2026-97853

Indicators of Compromise

  • Sudden BEAM VM termination with out-of-memory signals from the operating system or supervisor.
  • Resident set size spikes to multiple gigabytes within seconds of a specific request reaching an endpoint that performs decimal rounding.
  • Repeated crashes correlated with HTTP or RPC payloads containing large negative or positive integers used as scale or precision parameters.

Detection Strategies

  • Audit application code for calls to Decimal.round/2 and Decimal.round/3 where the places argument originates from external input.
  • Inspect dependency manifests (mix.exs, mix.lock) for decimal versions earlier than 3.1.2.
  • Instrument request logging to capture scale, precision, or places parameters and alert on values exceeding reasonable business thresholds.

Monitoring Recommendations

  • Monitor BEAM process memory with Erlang :observer, :recon, or Prometheus exporters and alert on rapid growth above baseline.
  • Track OS-level OOM-killer events and correlate them with application request logs.
  • Enable OCSF-normalized telemetry ingestion so VM crashes and resource exhaustion signals can be queried alongside application logs.

How to Mitigate CVE-2026-97853

Immediate Actions Required

  • Upgrade ericmj/decimal to version 3.1.2 or later across all Elixir and Erlang projects.
  • Rebuild and redeploy any release that statically embeds the library.
  • Validate that user-supplied scale, precision, and places values are bounded before being passed to decimal operations.

Patch Information

The maintainers fixed the issue in decimal3.1.2. The relevant commits are 05bb73eb, 338f42c8, and 3c90af4c. See the GitHub Security Advisory GHSA-6c27-994x-c52f and the Erlang Ecosystem Foundation CNA advisory for complete details.

Workarounds

  • Reject or clamp the places argument to a conservative range (for example, between -34 and 34) before invoking Decimal.round.
  • Wrap decimal rounding operations in a dedicated process with a memory limit so a single crash cannot take down the entire node.
  • Apply schema validation at API boundaries to prevent large integers from reaching numeric formatting code paths.
bash
# Update the dependency in mix.exs and refresh the lockfile
# {:decimal, "~> 3.1.2"}
mix deps.update decimal
mix deps.get
mix compile --force

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.