int __fastcall main(int argc,constchar**argv,constchar**envp){unsignedint v3; // eaxsetvbuf(stdin,0LL,2,0LL);setvbuf(_bss_start,0LL,2,0LL);setvbuf(stderr,0LL,2,0LL); v3 =time(0LL);srand(v3);login_user();return0;}
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).
intlogin_user(){char v1[48]; // [rsp+0h] [rbp-40h] BYREFint v2; // [rsp+30h] [rbp-10h]puts("== Welcome to the TurboLike v1.0 login portal ==");puts("Tell me your name and I will tell you your uid!");puts("Just don't tell me your name is admin, that would be too easy ;)");printf("Name: "); v2 =rand();gets(v1);printf("Hello, %s your uid is %d!\n", v1, v2);if ( v2 !=1337 )returnputs("You are not admin!");puts("Welcome back admin! Tell me your secret and I will store it for you!");returnstore_secret();}
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