First, I checked the security of the binary with checksec
:
As we can see, all protection are enabled:
Protection | Enabled | Usage |
---|---|---|
Canary | โ | Preventsย Buffer Overflows |
NX | โ | Disablesย code executionย on stack |
PIE | โ | Randomizes theย base addressย of the binary |
RelRO | Full | Makes some binary sectionsย read-only |
Then, we execute once the binary locally:
If this is the Buffer Overflow it seems to be, what we must do is to input the maximum integer value to the first variable and assign a 1 to the otherone to create an Integer overflow (i.e. 2147483647 and then 1):
BTW, inspecting the binary with Ghidra, we can find the function where the inputted numbers are stored and then search in Google for: โint32_t max valueโ:
The exploit provided was this: