Protect yourself against future threats.
-----BEGIN PGP SIGNED MESSAGE----- =========================================================================== AUSCERT External Security Bulletin Redistribution ESB-2001.139 -- NetBSD Security Advisory 2001-004 NTP remote buffer overflow 9 April 2001 =========================================================================== AusCERT Security Bulletin Summary --------------------------------- Product: ntp Vendor: NetBSD Operating System: NetBSD BSD Unix Impact: Root Compromise Access Required: Remote Ref: ESB-2001.138 - --------------------------BEGIN INCLUDED TEXT-------------------- - -----BEGIN PGP SIGNED MESSAGE----- NetBSD Security Advisory 2001-004 ================================= Topic: NTP remote buffer overflow Version: All versions running the NTP time service Severity: Potential remote root execution compromise Fixed: Thursday 5 April, 2001 Abstract ======== The NTP time synchronisation service shipped with NetBSD and many other systems is vulnerable to a buffer-overflow attack. This vulnerability may lead to arbitrary code execution as the user running the NTP daemon, usually root. Technical Details ================= Technical details of the bug were announced on the bugtraq mailing list, and are not replicated here. The posting archive can be found at: http://www.securityfocus.com/archive/1/174011 Known exploit code has been published for other operating systems, and leads to a remote root compromise on those systems. This exploit causes a denial of service, crashing the NTP daemon, when run against a NetBSD system. The capability to exploit the vulnerability and execute code has not yet been confirmed on NetBSD, though it is presumed to exist. It is likely that minor alterations to the detail of the published exploit code will produce a viable remote root attack. Note that source addresses of NTP UDP time packets are easily forged, so IP address based restrictions on incoming NTP traffic are likely to be of limited value. Solutions and Workarounds ========================= The patch attached below has been incorporated into NetBSD-current, and pulled up into the NetBSD 1.4 and 1.5 release branches. Unless systems depend critically on NTP for very accurate time, or have very poor local clocks, the NetBSD project recommends that running NTP daemons be temporarily disabled immediately, to prevent the risk of compromise while fixes are being applied. Users should make their own judgement, but most systems should be able to run for several days without significant clock drift. This allows administrators flexibility in managing the update and change process. Systems running releases older than NetBSD 1.4 should be upgraded to NetBSD 1.4.3 before applying the fixes described here. Systems running NetBSD-current dated from before 2001-04-05 should be upgraded to NetBSD-current dated 2001-04-05 or later. Systems running NetBSD releases 1.4.x or 1.5 should apply the following patches. These patches have been pulled up to the release branches, users tracking the release branches should update to a code newer than 2001-04-05. The two patches are the same, apart from some formatting differences and relocation of the file that occurred in the interim. Note: the syslog()ing code in the original patch from FreeBSD is disabled but included, as some people may want to enable syslog()ing the source of the bad packets. This was disabled in NetBSD to prevent a potential resource exhaustion DoS against syslog, and as the address is likely to be spoofed. For NetBSD-1.5: apply the following patch to /usr/src/dist/ntp/ntpd/ntp_control.c - - --- ntp_control.c 2000/04/22 14:53:15 1.1.1.2 +++ ntp_control.c 2001/04/05 02:08:01 1.2 @@ -1812,9 +1812,22 @@ while (cp < reqend && isspace((int)*cp)) cp++; - - - while (cp < reqend && *cp != - - - ',') + while (cp < reqend && *cp != ',') { *tp++ = *cp++; + if (tp >= + buf + sizeof(buf) - 1) { +#if 0 /* don't syslog for now - DoS potential on filling syslog */ + msyslog(LOG_WARNING, + "Attempted "ntpdx" exploit from IP %d.%d.%d.%d:%d (possibly spoofed) ", + (ntohl(rmt_addr->sin_addr.s_addr) >> 24) & 0xff, + (ntohl(rmt_addr->sin_addr.s_addr) >> 16) & 0xff, + (ntohl(rmt_addr->sin_addr.s_addr) >> 8) & 0xff, + (ntohl(rmt_addr->sin_addr.s_addr) >> 0) & 0xff, + ntohs(rmt_addr->sin_port)); +#endif + return (0); + } + } if (cp < reqend) cp++; *tp = '