You can download ELF here: ------------------------> link
To get a flag in this one, easiest way I think is to bruteforce it! After quick look of executable in decompiler we can see that program outputs different strings every time we input a proper flag character to it. The best way to check that (knowing that flags in that CTF looks like "IceCTF{xxx}") is to input 'I' first, then "Ic", then "Ice", etc. The strings in ELF aren't obfuscated, so we can just count it to figure out number of characters in the flag. The only thing that has to be done now is bruteforcer itself. I wrote something like that:
#include <stdio.h> #include <stdlib.h> #include <cstring> using namespace std; int main(void) { char *flag = new char[32]; char *path = new char[128]; char *buffer = new char[128]; char *buf2 = new char[128]; FILE *plik; for (int i = 0; i < 32; i++) for (char j = 0x21; j < 0x7f; j++) { if (j == '\'') j++; flag[i] = j; sprintf(path, "echo '%s' | ./a_strong_feeling > plik.txt", flag); system(path); plik = fopen("plik.txt", "r"); fgets(buffer, sizeof(buffer), plik); fclose(plik); if (j > 0x21 && strcmp(buf2, buffer) != 0) { printf("%c", j); break; } strcpy(buf2, buffer); } printf("\n"); return 0; }
And that's all - flag will be printed in the console in just a second!
Comments
Post a Comment