{"affected":[{"ranges":[{"events":[{"introduced":"84adefa331c4159d432d22840663c38f155cd4c1"},{"fixed":"e5a9d3d141b8b5609803c3b78c8b420cd294ca82"}],"repo":"https://github.com/erlang/otp","type":"GIT"}]}],"aliases":["GHSA-6qhv-446c-985v","CVE-2026-116293"],"credits":[{"name":"Sungho Park","type":"FINDER"},{"name":"Sungho Park","type":"REPORTER"},{"name":"Ingela Anderton Andin","type":"COORDINATOR"},{"name":"Jonatan Männchen / EEF","type":"COORDINATOR"},{"name":"Sverker Eriksson","type":"REMEDIATION_DEVELOPER"}],"database_specific":{"capec_ids":["CAPEC-100"],"cpe_ids":["cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"],"cwe_ids":["CWE-1284","CWE-787","CWE-125"]},"details":"## Summary\n\nOut-of-bounds Write vulnerability in the external term format decoder in Erlang OTP erts allows an attacker who controls the input to `binary_to_term/1,2` to abort the Erlang VM via a `NEWER_REFERENCE_EXT` term with a zero-length ID. `decoded_size` in `erts/emulator/beam/external.c` accepts a reference whose 16-bit `Len` field is zero, but `dec_term` always reads one ID word. `dec_term` then runs 4 bytes ahead of the position that `decoded_size` validated. It decodes the bytes that follow as terms that were never sized, and writes past the reserved process heap.\n\nThe abort takes down every process on the node. Supervision, `try`/`catch` and the `safe` option do not prevent it. `enif_binary_to_term()` and the distribution protocol reach the same decoder, and distribution is assumed to run on trusted networks only. `NEW_REFERENCE_EXT` also accepts a zero length, but its range check on the first ID word rejects the shifted input. On 32-bit builds, a zero-length reference of either type at the end of the input, followed by trailing bytes, can write one word past the reserved heap.\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 erts from 6.0 before 15.2.7.15, 16.4.0.8, and 17.1.2. Whether OTP before OTP 17.0, corresponding to erts before 6.0, is affected is unknown.\n\n## Details\n\n**1. Size pass.** `binary_to_term_int` first calls `decoded_size` to reserve the process heap. For `NEWER_REFERENCE_EXT`, `decoded_size` rejects an ID-word count above `ERTS_MAX_REF_NUMBERS` but not a count of zero. With `Len` 0 it skips the tag, the length, the node atom and the 4-byte creation, and no ID bytes.\n\n**2. Decode pass.** `dec_term` reads `Len`, the node atom and the creation, then reads the first ID word `r0` without checking `Len`. From here `dec_term` is 4 bytes ahead of the position `decoded_size` validated.\n\n**3. Heap overrun.** In the reported input, the reference is followed by a `BINARY_EXT`. `decoded_size` treats the binary payload as opaque bytes. The shifted `dec_term` consumes the binary tag and the top three length bytes as `r0`, reads the low length byte (105, `LARGE_TUPLE_EXT`) as the next tag, and builds a tuple from the payload. The tuple-build loop stores past the heap that was reserved for a reference and a binary.\n\n**4. Abort.** After `dec_term` returns, `binary_to_term_int` compares the heap pointer with the reserved end and calls `erts_exit` with `heap overrun`. That check runs after the out-of-bounds stores. Larger inputs can fault with SIGSEGV first.\n\n**`NEW_REFERENCE_EXT`.** Tag 114 also accepts `Len` 0, but `dec_term` rejects `r0 >= MAX_REFERENCE` for that tag. A shifted `r0` begins with a term tag byte, so the input fails with `badarg`.\n\n## Proof of concept\n\n1. Build a `NEWER_REFERENCE_EXT` (tag 90) with `Len` 0, the node atom `nonode@nohost` as `SMALL_ATOM_UTF8_EXT`, and a 4-byte creation for another node, for example 1.\n2. Build a `BINARY_EXT` (tag 109) whose payload starts with a 32-bit arity N, followed by N `SMALL_INTEGER_EXT` elements. Pad the payload so that the low byte of the 32-bit binary length is 105 (`LARGE_TUPLE_EXT`).\n3. Wrap both in a two-element `SMALL_TUPLE_EXT` after the version byte 131. With N = 40 the input is 391 bytes.\n4. Call `binary_to_term/1`, or `binary_to_term/2` with `[safe]`, on the input. The VM aborts with `heap overrun by 33 words(s)` instead of raising `badarg`.\n\n## Impact\n\nAn attacker who can supply bytes to `binary_to_term/1,2` or `enif_binary_to_term()` can abort the Erlang VM and stop every application on the node.\n\n## Workarounds\n\n* Do not call `binary_to_term/1,2` on data from untrusted sources. The OTP Secure Coding Guidelines (DSG-011) recommend avoiding these functions altogether on untrusted data.\n* If distribution is exposed to untrusted networks, configure it to use TLS with client certificate verification.\n* Use alternative serialization formats (JSON, Protocol Buffers) for untrusted external input.\nNote: the `[safe]` option to `binary_to_term/2` does NOT protect against this crash. It only restricts atom creation, not structural validation of binary encodings.","id":"EEF-CVE-2026-116293","modified":"2026-11-24T15:08:21.420425Z","published":"2026-11-24T15:08:20.708Z","references":[{"type":"ADVISORY","url":"https://github.com/erlang/otp/security/advisories/GHSA-6qhv-446c-985v"},{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-116293.html"},{"type":"WEB","url":"https://www.erlang.org/doc/system/versions.html#order-of-versions"},{"type":"FIX","url":"https://github.com/erlang/otp/commit/e5a9d3d141b8b5609803c3b78c8b420cd294ca82"}],"related":[],"schema_version":"1.8.0","severity":[{"score":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N","source":"CNA","type":"CVSS_V4"}],"summary":"binary_to_term Heap Overrun via NEWER_REFERENCE_EXT with Zero ID Words Aborts the VM","upstream":[]}