• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Search | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

C Programming - Buffer Overflow Exploit

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
asdftest
Just Arrived
Just Arrived


Joined: 22 Oct 2009
Posts: 0


Offline

PostPosted: Thu Oct 22, 2009 10:55 pm    Post subject: C Programming - Buffer Overflow Exploit Reply with quote

With the following C program:
Code:

void func(char * str)
{
char buff[16];
strcpy(buff,str);
}
void main(int argc, char * argv[])
{
int check = 1;
func(argv);
if(check == 1)
{
printf(“check should be 1 (%d)\n”,check);
} else
{
Printf(“check should not be 1 (%d)\n”,check);
}
}


1. How would I mount a buffer overflow attack on the given program and corrupt the variable “check” with the value 25?

Such that after the buffer overflow attack the output of the program should be the following:
check should not be 1 (25)


2. How would I mount a buffer overflow attack on the given program and bypass the “if” condition?

Such that after the buffer overflow attack the output of the program should be the following:
check should not be 1 (1)

3. How would I increase the size of the buffer “buff” (to as much as you want) and mount a buffer overflow attack and make the program execute a shell (“/bin/bash”)?

I am just beginning to learn buffer overflow exploits, so any help and/or explanations would be much appreciated...

Added code tags for readability ~ groovicus
Back to top
View user's profile Send private message
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Community Area

Log in | Register