LinuxSecurity.com
Share your story
The central voice for Linux and Open Source security news
Home News Topics Advisories HOWTOs Features Newsletters About Register

Welcome!
Sign up!
EnGarde Community
Login
Polls
What is the most important Linux security technology?
 
Advisories
Community
Linux Events
Linux User Groups
Link to Us
Security Center
Book Reviews
Security Dictionary
Security Tips
SELinux
White Papers
Featured Blogs
All About Linux
DanWalsh LiveJournal
Securitydistro
Latest Newsletters
Linux Advisory Watch: February 10th, 2012
Linux Security Week: February 6th, 2012
Subscribe
LinuxSecurity Newsletters
E-mail:
Choose Lists:
About our Newsletters
RSS Feeds
Get the LinuxSecurity news you want faster with RSS
Powered By

  
NetBSD: "ntp" buffer overflow Print E-mail
User Rating:      How can I rate this item?
Posted by LinuxSecurity.com Team   
NetBSD The NTP time synchronisation service shipped with NetBSD and many other systems is vulnerable to a buffer-overflow attack.

                 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)\n",
+    (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 = '\0';

For NetBSD-1.4.x:

 apply the following patch to /usr/src/usr.sbin/xntp/xntpd/ntp_control.c

--- ntp_control.c       1998/08/27 20:31:02     1.6
+++ ntp_control.c       2001/04/05 01:50:18
@@ -1757,8 +1757,22 @@ ctl_getitem(var_list, data)
                                        tp = buf;
                                        while (cp < reqend && isspace(*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)\n",
+    (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 = '\0';


Thanks To
=========

Przemyslaw Frasunek for discovering and publicising the issue.
Poul-Henning Kamp and Dima Ruban for fixes from the FreeBSD tree.
Jason Thorpe for changes to not overrun the end of the static buffer
and disabling syslog().  Simon Burge for responding to the incident
and applying the fixes.


Revision History
================

        2001-04-05      Initial Release


More Information
================

Information about NetBSD and NetBSD security can be found at 
http://www.NetBSD.ORG/ and  http://www.NetBSD.ORG/Security/.


Copyright 2001, The NetBSD Foundation, Inc.  All Rights Reserved.

$NetBSD: NetBSD-SA2001-004.txt,v 1.5 2001/04/05 13:08:39 dan Exp $


 
< Prev   Next >
    
Partner

 

Latest Features
Password guessing with Medusa 2.0
Password guessing as an attack vector
Squid and Digest Authentication
Squid and Basic Authentication
Demystifying the Chinese Hacking Industry: Earning 6 Million a Night
Free Online security course (LearnSIA) - A Call for Help
What You Need to Know About Linux Rootkits
Review: A Practical Guide to Fedora and Red Hat Enterprise Linux - Fifth Edition
Using the sec-wall Security Proxy
sec-wall: Open Source Security Proxy
Yesterday's Edition
Hackers Hit Apple Supplier Foxconn, Leak Usernames And Passwords
Hackers Mug Google's Wallet App on Rooted Android Devices
Google Chrome will no longer check for revoked SSL certificates online
Have Your Users' Passwords Already Been Hacked?
DDoS Tools Flourish, Give Attackers Many Options
Partner Sponsor

Community | HOWTOs | Blogs | Features | Book Reviews | Networking
 Security Projects |  Latest News |  Newsletters |  SELinux |  Privacy |  Home
 Hardening |   About Us |   Advertise |   Legal Notice |   RSS |   Guardian Digital
(c)Copyright 2012 Guardian Digital, Inc. All rights reserved.