Advanced Math Analysis
Buffer overflow, with a strcmp() check.
Problem
The advanced course covers the same content as the non-advanced course and then some. Specifically, it also teaches some units on logic and geometry.
Now, I'm personally not the biggest fan of geometry, so I'll spare you from that. But you'll definitely need to spend some time _logic_ing this challenge out!
Solution
This is the same challenge as before, except there is a strcmp()
check.
Win function:
Here, my tool wouldn't work due to the strcmp()
check. strcmp()
only returns 0 when both strings are equal, so it is checking that our input string is equal to "i pledge to not cheat"
.
The flaw in this is that strcmp()
only compares up to the point where either
The strings differ, OR
A terminating null byte is reached.
In Linux, we can type a null byte using CTRL-@. This will bypass the strcmp()
check.
Now, using our debugger, we can find the part of the pattern that overwrote the RIP.
The offset is 50. However, note that this means 50 characters after the null byte.
Using redare2, we find that the address of the cheat function is 0x00401216.
Last updated