NTP BUG 3378: Improper use of snprintf() in mx4200_send()

Last update: April 22, 2024 18:49 UTC (7e7bd5857)


Summary

Resolved 4.2.8p10 21 Mar 2017
References Bug 3378 CVE-2017-6451
Affects All versions of NTP, up to but not including ntp-4.2.8p10,
and ntp-4.3.0 up to, but not including ntp-4.3.94.
Resolved in 4.2.8p10.
CVSS2 Score LOW 0.8 AV:L/AC:H/Au:M/C:N/I:N/A:P
CVSS3 Score LOW 1.8 CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:L/A:N

Description

The legacy MX4200 refclock is only built if is specifically enabled, and furthermore additional code changes are required to compile and use it. But it uses the libc function snprintf() / vsnprintf() incorrectly, which can lead to an out-of-bounds memory write due to an improper handling of the return value of snprintf() / vsnprintf(). Since the return value is used as an iterator and it can be larger than the buffer’s size, it is possible for the iterator to point somewhere outside of the allocated buffer space. This results in an out-of-bound memory write. This behavior can be leveraged to overwrite a saved instruction pointer on the stack and gain control over the execution flow. During testing it was not possible to identify any malicious usage for this vulnerability. Specifically, no way for an attacker to exploit this vulnerability was ultimately unveiled. However, it has the potential to be exploited, so the code should be fixed.


Mitigation

If you have a Magnavox MX4200 refclock:


Credit

This weakness was discovered by Cure53.


Timeline