CVE-2026-120961 in OTP
Summary
by MITRE • 11/24/2026
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.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/24/2026
The vulnerability described constitutes a critical out-of-bounds read with an associated single-byte write condition within the Erlang Open Telecom Platform runtime system, specifically affecting the external term format decoder in the BEAM virtual machine. This flaw resides in the handling of FLOAT_EXT terms during deserialization processes such as binary_to_term/1 and related distribution protocol functions. The core technical deficiency lies in the insufficient validation performed by the decoded_size function located in erts/emulator/beam/external.c, which verifies only that thirty-one bytes are present for a FLOAT_EXT field but fails to enforce strict boundary checks on subsequent parsing operations. When this malformed input is processed, it triggers a chain of events where sys_chars_to_double invokes standard C library functions like strtod without adequate length constraints or null-termination guarantees inherent in the input data structure.
The operational mechanism of exploitation relies on the absence of a terminating zero byte within the FLOAT_EXT field. Under normal circumstances, string-to-double conversion routines expect well-formed inputs with clear delimiters; however, when this delimiter is missing, the scanning logic continues reading memory beyond the allocated buffer boundaries into adjacent heap or stack regions. This behavior directly maps to CWE-125 Out-of-bounds Read, as the application accesses memory locations it should not have permission to read based on the declared input size. The attacker who controls the serialized binary data can thus influence how much of the surrounding memory is scanned for numeric parsing purposes. If the scan encounters an unmapped page before finding a valid radix character or null terminator, the virtual machine will likely crash due to a segmentation fault, resulting in a denial-of-service condition against the Erlang node hosting the vulnerable code.
Beyond simple information disclosure through out-of-bounds reads, this vulnerability presents a more severe risk vector involving memory corruption via single-byte overwrites. The sys_chars_to_double function attempts to normalize locale-specific radix characters by replacing commas with periods if strtod rejects them as invalid decimal points. In scenarios where the scan extends into adjacent memory and encounters a comma character outside the intended buffer boundary, this logic will overwrite that specific byte in place. This action aligns partially with CWE-787 Out-of-bounds Write, although it is strictly limited to modifying exactly one byte at a time rather than allowing arbitrary multi-byte writes or shellcode injection. While no direct code execution was demonstrated through this specific mechanism, the ability to mutate adjacent memory structures can potentially destabilize internal data representations, corrupt heap metadata, or alter control flow indirectly depending on what lies immediately after the FLOAT_EXT field in memory layout.
The impact of this vulnerability is exacerbated by architectural assumptions within the Erlang ecosystem regarding trust boundaries. The safe option intended to mitigate unsafe deserialization behaviors does not prevent this specific flaw because it operates at a higher level and cannot constrain low-level C library calls embedded deep within the emulator core. Furthermore, distribution protocols in Erlang traditionally assume that network traffic occurs over trusted internal networks, leading developers to disable certain security checks or accept serialized data from peer nodes without rigorous validation. This assumption makes systems relying on inter-node communication particularly susceptible if any node is compromised or if malicious actors gain access to these supposedly secure channels. The vulnerability affects a wide range of versions spanning OTP 17.0 through early releases of OTP 29, indicating that legacy and modern deployments alike remain at risk unless explicitly patched.
Mitigation strategies must prioritize immediate patching to the specified safe versions: OTP 27.3.4.20, OTP 28.5.0.9, or OTP 29.1.3 for corresponding ERTS releases. Organizations should audit their codebases for any usage of binary_to_term/1 and similar deserialization functions that process untrusted input from external sources. Implementing strict input validation at the application layer before passing data to the Erlang VM can provide an additional defense-in-depth measure, although it does not replace the need for upstream fixes. Security teams should also review distribution configurations to ensure that even trusted networks are monitored for anomalous binary payloads and consider implementing network segmentation or intrusion detection systems capable of identifying malformed BEAM external term structures. Continuous monitoring for unexpected node crashes or memory access violations can serve as an early warning indicator for exploitation attempts targeting this specific decoder logic.