Modern Offensive and Defensive Solutions¶
We discuss modern offensive and defensive solutions, focusing on recent research on application and system security.
- Slides for this session:
Tasks¶
Download the session task archive.
Open the session task archive and access the
rop-shell/
subfolder. Your goal is to open a shell by callingsystem("/bin/sh")
. You can jump directly to wheresystem()
is called. You need to store the address of"sh"
in RDI using a gadget. You can find the address of"sh"
in the executable by usingfind
in GDB PEDA.Construct the ROP-based payload in
exploit.py
similar to theexploit.py
file in therop-demo/
subfolder.You can look for ROP gadgets by issuing the command
ROPgadget --binary vuln
Open the session task archive and access the
rop-chain/
subfolder. You goal is to callmega_checker()
after thechecker()
call. Both the"ihahaha!"
and the"Uberihahaha!"
messages need to be printed. For themega_checker()
to be properly called you need to initialized both the RDI register (1st parameter) and the RSI register (2nd parameter).Construct the ROP-based payload in
exploit.py
.First make sure you have a recent version of Clang/LLVM (3.8+) installed. If you use the lab machines, use
apt-get
to install theclang-4.0
package.Open the session task archive and access the
dop/
subfolder. Opendop.c
. What is the vulnerability? Notice there is a buffer overflow inf
and thatf
contains a while loop that acts as an interpreter.Open
payload.c
and study the example payload. What does it do? Fill in the missing addresses inpayload.c
. Generate the payload and feed it todop
. It should print “End of program: FAILAA!”.Devise a similar payload that makes
dop
print “End of program: SISPWN!”.Recompile
dop
with the-fsanitize=safe-stack
flag and run the exploit again. What happened? Why?