The legacy MX4200 refclock is only built if it is specifically enabled, and furthermore additional code changes are required to compile and use it. But it uses the libc functions snprintf() and 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: Properly monitor your ntpd instances, and auto-restart ntpd (without -g) if it stops running.
Acknowledgments: Name: the NTP project Upstream: Cure53
NTP on Red Hat Enterprise Linux 5 through 7 is built with the MX4200 refclock disabled.
Created ntp tracking bugs for this issue: Affects: fedora-all [bug 1435163]