This task is also simple one. We have unpacked executable, which I put into IDA first. After quick examination, we can notice that password is hardcoded in the execuatable at address: 0x414194:
"incorrect". Here's the code of the function:
"incorrect". Here's the code of the function:
signed int passwordCompare() { FILE *v0; // eax@1 char Buf; // [sp+0h] [bp-1Ch]@1 char Str2[8]; // [sp+Ch] [bp-10h]@1 __int16 v4; // [sp+14h] [bp-8h]@1 _mm_storel_epi64((__m128i *)Str2, _mm_loadl_epi64((const __m128i *)&password)); v4 = 116; sub_412880("Type the password:\n"); v0 = (FILE *)_acrt_iob_func(0); fgets(&Buf, 10, v0); sub_412880("You typed: %s \n", &Buf); if ( strncmp(&Buf, Str2, 0xAu) ) { sub_412880("Everytime you type the password wrong a Squirtle dies.\n\n"); system("pause"); exit(0); } return 1; }
After figuring out the password, code goes through various conditions that we have to fulfill to make squirtle happy. I think that best way of doing that is to put the .exe in debugger and change branch everytime we need to.
It takes couple of minutes to figure out which branch we have to change. After that we will be rewarded with .jpg looking exactly like that:
It takes couple of minutes to figure out which branch we have to change. After that we will be rewarded with .jpg looking exactly like that:
This obviously is the ASCII Code of our flag. Do it by hand or use this:
signed int passwordCompare() { #include <stdio.h> #include <iostream> using namespace std; char flag[] = { 0x50, 0x41, 0x4e, 0x7b, 0x54, 0x68, 0x33, 0x5f, 0x24, 0x71, 0x75, 0x69, 0x72, 0x74, 0x4c, 0x33, 0x5f, 0x24, 0x71, 0x75, 0x40, 0x64, 0x5f, 0x77, 0x40, 0x7a, 0x5f, 0x62, 0x4c, 0x75, 0x66, 0x66, 0x69, 0x4e, 0x67, 0x7d }; int main(void) { for (int i = 0; i < sizeof(flag); i++) { printf("%c", flag[i]); } cout << endl; return 0; }
And that's all, we have a flag.
Comments
Post a Comment