EEF-CVE-2026-120961

Source
https://cna.erlef.org/osv/EEF-CVE-2026-120961.html
Import Source
https://cna.erlef.org/osv/EEF-CVE-2026-120961.json
JSON Data
https://api.osv.dev/v1/vulns/EEF-CVE-2026-120961
Aliases
  • GHSA-r7pf-rpq8-5pf4
  • CVE-2026-120961
Published
2026-11-24T15:10:40Z
Modified
2026-11-24T15:15: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
binary_to_term Heap Overrun via FLOAT_EXT Without Terminating Zero Byte May Abort the VM
Details

Summary

Out-of-bounds Read 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 read memory after the input, and to change one byte there, via a FLOAT_EXT term without a terminating zero byte. decoded_size in erts/emulator/beam/external.c checks only that the 31 bytes of the FLOAT_EXT field are present. dec_term then passes the field to sys_chars_to_double, which scans to a NUL byte without a length limit. When the field has no NUL, the scan continues into the bytes after the field, and those bytes change the decoded float. When the radix character is found after the field and strtod does not accept it, sys_chars_to_double overwrites that byte (a , becomes a .). The VM can fault if the scan reaches an unmapped page.

The safe option does not prevent this. enif_binary_to_term() and the distribution protocol reach the same decoder, and distribution is assumed to run on trusted networks only. The write is limited to the one radix byte. No arbitrary write or code execution was shown.

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. binary_to_term_int first calls decoded_size in erts/emulator/beam/external.c. For FLOAT_EXT (tag 99), decoded_size skips 31 bytes and reserves heap for one float. It does not examine the content of the field.

2. Decode pass. dec_term passes the pointer to the field to sys_chars_to_double and then advances by 31 bytes. The call carries no length. sys_chars_to_double (in erts/emulator/sys/unix/sys_float.c and erts/emulator/sys/win32/sys_float.c) treats the field as a C string.

3. Out-of-bounds read. sys_chars_to_double checks the float syntax one character at a time and requires a NUL after the last digit. A valid encoder pads the field with NUL bytes. When all 31 bytes are part of a float, the scan and the subsequent strtod call continue into the bytes after the field. When the field is the last term of the input, these are bytes after the input. If they complete a valid float and a NUL follows, the decoded value contains them.

4. One-byte write. sys_chars_to_double remembers the position of the radix character, which can be . or ,. If strtod stops before the end of the scanned string, the function replaces the radix character with the other one in place and calls strtod again. When the field contains only digits, the radix character is a byte after the field. A , there is changed to ..

5. Fault. The scan has no upper limit. If only digits follow up to the end of the mapped memory, the read faults and the VM aborts.

Proof of concept

  1. Build a FLOAT_EXT field without a NUL byte: tag 99 followed by the 31 bytes 1.0e plus 26 times 0 plus 1. This is the float 10.0.
  2. Put the field at the end of an input, for example as the last element of a SMALL_TUPLE_EXT after the version byte 131.
  3. Build a larger binary that holds the input followed by the bytes 7 and NUL. Take the input as a sub-binary with binary:part/3.
  4. Call binary_to_term/2 with [safe] on the sub-binary. The last element decodes as 1.0e17 and not 10.0: the decoder read the 7 after the input.
  5. For the write, use the 31 digits 1234567890123456789012345678901 as the field and put ,5 and NUL after the input. After the call, the , byte in the parent binary is a ..

Impact

An attacker who can supply bytes to binary_to_term/1,2 or enif_binary_to_term() can make the decoder read bytes after the input, which then change the decoded float, and can change one , byte after the input to .. The VM can abort if the read reaches unmapped memory.

Workarounds

  • 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.
  • 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 binary_to_term/2 does NOT protect against this issue. It only restricts atom creation, not structural validation of binary encodings.
Database specific
{
    "capec_ids":  [
        "CAPEC-540"
    ],
    "cpe_ids":  [
        "cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"
    ],
    "cwe_ids":  [
        "CWE-125"
    ]
}
References
Credits
    • Khaled Suliman - FINDER
    • Khaled Suliman - REPORTER
    • Jonatan Männchen / EEF - COORDINATOR

Affected packages

Git / github.com/erlang/otp

Affected ranges

Type
GIT
Repo
https://github.com/erlang/otp
Events

Affected versions

OTP-17.*
OTP-17.0
OTP-18.*
OTP-18.0
OTP-18.0-rc1
OTP-19.*
OTP-19.0
OTP-19.0-rc1
OTP-19.0-rc2
OTP-20.*
OTP-20.0
OTP-20.0-rc1
OTP-20.0-rc2
OTP-21.*
OTP-21.0
OTP-21.0-rc1
OTP-21.0-rc2
OTP-22.*
OTP-22.0
OTP-22.0-rc1
OTP-22.0-rc2
OTP-22.0-rc3
OTP-23.*
OTP-23.0
OTP-23.0-rc1
OTP-23.0-rc2
OTP-23.0-rc3
OTP-24.*
OTP-24.0
OTP-24.0-rc1
OTP-24.0-rc2
OTP-24.0-rc3
OTP-25.*
OTP-25.0
OTP-25.0-rc1
OTP-25.0-rc2
OTP-25.0-rc3
OTP-26.*
OTP-26.0
OTP-26.0-rc1
OTP-26.0-rc2
OTP-26.0-rc3
OTP-27.*
OTP-27.0
OTP-27.0-rc1
OTP-27.0-rc2
OTP-27.0-rc3
OTP-27.1
OTP-27.2
OTP-27.3
OTP-27.3.1
OTP-27.3.2
OTP-27.3.3
OTP-27.3.4
OTP_17.*
OTP_17.0-rc1
OTP_17.0-rc2
Other
OTP_R13B03
OTP_R13B04
OTP_R14A
OTP_R14B
OTP_R14B01
OTP_R14B02
OTP_R14B03
OTP_R15A
OTP_R15B
OTP_R16A_RELEASE_CANDIDATE
OTP_R16B
patch-base-27

Database specific

source
"https://cna.erlef.org/osv/EEF-CVE-2026-120961.json"