- Arbitrary Memory Overwrite
- pwndbg
- IDA Pro 7.0
-
Vulnerability
-
- There's just
Arbitrary Memory Write
vulnerability. - Also, provided memory leak for puts() and stack section.
- There's just
-
Notice that it's not possible to overwrite GOT section.
[*] '/MOUNT/contest/bytebandctf-2020/write/write' Arch: amd64-64-little RELRO: Full RELRO Stack: No canary found NX: NX enabled PIE: PIE enabled
-
-
Exploit
-
-
exit() calls functions as the following order.
exit() --> __run_exit_handlers() ----> _dl_fini() ------> rtld_lock_default_lock_recursive()
-
_rtld_global + 3840
refers tortld_lock_default_lock_recursive()
. -
rtld_lock_default_lock_recursive()
has one parameter,_rtld_global + 2312
, which means_dl_load_lock
. -
So, if this section is overwritten, exit() would call the desired function.
-
Notice that there's _rtld_global in loader library a.k.a ld-2.27.so
-
In my case,
- rtld_lock_default_lock_recursive(_dl_load_lock) == system("sh")
-
-
-
flag{imma_da_pwn_mAst3r}