UP | HOME

VERY EASY VERY SIMPLE C CODE

crackmes.one (mohammadali)


It'll just compare the input string with an array. In Ghidra, this array is showed as 3 variables:

int __cdecl _main(int _Argc,char **_Argv,char **_Env) {
  undefined4 local_1;
  undefined4 local_2;
  undefined4 local_3;

  local_1 = 0x73736170;
  local_2 = 0x64726f77;
  local_3 = 0x333231;

  while (true) {
    /* some code, taking user input... */
    res_check = _strcmp((char *)&1_password,user_input);
    if (res_check == 0) break;
    /* some code... */
  }

  puts("congrats you cracked the password");
  return 0;
}

We just have to change the type of the first one for an array of chars. As we have 3 undefined types of 4 bytes, the size must be 12.

int __cdecl _main(int _Argc,char **_Argv,char **_Env) {
  char password [12];
  password[0] = 'p';
  password[1] = 'a';
  password[2] = 's';
  password[3] = 's';
  password[4] = 'w';
  password[5] = 'o';
  password[6] = 'r';
  password[7] = 'd';
  password[8] = '1';
  password[9] = '2';
  password[10] = '3';
  password[0xb] = '\0';

  /* ... */
}

The flag is password123.

Author: rick

Email: rick@gnous.eu

Created: 2024-10-06 dim. 16:48

Validate