My name is Terry Amondi and I am thrilled by offensive security
LinkedInLink: Compiled
strings command is insufficient to get your flag.chmod +x command as such;(Note: I changed the name of my binary but you can use the original name)
Try again!. This password is the flag required to complete the room.strings command on this binary returns a whole lot of text but our area of interest is the section shown below.Try again!Browse and upload the compiled binary. It will get decompiled as shown below.iVar1 and the character local_28 which is a container that can hold 32 bytes. fwrite prints out the password prompt. scanf takes in the user input and stores it in the variable local_28. In lines 15-17, you can see that the only way you can get a Correct! response as opposed to Try again! is if a string comparison between local_28 and the word _init brings back the value true, i.e, whatever is stored in local_28 is _init. Therefore, in order to input the correct passsword, you need to understand line 9.scanf takes in an argument from the user in the form DoYouEven%sCTF and stores it in local_28. However, the placement of the %s in DoYouEven%sCTF influences how the input will be accepted. You can test this out by writing simple C program including this line to see what output you will get. The C code below prints out local_28#include <stdio.h>
int main(){
char local_28[32];
printf("Password:");
scanf("DoYouEven%sCTF", local_28);
printf("Input: %s\n", local_28);
return 0;
}
gcc -o comp comp.c
where comp.c is the c code and comp is the compiled c program.DoYouEven%sCTF as the password, you get your input as;local_28 ignores everything before the %s. The input that will be displayed is what starts after DoYouEvenCorrect! response if what is stored in local_28 matches _init, meaning that the input in local_28 needs to be _init. You can achieve this by typing DoYouEven_init in the code we wrote and it will show that the input is _init as shown below.-This means our password is DoYouEven_init and inputting this in the room’s decompiled code gives;