CVE-2026-116293: binary_to_term Heap Overrun via NEWER_REFERENCE_EXT with Zero ID Words Aborts the VM

Published Nov 24, 2026
·
Updated

Summary

Out-of-bounds Write vulnerability in the external term format decoder in Erlang OTP erts allows an attacker who controls the input to binarytoterm/1,2 to abort the Erlang VM via a NEWERREFERENCEEXT term with a zero-length ID. decodedsize in erts/emulator/beam/external.c accepts a reference whose 16-bit Len field is zero, but decterm always reads one ID word. decterm then runs 4 bytes ahead of the position that decodedsize validated. It decodes the bytes that follow as terms that were never sized, and writes past the reserved process heap.

The abort takes down every process on the node. Supervision, try/catch and the safe option do not prevent it. enifbinarytoterm() and the distribution protocol reach the same decoder, and distribution is assumed to run on trusted networks only. NEWREFERENCEEXT 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.

This 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.

Details

1. Size pass. binarytotermint first calls decodedsize to reserve the process heap. For NEWERREFERENCEEXT, decodedsize rejects an ID-word count above ERTSMAXREFNUMBERS 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.

2. Decode pass. decterm reads Len, the node atom and the creation, then reads the first ID word r0 without checking Len. From here decterm is 4 bytes ahead of the position decodedsize validated.

3. Heap overrun. In the reported input, the reference is followed by a BINARYEXT. decodedsize treats the binary payload as opaque bytes. The shifted decterm consumes the binary tag and the top three length bytes as r0, reads the low length byte (105, LARGETUPLEEXT) 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.

4. Abort. After decterm returns, binarytotermint compares the heap pointer with the reserved end and calls ertsexit with heap overrun. That check runs after the out-of-bounds stores. Larger inputs can fault with SIGSEGV first.

NEWREFERENCEEXT. Tag 114 also accepts Len 0, but decterm rejects r0 >= MAXREFERENCE for that tag. A shifted r0 begins with a term tag byte, so the input fails with badarg.

Proof of concept

1. Build a NEWERREFERENCEEXT (tag 90) with Len 0, the node atom nonode@nohost as SMALLATOMUTF8EXT, and a 4-byte creation for another node, for example 1. 2. Build a BINARYEXT (tag 109) whose payload starts with a 32-bit arity N, followed by N SMALLINTEGEREXT elements. Pad the payload so that the low byte of the 32-bit binary length is 105 (LARGETUPLEEXT). 3. Wrap both in a two-element SMALLTUPLEEXT after the version byte 131. With N = 40 the input is 391 bytes. 4. Call binarytoterm/1, or binarytoterm/2 with [safe], on the input. The VM aborts with heap overrun by 33 words(s) instead of raising badarg.

Impact

An attacker who can supply bytes to binarytoterm/1,2 or enifbinarytoterm() can abort the Erlang VM and stop every application on the node.

Workarounds

Do not call binarytoterm/1,2 on data from untrusted sources. The OTP Secure Coding Guidelines (DSG-011) recommend avoiding these functions altogether on untrusted data. If distribution is exposed to untrusted networks, configure it to use TLS with client certificate verification. Use alternative serialization formats (JSON, Protocol Buffers) for untrusted external input. Note: the [safe] option to binarytoterm/2 does NOT protect against this crash. It only restricts atom creation, not structural validation of binary encodings.

Other sources

Out-of-bounds Write vulnerability in the external term format decoder in Erlang OTP erts allows an attacker who controls the input to binarytoterm/1,2 to abort the Erlang VM via a NEWERREFERENCEEXT term with a zero-length ID. decodedsize in erts/emulator/beam/external.c accepts a reference whose 16-bit Len field is zero, but decterm always reads one ID word. decterm then runs 4 bytes ahead of the position that decodedsize validated. It decodes the bytes that follow as terms that were never sized, and writes past the reserved process heap.

The abort takes down every process on the node. Supervision, try/catch and the safe option do not prevent it. enifbinarytoterm() and the distribution protocol reach the same decoder, and distribution is assumed to run on trusted networks only. NEWREFERENCEEXT 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.

This 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.

— MITRE

Affected Software

1 affected component
Ericsson Erlang/OTP>=17.0<27.3.4.20, >=28.0<28.5.0.9, >=29.0<29.1.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 27.3.4.20
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 28.5.0.9
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 29.1.3
  4. Configuration

    If distribution is exposed to untrusted networks, configure TLS with client certificate verification.

    Erlang distribution TLS with client certificate verification = enabled
  5. Compensating control

    Do not use binary_to_term/1,2 on untrusted data; use JSON or Protocol Buffers for untrusted external input instead.

Event History

Nov 24, 2026
CVE Published
via MITRE·03:08 PM
Data Sourced
via MITRE·03:08 PM
DescriptionWeakness
Data Sourced
via OSV·03:08 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which attack paths can supply malicious data to the vulnerable decoder?

Any attacker who controls input to binary_to_term/1 or binary_to_term/2 can trigger the issue. The same decoder is also reached through enif_binary_to_term() and the Erlang distribution protocol.

2

Does using the safe option or Erlang supervision prevent the node from being taken down?

No. The safe option, try/catch, and supervision do not prevent the VM abort caused by this condition; the abort terminates every process on the node.

3

Are nodes using Erlang distribution exposed?

They can be, because the distribution protocol reaches the affected decoder. Distribution is assumed to operate only on trusted networks, so exposure depends on whether untrusted parties can send distribution traffic.

4

Which OTP releases need remediation?

The issue affects OTP releases from OTP 17.0 up to, but not including, OTP 27.3.4.20, OTP 28.5.0.9, and OTP 29.1.3. Updating to the applicable listed fixed release removes the affected version range.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203