Binary Exploitation/PWN
- Today's session is on one of the harder, more technical categories you will come across!
- It is the perfect category for learning how computers execute code at a low level
- Don't get too overwhelmed or intimidated though, with some time and practice it can be one of the most rewarding categories!
- Due to it being a bit more of a difficult session we have also provided today's slides for you to reference if you need!
Further reading
- Take a look at some famous papers and articles that introduced todays techniques!
- Smashing The Stack For Fun And Profit - Buffer overflow, ret2win, ret2libc, shellcode
- The Geometry of Innocent Flesh on the Bone - Return-Oriented Programming (ROP)
- Prefer to watch videos? Here's a 4 hour youtube playlist that covers everything from today (and a bit more) in much greater detail
- basic-of-pwn - Cool github repo that covers everything you might want to know to get started, with loads of examples
- Look up writeups for challenges you have solved or are struggling with - gets some hints and learn some new techinques by seeing how other people work through the same challenges as you!
Useful tools for today!
- Disassembler/Decompiler - there are a few options so choose what looks best to you!
- Ghidra - Open Source, made by the NSA, been around for a long time so very mature with good ISA support
- Binary Ninja - Partial open source, newer than the other two but gaining a lot of popularity, free version available, everything runs locally
- IDA - Closed source, used widely by professionals, free version available (need to make an account), only supports x86 + cloud decomp, fairly intuative and easy to use
- GDB (The GNU Debugger) - debug binaries, look at execution and memory, test your payloads, would recommend installing PwnDBG or GEF as they provide nice register/stack/code views
- pwntools - Python library for automating solves so you don't have to manually copy and paste your leaks and payloads all the time
- whilehex - input raw hex bytes from the commmand line
- Its worth putting this in your bashrc/zshrc/whatever you have as an alias
alias whilehex = 'while read -r line; do echo -e $line; done', then you can use it aswhilehex | ./[binary] - Now you can type raw and non printable hex bytes into you programs using the format '\xXX' (e.g.
\xDE\xAD\xBE\xEF)
- Its worth putting this in your bashrc/zshrc/whatever you have as an alias
Today's challenges
- Pwn category on our CTFd
- If you haven't registered an account yet make sure to grab the registration key from
#loginson our discord! - Look at how many solves challenges have for a gauge on difficulty or ask for a recommendation!
- If you haven't registered an account yet make sure to grab the registration key from
- Cylab Binary Exploitation category
If you are struggling then talk to your friends and the people around you! Remember you can always look stuff up too. We want everyone to have fun and have a good time learning something new!
Happy PWNing!