Answer the question
In order to leave comments, you need to log in
Is there a difference between a buffer overflow in VirtualBox and real hardware?
Do not run the suggested files if you do not understand all the consequences of your actions
#include "stdio.h"
#include "string.h"
#pragma comment(linker, "/BASE:0x10400000")
char *esp="\xff\xd4";
int foo(char *in)
{
char temp[100];
memcpy(temp,in,strlen(in));
return 0;
}
int n()
{
printf("\n");
printf("secret");
return 0;
}
int main()
{
char temp[1024];
long p=(long)esp;
long f=(long)n;
memset(temp,0x90,sizeof(temp));
memcpy(temp+104,&p,sizeof(p));
memcpy(temp+104+sizeof(p),"\xb8",1);
memcpy(temp+104+sizeof(p)+1,&f,sizeof(f));
memcpy(temp+104+sizeof(p)+1+sizeof(f),"\xff\xd0",2);
printf("call esp: %p",p);
foo(temp);
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question