Question: In Project 2 Part 3 , you caused the provided project 2 . S to call the function named sekret _ fn by exploiting a

In Project 2 Part 3, you caused the provided project2.S to call the function named sekret_fn by
exploiting a buffer overflow in gets() and overwriting the RA register of main(), the caller of gets().
Your job in this part is to implement a stack canary that gets pushed on the stack just below the
RA register. You will work from a created copy of your project 2 source code. Add the stack canary
implementation to the main() function prolog. Choose a stack canary value that is a printable
ASCII or UTF-8 string. You should allocate additional stack space and adjust the stack offsets for
saving RA to do this. Then, in the main() function epilog, implement a check to compare the stack
canary on the stack with the expected stack canary value that was stored in the prolog. If the values
do not match, call the exit syscall (see ecall_read_write sample code in Canvas Modules). If the
values do match, return as usual from main().
In your README report, include the stack canary value you added to main() as both the
printable string, and as a hexadecimal value. Show a screenshot of your QtRVSim window showing
the register window when reproducing the attack you came up with from Project 2 Part 3 that calls
sekret_fn through the buffer overflow.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!