Rebug

Rebug 1

Description

Can't seem to print out the flag :( Can you figure out how to get the flag with this binary?

Author: Mahmoud Shabana

Downloads: test.outarrow-up-right

Solution

The solution is quite disappointing, if input length is 12 then flag is printed out to us.

Ghidra code, main function:

int main(void) {
  EVP_MD *type;
  char local_448 [44];
  uint _16;
  byte flag [16];
  char input [1008];
  EVP_MD_CTX *evp_md_ctx;
  int j;
  int i;
  
  printf("Enter the String: ");
  __isoc99_scanf("%s",input);
  for (i = 0; input[i] != '\0'; i = i + 1) {}
  if (i == 12) {
    puts("that\'s correct!");
    evp_md_ctx = (EVP_MD_CTX *)EVP_MD_CTX_new();
    type = EVP_md5();
    EVP_DigestInit_ex(evp_md_ctx,type,(ENGINE *)0x0);
    EVP_DigestUpdate(evp_md_ctx,"12",2);
    _16 = 16;
    EVP_DigestFinal_ex(evp_md_ctx,flag,&_16);
    EVP_MD_CTX_free(evp_md_ctx);
    for (j = 0; j < 16; j = j + 1) {
      sprintf(local_448 + j * 2,"%02x",(ulong)flag[j]);
    }
    printf("csawctf{%s}\n",local_448);
  }
  else {
    printf("that isn\'t correct, im sorry!");
  }
  return 0;
}
circle-check

Rebug 2

Description

No input this time ;) Try to get the flag from the binary. When you find the answer of the program, please submit the flag in the following format: csawctf{output}

Author: Mahmoud Shabana

Downloads: bin.outarrow-up-right

Solution

The program has no output or user input, it has hardcoded hex values which get processed in odd way. main -> printbinchar -> xoring

xoring:

Inspecting in the IDA before exit function:

Rebug-2-1
circle-check

Last updated