The purpose of this program is to teach about Return-Oriented Programming.
You have two options:
- Build the program using
make
. You may need to install the packagelibreadline-dev
so you can link againstreadline
. - Use the pre-built binary compiled for Kali Linux.
Run the program using ./sim
. The program overrides its own stack using the information provided, starting at the return address of main
.
There are three types of tokens you can enter:
- Gadgets like
2
. This will place the 8-byte address of the gadget on the stack. - Unsigned constants like
$0xdeadbeef
with (hexadecimal). This will place the 8-byte constant on the stack. - Strings like
"hello, world"
. This will put a copy of the string on the heap and place a pointer on the stack.
These tasks should be increasing in difficulty.
- Print the help text
- Open a shell using
system()
- Open a shell and exit with exit code 0
- Open a shell using
execve
and exit with exit code 0 - Open a shell without using any of the provided addresses
I based this off the idea by 0x4d5a in the challenge intro-pwn-3
of CSCG 2022.