Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- run first: sudo echo 0 > /proc/sys/kernel/randomize_va_space
- compile code with: gcc buffer-overflow.c -o vuln_disable_canary -fno-stack-protector
- buffer will overflow if you input a long string
- */
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char buff[10];
- int pass = 0;
- printf("\n Enter the password : \n");
- gets(buff);
- if(strcmp(buff, "helloworld"))
- {
- printf ("\n Wrong Password \n");
- }
- else
- {
- printf ("\n Correct Password \n");
- pass = 1;
- }
- if(pass)
- {
- /* Now Give root or admin rights to user*/
- printf ("\n Root privileges given to the user \n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment