EEF-CVE-2026-140436

Source
https://cna.erlef.org/osv/EEF-CVE-2026-140436.html
Import Source
https://cna.erlef.org/osv/EEF-CVE-2026-140436.json
JSON Data
https://api.osv.dev/v1/vulns/EEF-CVE-2026-140436
Aliases
  • GHSA-598v-rvxm-fcp8
  • CVE-2026-140436
Published
2026-12-04T06:31:06Z
Modified
2026-12-04T06:45:03Z
Severity
  • 6.9 (Medium) CVSS_V4 - 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 (Source: CNA) CVSS Calculator
Summary
yaml_elixir: exponential alias expansion in YamlElixir.Mapper allows memory exhaustion
Details

Summary

Improper Restriction of Recursive Entity References vulnerability in YamlElixir.Mapper in KamilLelonek yaml_elixir allows an attacker to exhaust the memory of the BEAM node via a YAML document with nested anchors and aliases.

yamerl resolves each alias to the term of its anchor, so the parsed document stays as small as the input. YamlElixir.Mapper.process/2 in lib/yaml_elixir/mapper.ex walks that document as a tree and builds a new copy of the anchored node for every alias. With nested anchors, the size of the result grows exponentially with the nesting depth. All YamlElixir.read_* functions are affected with their default options.

This issue affects yaml_elixir: from 0.0.1 before 2.13.0.

Details

1. Parsing. YamlElixir.read_from_string/2 and the other read functions call :yamerl_constr.string/2 or :yamerl_constr.file/2. For each alias, yamerl returns the same node term as for the anchor, so its result is about as small as the input.

2. Conversion. YamlElixir.Mapper.process/2 passes the document to _to_map/2 in lib/yaml_elixir/mapper.ex. _to_map/2 recurses into each sequence and mapping and builds a new list or map for each node that it visits. It keeps no record of converted nodes, so it converts an anchored node once per alias.

3. Growth. When each anchored node holds several aliases of the previous anchored node, the number of built nodes is multiplied at each level. The merge_anchors: true option walks the converted result one more time.

4. Measurement. The test document has one anchored sequence of 9 strings and, per level, one anchored sequence of 9 aliases of the previous level. On 2.12.2, a 560-byte document (6 levels) exceeded a process heap limit of 256 MiB, and a 720-byte document (8 levels) exceeded a limit of 1 GiB. On 2.13.0, both documents gave a YamlElixir.ParsingError of type :max_nodes_exceeded with 21 MiB of process memory. The fix counts each node that _to_map/2 builds and stops at the :max_nodes limit. The default limit is 1,000,000 nodes or the input size in bytes, whichever is larger.

Proof of concept

  1. Build a YAML document with the key l0, whose value has the anchor &l0 and is a sequence of 9 strings.
  2. Add the keys l1 to l8. The value of l<i> has the anchor &l<i> and is a sequence of 9 aliases *l<i-1>. The document has 720 bytes.
  3. Call YamlElixir.read_from_string/1 with the document in a process whose max_heap_size is 1 GiB with kill: true.
  4. On 2.12.2 the runtime kills the process at the heap limit. On 2.13.0 the call returns {:error, %YamlElixir.ParsingError{type: :max_nodes_exceeded}}.

Impact

An attacker who can make an application parse a YAML document of their choice can exhaust the memory of the parsing process. A BEAM process has no heap limit by default, so the node can run out of memory and stop, which ends every application on it.

Workarounds

Parse untrusted YAML in a separate process that has a max_heap_size limit with kill: true, set with Process.flag/2. The runtime then stops only that process when the conversion exceeds the limit.

Database specific
{
    "$schema":  "https://cna.erlef.org/schemas/osv/record-0.1.0.json",
    "capec_ids":  [
        "CAPEC-197"
    ],
    "cpe_ids":  [
        "cpe:2.3:a:kamillelonek:yaml_elixir:*:*:*:*:*:*:*:*"
    ],
    "cwe_ids":  [
        "CWE-776"
    ]
}
References
Credits
    • Marc Nickert / intcube GmbH - FINDER
    • Marc Nickert / intcube GmbH - REPORTER
    • Jonatan Männchen / EEF - COORDINATOR
    • Marc Nickert / intcube GmbH - COORDINATOR
    • Kamil Lelonek - REMEDIATION_DEVELOPER

Affected packages

Hex / yaml_elixir

Package

Name
yaml_elixir
Purl
pkg:hex/yaml_elixir

Affected ranges

Type
SEMVER
Events
Introduced
0.0.1
Fixed
2.13.0

Affected versions

0.*
0.0.1
1.*
1.0.0
1.1.0
1.2.0
1.2.1
1.2.2
1.3.0
1.3.1
1.3.2
1.4.0
2.*
2.0.0
2.0.1
2.0.2
2.1.0
2.2.0
2.3.0
2.4.0
2.5.0
2.6.0
2.7.0
2.8.0
2.9.0
2.10.0
2.11.0
2.12.0
2.12.1
2.12.2

Ecosystem specific

{
    "$schema":  "https://cna.erlef.org/schemas/osv/affected-0.1.0.json",
    "modules":  [
        "'Elixir.YamlElixir.Mapper'",
        "'Elixir.YamlElixir'"
    ],
    "program_files":  [
        "lib/yaml_elixir/mapper.ex",
        "lib/yaml_elixir.ex"
    ],
    "program_routines":  [
        "'Elixir.YamlElixir.Mapper':process/1",
        "'Elixir.YamlElixir.Mapper':process/2",
        "'Elixir.YamlElixir.Mapper':'_to_map'/1",
        "'Elixir.YamlElixir.Mapper':'_to_map'/2",
        "'Elixir.YamlElixir':read_from_string/1",
        "'Elixir.YamlElixir':read_from_string/2",
        "'Elixir.YamlElixir':read_from_file/1",
        "'Elixir.YamlElixir':read_from_file/2",
        "'Elixir.YamlElixir':read_all_from_string/1",
        "'Elixir.YamlElixir':read_all_from_string/2",
        "'Elixir.YamlElixir':read_all_from_file/1",
        "'Elixir.YamlElixir':read_all_from_file/2",
        "'Elixir.YamlElixir':'read_from_string!'/1",
        "'Elixir.YamlElixir':'read_from_string!'/2",
        "'Elixir.YamlElixir':'read_from_file!'/1",
        "'Elixir.YamlElixir':'read_from_file!'/2",
        "'Elixir.YamlElixir':'read_all_from_string!'/1",
        "'Elixir.YamlElixir':'read_all_from_string!'/2",
        "'Elixir.YamlElixir':'read_all_from_file!'/1",
        "'Elixir.YamlElixir':'read_all_from_file!'/2"
    ]
}

Database specific

$schema
"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"
modules
[
    "'Elixir.YamlElixir.Mapper'",
    "'Elixir.YamlElixir'"
]
program_files
[
    "lib/yaml_elixir/mapper.ex",
    "lib/yaml_elixir.ex"
]
program_routines
[
    "'Elixir.YamlElixir.Mapper':process/1",
    "'Elixir.YamlElixir.Mapper':process/2",
    "'Elixir.YamlElixir.Mapper':'_to_map'/1",
    "'Elixir.YamlElixir.Mapper':'_to_map'/2",
    "'Elixir.YamlElixir':read_from_string/1",
    "'Elixir.YamlElixir':read_from_string/2",
    "'Elixir.YamlElixir':read_from_file/1",
    "'Elixir.YamlElixir':read_from_file/2",
    "'Elixir.YamlElixir':read_all_from_string/1",
    "'Elixir.YamlElixir':read_all_from_string/2",
    "'Elixir.YamlElixir':read_all_from_file/1",
    "'Elixir.YamlElixir':read_all_from_file/2",
    "'Elixir.YamlElixir':'read_from_string!'/1",
    "'Elixir.YamlElixir':'read_from_string!'/2",
    "'Elixir.YamlElixir':'read_from_file!'/1",
    "'Elixir.YamlElixir':'read_from_file!'/2",
    "'Elixir.YamlElixir':'read_all_from_string!'/1",
    "'Elixir.YamlElixir':'read_all_from_string!'/2",
    "'Elixir.YamlElixir':'read_all_from_file!'/1",
    "'Elixir.YamlElixir':'read_all_from_file!'/2"
]
source
"https://cna.erlef.org/osv/EEF-CVE-2026-140436.json"

Git / github.com/KamilLelonek/yaml-elixir

Affected ranges

Type
GIT
Repo
https://github.com/KamilLelonek/yaml-elixir
Events

Affected versions

v1.*
v1.1
v1.1.0
v1.2.0
v1.2.2
v1.3.0
v1.3.1
v1.4.0
v2.*
v2.0.0
v2.0.1
v2.1.0
v2.12.0
v2.12.2
v2.4.0
v2.7.0
v2.8.0

Database specific

$schema
"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"
modules
[
    "'Elixir.YamlElixir.Mapper'",
    "'Elixir.YamlElixir'"
]
program_files
[
    "lib/yaml_elixir/mapper.ex",
    "lib/yaml_elixir.ex"
]
program_routines
[
    "'Elixir.YamlElixir.Mapper':process/1",
    "'Elixir.YamlElixir.Mapper':process/2",
    "'Elixir.YamlElixir.Mapper':'_to_map'/1",
    "'Elixir.YamlElixir.Mapper':'_to_map'/2",
    "'Elixir.YamlElixir':read_from_string/1",
    "'Elixir.YamlElixir':read_from_string/2",
    "'Elixir.YamlElixir':read_from_file/1",
    "'Elixir.YamlElixir':read_from_file/2",
    "'Elixir.YamlElixir':read_all_from_string/1",
    "'Elixir.YamlElixir':read_all_from_string/2",
    "'Elixir.YamlElixir':read_all_from_file/1",
    "'Elixir.YamlElixir':read_all_from_file/2",
    "'Elixir.YamlElixir':'read_from_string!'/1",
    "'Elixir.YamlElixir':'read_from_string!'/2",
    "'Elixir.YamlElixir':'read_from_file!'/1",
    "'Elixir.YamlElixir':'read_from_file!'/2",
    "'Elixir.YamlElixir':'read_all_from_string!'/1",
    "'Elixir.YamlElixir':'read_all_from_string!'/2",
    "'Elixir.YamlElixir':'read_all_from_file!'/1",
    "'Elixir.YamlElixir':'read_all_from_file!'/2"
]
source
"https://cna.erlef.org/osv/EEF-CVE-2026-140436.json"