Am I affected?

type your decimal version to check

Description

Uncontrolled Resource Consumption vulnerability in ericmj decimal allows unauthenticated remote Denial of Service.

The decimal library does not bound the exponent on parsed input. Storing a decimal with a very large exponent (e.g. Decimal.new("1e1000000000")) is accepted without error. Subsequent calls to arithmetic functions (Decimal.add/2, Decimal.sub/2, Decimal.div/2), Decimal.to_string/2 with :normal or :xsd format, Decimal.to_integer/1, Decimal.round/3, or Decimal.compare/3 with a threshold allocate memory proportional to the exponent value, which can exhaust available memory and crash the BEAM VM.

Any application that accepts user-supplied decimal input and subsequently performs arithmetic, rounding, conversion to integer, or string formatting on it is exposed. A single malicious request is sufficient to cause an out-of-memory crash.

This issue affects decimal: from 0.1.0 before 3.0.0.

Weaknesses & attack patterns

Weakness

CWE-400 · Uncontrolled Resource Consumption in catalog → MITRE ↗

Attack patterns

CAPEC-130 · Excessive Allocation MITRE ↗

Affected — Hex / decimal Hex.pm ↗ Repository ↗

0.1.0 < 3.0.0 affected
every other version: affected
default status affected
cpe cpe:2.3:a:ericmj:decimal:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Decimal'
source files lib/decimal.ex
routines 'Elixir.Decimal':new/1 · 'Elixir.Decimal':parse/1 · 'Elixir.Decimal':cast/1 · 'Elixir.Decimal':add/2 · 'Elixir.Decimal':sub/2 · 'Elixir.Decimal':div/2 · 'Elixir.Decimal':to_string/2 · 'Elixir.Decimal':to_integer/1 · 'Elixir.Decimal':round/3 · 'Elixir.Decimal':compare/3

Affected — GitHub / ericmj/decimal Repository ↗

bc11f4a < 6a523f3 affected
every other version: affected
default status affected
cpe cpe:2.3:a:ericmj:decimal:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Decimal'
source files lib/decimal.ex
routines 'Elixir.Decimal':new/1 · 'Elixir.Decimal':parse/1 · 'Elixir.Decimal':cast/1 · 'Elixir.Decimal':add/2 · 'Elixir.Decimal':sub/2 · 'Elixir.Decimal':div/2 · 'Elixir.Decimal':to_string/2 · 'Elixir.Decimal':to_integer/1 · 'Elixir.Decimal':round/3 · 'Elixir.Decimal':compare/3

References

Credits

Peter Ullrich Finder
Eric Meadows-Jönsson / Hex.pm Remediation developer
José Valim Remediation reviewer
Wojtek Mach Remediation reviewer
Jonatan Männchen / EEF Analyst
ruslandoga Remediation reviewer
Matthew Johnston Remediation reviewer

CVSS breakdown

CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
« All CVEs