Skip to main content

calc-short-for-calculator

Solved by : grb

This is what the challenge looks like, there's a single binary file attached to it.

Challenge

First, lets open it the binary up in IDA.

disassembly

This is what the function that greets us. The program takes 2 input, they check if any of them is negative integer, if both of them are not, they add both of the number and check if the resulting number is negative integer. If it is, then we get the flag.

signed integer

If you can see, the 2 input number and the resulting number is signed integer, this allows us to do integer overflow exploit. Lets do it.

PWNED

PO- PO- PO- PWNED!!! here we can see that both input are max positive 32-bit signed integer number, when added together, will overflow the integer. You can use any number as long as when added, it will go past the maximum positive 32-bit signed integer.