{"id":"CVE-2026-140436","aliases":["EEF-CVE-2026-140436","EUVD-2026-144051","GHSA-598v-rvxm-fcp8","GHSA-9p7h-7wgp-w94m"],"status":"published","title":"yaml_elixir: exponential alias expansion in YamlElixir.Mapper allows memory exhaustion","description":"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.\n\nyamerl 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.\n\nThis issue affects yaml_elixir: from 0.0.1 before 2.13.0.","severity":{"version":"4.0","score":6.9,"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:N","level":"medium","assessor":"cna","from":"cve","others":[{"version":"4.0","score":6.9,"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:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","from":"ghsa"}]},"epss":{"day":"2026-12-04","score":0.00249,"percentile":0.17299,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-776"],"published":"2026-12-04T06:31:06Z","modified":"2026-12-04T21:00:29Z","fixes":[{"ecosystem":"Hex","package":"yaml_elixir","fixed_in":["2.13.0"],"sources":["osv"]}],"affected":[{"source":"osv","ecosystem":"Hex","package":"yaml_elixir","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.1"},{"fixed":"2.13.0"}]}],"versions":["0.0.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.0.0","2.0.1","2.0.2","2.1.0","2.10.0","2.11.0","2.12.0","2.12.1","2.12.2","2.2.0","2.3.0","2.4.0","2.5.0","2.6.0","2.7.0","2.8.0","2.9.0"]}],"products":[{"vendor":"kamillelonek","product":"yaml_elixir"}],"references":[{"url":"https://github.com/KamilLelonek/yaml-elixir/security/advisories/GHSA-598v-rvxm-fcp8","tags":["vendor-advisory","related","advisory"]},{"url":"https://cna.erlef.org/cves/CVE-2026-140436.html","tags":["related","web"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-140436","tags":["related","web"]},{"url":"https://github.com/KamilLelonek/yaml-elixir/commit/dd8e152738f2396c16bf537267fe0f4ce66cada4","tags":["related","fix","web"]},{"url":"https://github.com/KamilLelonek/yaml-elixir/commit/add27450860201caf63ea445a1e6f00ce8267250","tags":["patch","fix"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-140436","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-9p7h-7wgp-w94m"},{"url":"https://github.com","tags":["web"]},{"url":"https://repo.hex.pm","tags":["web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/140xxx/CVE-2026-140436.json","tags":["advisory"]},{"url":"https://github.com/KamilLelonek/yaml-elixir","tags":["package"]},{"url":"https://hex.pm/packages/yaml_elixir","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-140436","title":"yaml_elixir: exponential alias expansion in YamlElixir.Mapper allows memory exhaustion","description":"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.\n\nyamerl 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.\n\nThis issue affects yaml_elixir: from 0.0.1 before 2.13.0.","status":"published","published":"2026-12-04T06:31:06.132Z","modified":"2026-12-04T06:31:06.132Z","cvss":[{"version":"4.0","score":6.9,"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:N","level":"medium","assessor":"cna"}],"cwes":["CWE-776"],"updated_at":"2026-12-04T06:42:55.437752Z"}],"euvd":[{"id":"EUVD-2026-144051","description":"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.\n\nyamerl 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.\n\nThis issue affects yaml_elixir: from 0.0.1 before 2.13.0.","status":"published","published":"2026-12-04T06:31:06Z","modified":"2026-12-04T06:31:06Z","cvss":[{"version":"4.0","score":6.9,"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:N","level":"medium"}],"updated_at":"2026-12-04T12:40:09.707689Z"}],"ghsa":[{"id":"GHSA-9p7h-7wgp-w94m","title":"Improper Restriction of Recursive Entity References vulnerability in YamlElixir.Mapper in...","description":"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.\n\nyamerl 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.\n\nThis issue affects yaml_elixir: from 0.0.1 before 2.13.0.","status":"published","published":"2026-12-04T09:30:23Z","modified":"2026-12-04T09:30:32Z","cvss":[{"version":"4.0","score":6.9,"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:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium"}],"cwes":["CWE-776"],"updated_at":"2026-12-04T09:55:06.306777Z"}],"nvd":[{"id":"CVE-2026-140436","description":"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.\n\nyamerl 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.\n\nThis issue affects yaml_elixir: from 0.0.1 before 2.13.0.","status":"published","published":"2026-12-04T07:17:29.707Z","modified":"2026-12-04T07:17:29.707Z","cvss":[{"version":"4.0","score":6.9,"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:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","assessor":"secondary"}],"cwes":["CWE-776"],"updated_at":"2026-12-04T07:20:42.357996Z"}],"osv":[{"id":"CVE-2026-140436","title":"yaml_elixir: exponential alias expansion in YamlElixir.Mapper allows memory exhaustion","description":"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.\n\nyamerl 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.\n\nThis issue affects yaml_elixir: from 0.0.1 before 2.13.0.","status":"published","published":"2026-12-04T06:31:06.132Z","modified":"2026-12-04T21:00:29.242262806Z","cvss":[{"version":"4.0","score":6.9,"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:N","level":"medium"}],"cwes":["CWE-776"],"updated_at":"2026-12-04T21:29:56.830115Z"},{"id":"EEF-CVE-2026-140436","title":"yaml_elixir: exponential alias expansion in YamlElixir.Mapper allows memory exhaustion","description":"## Summary\n\nImproper 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.\n\nyamerl 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.\n\nThis issue affects yaml_elixir: from 0.0.1 before 2.13.0.\n\n## Details\n\n**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.\n\n**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.\n\n**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.\n\n**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.\n\n## Proof of concept\n\n1. Build a YAML document with the key `l0`, whose value has the anchor `\u0026l0` and is a sequence of 9 strings.\n2. Add the keys `l1` to `l8`. The value of `l\u003ci\u003e` has the anchor `\u0026l\u003ci\u003e` and is a sequence of 9 aliases `*l\u003ci-1\u003e`. The document has 720 bytes.\n3. Call `YamlElixir.read_from_string/1` with the document in a process whose `max_heap_size` is 1 GiB with `kill: true`.\n4. 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}}`.\n\n## Impact\n\nAn 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.\n\n## Workarounds\n\nParse 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.","status":"published","published":"2026-12-04T06:31:06.132Z","modified":"2026-12-04T06:45:03.139495536Z","cvss":[{"version":"4.0","score":6.9,"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:N","level":"medium"}],"cwes":["CWE-776"],"updated_at":"2026-12-04T07:00:28.978326Z"}]}}
