Last active
August 29, 2015 14:22
-
-
Save shankaraman/fb39c51f644e8a3e5aa7 to your computer and use it in GitHub Desktop.
Vulnerable Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<unistd.h> | |
void a(); | |
void b(); | |
void c(); | |
void a() | |
{ | |
char *dummy[] = {NULL,"dummy"}; | |
execve("/bin/sh",dummy,NULL); | |
perror("execve"); | |
} | |
void b() | |
{ | |
printf("\nHello World\n"); | |
} | |
void c() | |
{ | |
char buf[512]; | |
printf("Address of a(): %p\n", a); | |
printf("Addres of buf: %p\n",buf); | |
printf("uid is:%u\teuid is:%u\n",getuid(),geteuid()); | |
read(0,buf,1024); | |
} | |
int main() | |
{ | |
c(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
printf("You just entered\n");
puts(bug);
No need for that.