The OpenNET Project / Index page
BSD, Linux, Cisco, Web, Palm, other unix
RUSSIAN version

Search
Выпущена CD-версия OpenNet.RU для оффлайн просмотра.
Для формирования заказа - перейдите по ссылке
.
SOFT - Unix Software catalog
LINKS - Unix resources
TOPIC - Articles from usenet
DOCUMENTATION - Unix guides
News | Tips | MAN | Forum | BUGs | LastSoft | Keywords | BOOKS (selected) | Linux HowTo | FAQ Archive

[H20020304]: Remotely exploitable format string vulnerability in ntop


<< Previous INDEX Search src Set bookmark Go to bookmark Next >>
Date: Mon, 4 Mar 2002 07:46:18 -0500 (EST)
From: hologram <holo@brained.org>
To: bugtraq@securityfocus.com
Subject: [H20020304]: Remotely exploitable format string vulnerability in ntop

--0-1989750537-1015245978=:3145
Content-Type: TEXT/PLAIN; charset=US-ASCII


        h o l o g r a m  |  s e c u r i t y  |  a d v i s o r y
_______________________________________________________________________


                       Advisory ID : H20020304
                          Software : ntop
                          Synopsis : Remotely exploitable format
                                     string vulnerability in ntop.
                            Vendor : Luca Deri <www.ntop.org>
                          Verified : Version 2.0
                            Author : hologram <holo@brained.org>

_______________________________________________________________________


| Overview |-----------------------------------------------------------

ntop is a UNIX tool that shows the network usage, similar to what the
popular top UNIX command does on the system level. A format string
vulnerability has been discovered on the programmatic level and
is currently known to affect the UNIX version, however, the Windows
port of the program remains untested. The vulnerability allows
for remote arbitrary code execution.

| Vulnerability |------------------------------------------------------

The format string vulnerability lies within the traceEvent() function
which is declared as:

void traceEvent(int eventTraceLevel, char* file,
  int line, char * format, ...)

in the file util.c. The third argument, as is apparent, is a format
string to be later manipulated by the traceEvent() call.

Further into the code, the following is made visible:

...

  va_list va_ap;
  va_start (va_ap, format);

...

    char buf[BUF_SIZE];

...

#ifdef WIN32
      /* Windows lacks of vsnprintf */
      vsprintf(buf, format, va_ap);
#else
      vsnprintf(buf, BUF_SIZE-1, format, va_ap);
#endif

      if(!useSyslog) {  // syslog() logging is not enabled
	printf(buf);  // vulnerability

...

#ifndef WIN32
      else {  // syslog() logging is enabled
#if 0
	switch(traceLevel) {
	case 0:
	  syslog(LOG_ERR, buf);  // vulnerability
	  break;
	case 1:
	  syslog(LOG_WARNING, buf);  // vulnerability
	  break;
	case 2:
	  syslog(LOG_NOTICE, buf);  // vulnerability
	  break;
	default:
	  syslog(LOG_INFO, buf);   // vulnerability
	  break;
	}
#else
	syslog(LOG_ERR, buf);

...

Obviously, a call such as syslog(LOG_ERR, buf) should be replaced
with syslog(LOG_ERR, "%s", buf) to remove the insecurity.

The bug can be exploited whether or not syslog() logging is enabled
because of the erroneous printf(buf) call, as well.

One of the simplest points of entry I have determined is if the -w
option was specified when ntop was ran, which allows web access
to the ntop information. A HTTP request of the following:

GET /%s%s%s HTTP/1.0

will cause program termination (the HTTP deamon for ntop is normally
listening on port 3000).

The vulnerability does allow remote execution of arbitrary commands,
and if concerned, an appropriate fix should be quickly applied.


-------------------------------| Copyright 2002. All rights reserved. |


--0-1989750537-1015245978=:3145
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="H20020304.txt"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSO.4.33.0203040746180.3145@brained.org>
Content-Description: 
Content-Disposition: attachment; filename="H20020304.txt"

DQ0KICAgICAgICBoIG8gbCBvIGcgciBhIG0gIHwgIHMgZSBjIHUgciBpIHQg
eSAgfCAgYSBkIHYgaSBzIG8gciB5DQ0KX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX18NDQoNDQoNDQogICAgICAgICAgICAgICAgICAgICAgIEFkdmlzb3J5
IElEIDogSDIwMDIwMzA0DQ0KICAgICAgICAgICAgICAgICAgICAgICAgICBT
b2Z0d2FyZSA6IG50b3ANDQogICAgICAgICAgICAgICAgICAgICAgICAgIFN5
bm9wc2lzIDogUmVtb3RlbHkgZXhwbG9pdGFibGUgZm9ybWF0DQ0KICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyB2dWxu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BzcGVjaWZpZWQgd2hlbiBudG9wIHdhcyByYW4sIHdoaWNoIGFsbG93
cyB3ZWIgYWNjZXNzDQ0KdG8gdGhlIG50b3AgaW5mb3JtYXRpb24uIEEgSFRU
UCByZXF1ZXN0IG9mIHRoZSBmb2xsb3dpbmc6DQ0KDQ0KR0VUIC8lcyVzJXMg
SFRUUC8xLjANDQoNDQp3aWxsIGNhdXNlIHByb2dyYW0gdGVybWluYXRpb24g
KHRoZSBIVFRQIGRlYW1vbiBmb3IgbnRvcCBpcyBub3JtYWxseQ0NCmxpc3Rl
bmluZyBvbiBwb3J0IDMwMDApLg0NCg0NClRoZSB2dWxuZXJhYmlsaXR5IGRv
ZXMgYWxsb3cgcmVtb3RlIGV4ZWN1dGlvbiBvZiBhcmJpdHJhcnkgY29tbWFu
ZHMsDQ0KYW5kIGlmIGNvbmNlcm5lZCwgYW4gYXBwcm9wcmlhdGUgZml4IHNo
b3VsZCBiZSBxdWlja2x5IGFwcGxpZWQuDQ0KDQ0KDQ0KLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLXwgQ29weXJpZ2h0IDIwMDIuIEFsbCByaWdo
dHMgcmVzZXJ2ZWQuIHwNDQoNDQo=
--0-1989750537-1015245978=:3145--

<< Previous INDEX Search src Set bookmark Go to bookmark Next >>
Закладки
Добавить в закладки
Created 1996-2003 by Maxim Chirkov  
ДобавитьРекламаВебмастеруЦУПГИД  
SpyLOG TopList
RB2 Network. RB2 Network.