Am I affected?

type your mdex version to check

Description

Allocation of Resources Without Limits or Throttling vulnerability in leandrocp MDEx allows Excessive Allocation.

MDEx.parse_document/2 accepts a {:json, json} source. In lib/mdex.ex, the private json_to_node/1 function passes the attacker-controlled node_type value to Module.concat/1, which calls String.to_atom/1 and interns a brand-new atom for every distinct value. Atoms are never garbage collected on the BEAM, so a crafted JSON document carrying a unique node_type at each (deeply nested) node mints one permanent atom per node.

A single document can intern hundreds of thousands of atoms, and a large enough document exhausts the default atom table (around 1,048,576 atoms) and aborts the entire Erlang VM, taking down every process on the node. Any application that passes untrusted input to the {:json, ...} source of MDEx.parse_document is exposed to an unauthenticated denial-of-service.

This issue affects mdex from 0.4.3 before 0.13.2.

Weaknesses & attack patterns

Weakness

CWE-770 · Allocation of Resources Without Limits or Throttling in catalog → MITRE ↗

Attack patterns

CAPEC-130 · Excessive Allocation MITRE ↗

Affected — Hex / mdex Hex.pm ↗ Repository ↗

0.4.3 < 0.13.2 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.MDEx'
source files lib/mdex.ex
routines 'Elixir.MDEx':parse_document/2 · 'Elixir.MDEx':json_to_node/1

Affected — GitHub / leandrocp/mdex Repository ↗

cbb59a3 < 00fddf4 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:leandrocp:mdex:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.MDEx'
source files lib/mdex.ex
routines 'Elixir.MDEx':parse_document/2 · 'Elixir.MDEx':json_to_node/1

Workarounds

Do not pass untrusted or attacker-controlled input to the {:json, ...} source of MDEx.parse_document/2. The {:markdown, ...} source is not affected.

References

Credits

Peter Ullrich Finder
Leandro Pereira Remediation developer
Jonatan Männchen / EEF Analyst

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:H
« All CVEs