Binary Exploitation

Challenge
Link

baby-rop (100 pts)

baby-rop (100 pts)

Description

-

Solution

Given ELF 64 bit, open it using IDA.

int __fastcall main(int argc, const char **argv, const char **envp)
{
  unsigned int v3; // eax

  setvbuf(stdin, 0LL, 2, 0LL);
  setvbuf(_bss_start, 0LL, 2, 0LL);
  setvbuf(stderr, 0LL, 2, 0LL);
  v3 = time(0LL);
  srand(v3);
  login_user();
  return 0;
}

From main function we know that there are some function called, lets take a look on login_user (because other function are originated from library).

In login_user function we can see that there is vulnerable function which is gets. In this case we can overflow the v1 variable and control the execution flow. Because the objective is gaining remote code execution, so the flow is leak the libc address then popping shell using system function. Below is the script to solve the challenge

Flag: CBC{hex_value}

Last updated