{"id":"EEF-CVE-2026-119443","summary":"XML Scan Untrusted DTD Which May Result in out of Memory Crash","details":"## Summary\n\nImproper Restriction of XML External Entity Reference vulnerability in `xmerl_scan` in Erlang OTP xmerl allows an attacker to exhaust the memory of the Erlang VM via an XML document that names an external DTD.\n\nWith default options, `xmerl_scan:string/1,2` and `xmerl_scan:file/1,2` fetch and parse the external DTD named in a `\u003c!DOCTYPE root SYSTEM \"...\"\u003e` declaration. `fetch_DTD/2` in `lib/xmerl/src/xmerl_scan.erl` passes every system identifier to the default fetch function, which maps `file:` and absolute URIs to local paths, and `int_file_decl/3` then reads the whole file with `file:read_file/1`. This happens whether or not validation is enabled, and the `allow_entities` option, which is `false` by default since OTP 27, only governs `\u003c!ENTITY\u003e` declarations and does not stop the fetch. A document naming `file:///dev/zero` makes the node read without bound until the operating system kills it for lack of memory, and the parse never returns.\n\nThis issue affects OTP from OTP 17.0 before OTP 27.3.4.20, OTP 28.5.0.9, and OTP 29.1.3, corresponding to xmerl from 1.3.7 before 2.1.3.4, 2.1.9.1, and 2.2.1. Whether OTP before OTP 17.0, corresponding to xmerl before 1.3.7, is affected is unknown.\n\n## Details\n\n**1. DOCTYPE handling.** `scan_doctype2/3` and `scan_doctype3/3` in `lib/xmerl/src/xmerl_scan.erl` call `fetch_DTD/2` once the `\u003c!DOCTYPE\u003e` declaration ends. `fetch_DTD/2` has no clause that skips the fetch when validation is off (that clause is commented out), so every system identifier reaches `fetch_and_parse/3`.\n\n**2. Default fetch.** `fetch_and_parse/3` calls the scanner's `fetch_fun`, which defaults to `fetch/2`. Its helper `fetch_URI/2` treats the identifier as a filename: a `file:` URI or an absolute path resolves to that local path, and a relative name resolves against `xmlbase`. Only `http:` identifiers are left unread.\n\n**3. Unbounded read.** The returned `{file, Path}` goes to `int_file_decl/3`, which calls `file:read_file/1` on the path and converts the result to a list. `file:read_file/1` reads until end of file, so a device such as `/dev/zero` never returns and the binary heap grows until the operating system kills the VM. The `allow_entities` default of `false` does not help: it only rejects `\u003c!ENTITY\u003e` declarations in `scan_markup_decl/2`, which runs after the file has been read.\n\n## Proof of concept\n\n1. Build an XML document whose DOCTYPE names an unbounded local resource, for example `\u003c?xml version=\"1.0\"?\u003e\u003c!DOCTYPE root SYSTEM \"file:///dev/zero\"\u003e\u003croot/\u003e`.\n2. Parse it with `xmerl_scan:string/1` with default options on a Unix host.\n3. The call never returns. The reporter observed binary memory reaching 8, 16, 32 and 64 GB within five seconds on OTP 29.1.2, after which the node was killed for lack of memory.\n\n## Impact\n\nAn attacker who can supply an XML document to an application that parses it with `xmerl_scan` using default options makes the node read an unbounded local resource such as `/dev/zero`. The read exhausts memory and takes the node down for every user of the application.\n\n## Workarounds\n\nPass a `fetch_fun` that refuses external resources in the option list of `xmerl_scan:string/2` or `xmerl_scan:file/2`, for example `{fetch_fun, fun(_ExtSpec, State) -\u003e {ok, not_fetched, State} end}`. The scanner then continues without reading or parsing the external DTD.","aliases":["GHSA-j6vp-frc3-9g33","CVE-2026-119443"],"modified":"2026-11-24T15:15:03.578105694Z","published":"2026-11-24T15:02:12.313Z","database_specific":{"cwe_ids":["CWE-611"],"capec_ids":["CAPEC-201"],"cpe_ids":["cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"]},"references":[{"type":"ADVISORY","url":"https://github.com/erlang/otp/security/advisories/GHSA-j6vp-frc3-9g33"},{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-119443.html"},{"type":"WEB","url":"https://www.erlang.org/doc/system/versions.html#order-of-versions"},{"type":"FIX","url":"https://github.com/erlang/otp/commit/4d5dc15b3ba923ad9d939c560749239289ba41f3"},{"type":"FIX","url":"https://github.com/erlang/otp/commit/6723ad37c5ea8febb59b05e95f8d1343f2c2fb7d"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/erlang/otp","events":[{"introduced":"84adefa331c4159d432d22840663c38f155cd4c1"},{"fixed":"4d5dc15b3ba923ad9d939c560749239289ba41f3"},{"fixed":"6723ad37c5ea8febb59b05e95f8d1343f2c2fb7d"}]}],"versions":["patch-base-27","OTP-27.3.4","OTP-29.1.2","OTP-29.1.1","OTP-29.0","OTP-29.1","OTP-27.0","OTP-29.0-rc3","OTP-28.0","OTP-29.0-rc2","OTP-29.0-rc1","OTP-27.3","OTP-27.3.3","OTP-26.0","OTP-25.0","OTP-28.0-rc4","OTP-27.3.2","OTP-28.0-rc3","OTP-27.2","OTP-28.0-rc2","OTP-27.3.1","OTP-28.0-rc1","OTP-27.1","OTP-27.0-rc3","OTP-27.0-rc2","OTP-27.0-rc1","OTP-24.0","OTP-26.0-rc3","OTP-26.0-rc2","OTP-26.0-rc1","OTP-23.0","OTP-21.0","OTP-25.0-rc3","OTP-25.0-rc2","OTP-25.0-rc1","OTP-22.0","OTP-24.0-rc3","OTP-24.0-rc2","OTP-24.0-rc1","OTP-23.0-rc3","OTP-23.0-rc2","OTP-23.0-rc1","OTP-20.0","OTP-22.0-rc3","OTP-22.0-rc2","OTP-22.0-rc1","OTP-19.0","OTP-21.0-rc2","OTP-18.0","OTP-21.0-rc1","OTP-17.0","OTP-20.0-rc2","OTP-20.0-rc1","OTP-19.0-rc2","OTP-19.0-rc1","OTP_R16B","OTP-18.0-rc1","OTP_17.0-rc2","OTP_17.0-rc1","OTP_R13B03","OTP_R16A_RELEASE_CANDIDATE","OTP_R14B03","OTP_R15B","OTP_R15A","OTP_R14B02","OTP_R14B01","OTP_R14B","OTP_R13B04","OTP_R14A"],"database_specific":{"source":"https://cna.erlef.org/osv/EEF-CVE-2026-119443.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V4","score":"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"}],"credits":[{"name":"Neil Berkman / Xuku LLC","type":"FINDER"},{"name":"Neil Berkman / Xuku LLC","type":"REPORTER"},{"name":"Ingela Andin","type":"COORDINATOR"},{"name":"Jonatan Männchen / EEF","type":"COORDINATOR"},{"name":"Lars Thorsén","type":"REMEDIATION_DEVELOPER"}]}