Unbounded allocation in decimal Decimal.round/3 driven by the places argument enables DoS
Severity and exploitation
KEV coverage does not rule out exploitation.
Assessment vector
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NAssessment vector
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NSeverity
medium6.9CVSS measures technical severity, not the likelihood of an attack.
Known exploitation
Not listed in the checked CISA KEV catalog
Absence from CISA KEV does not rule out attacks.
Public exploit
Not established by this record
Missing evidence does not mean no public exploit exists.
Remediation
Package fixes recorded
Fix versions are recorded for 1 of 1 mapped packages. Check each release branch and any separate product guidance.
What this means
The ericmj decimal library has a memory allocation vulnerability, where the Decimal.round/3 function can allocate excessive memory based on the 'places' argument, potentially leading to a Denial of Service. This issue affects versions from 0.1.0 before 3.1.2. An attacker with control over the number of decimal places can cause memory allocation in proportion to that number.
Summarized by @cf/meta/llama-3.3-70b-instruct-fp8-fast. Verify details against the original sources.Attack conditions
No attack-condition excerpt has been identified here. Review the full source description and references for authentication, network access, and configuration requirements.
Review supporting sources →Affected versions
Check the exact model, release, and any platform requirements against your installation.
ericmj · EEF
decimal
1 range
ericmj · EEF
decimal
Package identity
pkg:hex/decimalExplore decimal →Identity supplied by EEF. Version matching requires compatible range evidence.
Compare with this publisher’s ranges. This does not inspect your installation.
affected
0.1.0 → before 3.1.2
semver versions
Other versions: unaffected
Product identifiers (CPE)
cpe:2.3:a:ericmj:decimal:*:*:*:*:*:*:*:*ericmj · EEF
decimal
1 range
ericmj · EEF
decimal
Package identity
pkg:github/ericmj/decimalIdentity supplied by EEF. Version matching requires compatible range evidence.
Compare with this publisher’s ranges. This does not inspect your installation.
affected
05bb73eb40ddef24eda782d905766f56a3660522 → before *
git versions
From 338f42c8cf6a9749ab70c5af04734c6050ca3dc6: unaffected
From 3c90af4c3c2dfa4bb4c138760a326dd0eb91822b: unaffected
Source order retained; this version scheme requires manual review.
Other versions: unaffected
Product identifiers (CPE)
cpe:2.3:a:ericmj:decimal:*:*:*:*:*:*:*:*Packages
Compare each installed version with the publisher’s affected ranges. Where a fix is recorded, choose the appropriate release branch and test compatibility before upgrading.
| Affected range | Recorded fix |
|---|---|
| From 0.1.0 before 3.1.2Semantic versions | 3.1.2 |
Version evidence: OSV · EEF-CVE-2026-97853
View original version evidence (36 explicit versions)
Source version evidence
This source records affected versions without identifying a package ecosystem and name. This evidence is not used for package matching.
What to do
Compare your installed product and version with the affected versions above. A matching product name alone does not confirm exposure.
Use the recorded fix for your release branch. Review the publisher’s instructions and test compatibility before upgrading.
Bound places before calling Decimal.round/2,3, for example to -34..34 or to the scales the application supports.
cve.new guidance unless attributed to a publisher. This page does not inspect your installation.
Public exploit evidence
No public exploit reference is identified in the imported evidence. This is not a claim that no exploit exists.
Original source description
Read the full publisher description
Summary
Memory Allocation with Excessive Size Value vulnerability in ericmj decimal allows Denial of Service.
Decimal.round/3 builds the full result for the requested number of decimal places before the context precision (34 digits by default) is applied, so its cost grows with the places argument instead of with the size of the result. For positive places it appends places zero digits to the coefficient as a charlist before converting it to an integer, and for negative places it builds a charlist of -places zero digits. A single call such as Decimal.round(Decimal.new("1.5"), -50_000_000) allocates about 5.5 GB of memory, which can exhaust available memory and get the BEAM VM killed. The oldest releases instead loop once per decimal place, consuming CPU in proportion to places.
Any application that passes a user-supplied number of decimal places or scale to Decimal.round/2 or Decimal.round/3 without bounding it is exposed. The input limits added for CVE-2026-32686 do not cover the places argument.
This issue affects decimal: from 0.1.0 before 3.1.2.
Details
Decimal.round/3 sets the target exponent to -places and do_round/5 materializes the coefficient at that exponent; context/2 only applies the precision afterwards.
- Positive
places(introduced in 1.3.0 by commit 7a83d27):digits ++ Enum.map(1..(exp - target_exp), fn _ -> ?0 end)followed by:erlang.list_to_integer/1(lib/decimal.ex:2409in 3.1.1). The list is built beforelist_to_integer/1raisesSystemLimitErrorfor results over about 1.26 million digits, the BEAM integer size limit. - Negative
places(since 1.4.0)::lists.duplicate(target_exp - exp, ?0) ++ digits(lib/decimal.ex:2385-2386in 3.1.1). - Releases from 0.1.0 before 1.1.0:
do_round(and in 1.0.1split_coef) recurses once per decimal place for negativeplaces; 1.0.1 also multiplies a power of ten by 10 on every iteration. Established by reading the code; these releases do not compile on current Elixir.
Measured on OTP 29 with 3.1.1, one call per fresh VM:
| Call | Time | Peak VM memory |
|---|---|---|
Decimal.round(Decimal.new("1.5"), -10_000_000) |
0.25 s | 0.8 GB |
Decimal.round(Decimal.new("1.5"), -50_000_000) |
1.2 s | 5.5 GB |
Decimal.round(Decimal.new("1.5"), 50_000_000) |
2.1 s, then SystemLimitError |
2.4 GB |
In an elixir:1.20.4 container started with --memory=2g, either of the last two calls got the VM killed (exit status 137). Over HTTP (Plug and Bandit) a 34-byte JSON body carrying places: -50_000_000 returned after 1.25 s with server memory at 4.3 GB.
Proof of concept
Mix.install([{:decimal, "3.1.1"}])
# Allocates about 5.5 GB.
Decimal.round(Decimal.new("1.5"), -50_000_000)
# Builds a 50 million element list, then raises SystemLimitError.
Decimal.round(Decimal.new("1.5"), 50_000_000)
Impact
An attacker who controls the number of decimal places an application rounds to makes one Decimal.round/2,3 call allocate memory in proportion to that number. A value of 50 million needs about 5.5 GB, enough to get the BEAM VM killed on hosts with less memory and take down every request it serves.
Workarounds
Bound places before calling Decimal.round/2,3, for example to -34..34 or to the scales the application supports.
References
7 sourcesView 1 more references
Inside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-97853View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
Environment requirements
These conditions apply together as specified by the publisher. A matching product name alone does not establish exposure.
EEF · platform conditions
All conditions must hold
Any condition may hold
Vulnerable product
cpe:2.3:a:ericmj:decimal:*:*:*:*:*:*:*:*From (inclusive): 0.1.0
Before: 3.1.2
Applicability preview
[
{
"nodes": [
{
"cpeMatch": [
{
"criteria": "cpe:2.3:a:ericmj:decimal:*:*:*:*:*:*:*:*",
"versionEndExcluding": "3.1.2",
"versionStartIncluding": "0.1.0",
"vulnerable": true
}
],
"negate": false,
"operator": "OR"
}
],
"operator": "AND"
}
]Contributing organizations · 2
Assigning organization
Additional data publisher
Timeline
All times UTCAdvisory published
Publication date supplied by the source.
Source updated
Latest modification date supplied by the source.
Last imported by cve.new
Latest catalog import, not the date we first saw this advisory.
What changed
Follow changesLarge field values are marked as truncated previews. Original source snapshots remain retained.