Binary Exploitation
Binary Exploitation
1 # i n c l u d e < s t d i o . h>
2
1 # i n c l u d e < s t d i o . h>
2
1 # i n c l u d e < s t d i o . h>
2
3 # d e f i n e SIZE 0x100
4
Mitigations
NX-Bit (No eXecute) / DEP
Page is writable XOR executable
Consequently stack not executable
Injected shellcode can’t be executed
Mitigations
NX-Bit (No eXecute) / DEP
Page is writable XOR executable
Consequently stack not executable
Injected shellcode can’t be executed
1
Requirements: Gadget addresses need to be known and useful gadgets have to exist
So far we assumed we
know addresses of
gadgets, functions, libraries
and stack
So far we assumed we
know addresses of
gadgets, functions, libraries
and stack
Breaking this assumption
breaks our attack
gdb
pwndbg [6]
python
pwntools [7]
checksec [8]
https://github.com/kitctf/www/tree/master/files/pwn.zip
http://overthewire.org/wargames/narnia/
https://picoctf.com/
https://exploit.education/protostar/
https://pwnable.kr/
https://pwnable.tw/
[1] https://github.com/google/google-ctf/tree/master/2021/quals/pwn-fullchain/challenge.
[2] https://archive.aachen.ccc.de/33c3ctf.ccc.ac/challenges/index.html.
[3] https://github.com/sashs/Ropper.
[4] https://github.com/JonathanSalwan/ROPgadget.
[5] https://github.com/shellphish/how2heap.
[6] https://github.com/pwndbg/pwndbg.
[7] https://docs.pwntools.com/en/stable/.
[8] https://github.com/slimm609/checksec.sh.