Super Secret Password
Source Code
Big brain solution
The goal here is to furfill two if statments, the first one checks a bool value which is hardcoded to false, if it returns true we pass it, otherwise the program exits.
The second if checks the password, and it needs to match "SuperSecureAndSuperSecretPassword!".
The buffer where our password is stored is initialized right above the bool value and the input size is unrestricted, which means we can overflow the buffer and overwrite the bool value with true.
We can patch the source to print the pointers of both variables to calculate the offset. by simply adding the following lines after both variables are initialized:
After compiling and running the bin we can calculate the offset.
Great, the offset is 268 bytes, that means we can use a 268 sized junk to push a true value into auth_enabled. If we send the following input:
We'll bypass the first if statment.
This means we hit the second if. Now we just got to input the correct password prepended to our padding to match the correct password. Don't forget to correct the padding size by subtracting the length of the password witch is 34 bytes.
And the program trys to read the flag.
Now we just gotta send the input to the remote instance.
Small brain solution
Every thing other than false returns true so getting the perfectly right offset is pointless.
What could make the challenge better would be adding a string compare instead of bool which would prevent one from solving without calculating the offset.
Last updated
Was this helpful?