Impact
A stack overflow bug can be exploited if public documented C function ei_s_print_term is called with an encoded Erlang term containing a very large integer (at least 1000 bytes long, printed as 2000 hexadecimal digits). C function ei_s_print_term is part of erl_interface and can be called both in separate port programs and in drivers/NIFs linked into the Erlang runtime beam. Necessary conditions are that ei_s_print_term is called with either totally untrusted data or data that could have been provoked to contain such a big integer. The overflowing bytes are restricted to the ASCII values of 0-9 and A-F, which limits exploitation for code execution beyond DoS.
The friend function ei_print_term, which prints directly to a FILE instead of memory, does not contain this bug.
Workarounds
- Avoid calling
ei_s_print_term with untrusted data larger than 2000 bytes.
Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the new OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are likely also affected.
Credits
Thanks to Jonatan Männchen for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.
Impact
A stack overflow bug can be exploited if public documented C function
ei_s_print_termis called with an encoded Erlang term containing a very large integer (at least 1000 bytes long, printed as 2000 hexadecimal digits). C functionei_s_print_termis part oferl_interfaceand can be called both in separate port programs and in drivers/NIFs linked into the Erlang runtime beam. Necessary conditions are thatei_s_print_termis called with either totally untrusted data or data that could have been provoked to contain such a big integer. The overflowing bytes are restricted to the ASCII values of 0-9 and A-F, which limits exploitation for code execution beyond DoS.The friend function
ei_print_term, which prints directly to a FILE instead of memory, does not contain this bug.Workarounds
ei_s_print_termwith untrusted data larger than 2000 bytes.Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the new OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are likely also affected.
Credits
Thanks to Jonatan Männchen for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.