Tag: pwn

Baby RE

Show us your basic skills! (P.S. There are 4 ways to solve this, are you willing to try them all?)

kali@kali:~/0.htb/challenges/Reversing/Baby_RE$ file baby
 baby: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=25adc53b89f781335a27bf1b81f5c4cb74581022, for GNU/Linux 3.2.0, not stripped
 kali@kali:~/0.htb/challenges/Reversing/Baby_RE$ ./baby
 Insert key: 
 Try again later.
 kali@kali:~/0.htb/challenges/Reversing/Baby_RE$ strings baby
 R3V_TH4H TS_Ef []A\A]A^A
 Dont run strings on this challenge, that is not the way!!!!
 Insert key: 
 Try again later.
 kali@kali:~/0.htb/challenges/Reversing/Baby_RE$ ./baby 
 Insert key: 

undefined8 main(void)

  int iVar1;
  undefined8 local_48;
  undefined8 local_40;
  undefined4 local_38;
  undefined2 local_34;
  char local_28 [24];
  char *local_10;
  local_10 = "Dont run `strings` on this challenge, that is not the way!!!!";
  puts("Insert key: ");
  iVar1 = strcmp(local_28,"abcde122313\n");
  if (iVar1 == 0) {
    local_48 = 0x594234427b425448;
    local_40 = 0x3448545f5633525f;
    local_38 = 0x455f5354;
    local_34 = 0x7d5a;
    puts((char *)&local_48);
  else {
    puts("Try again later.");
  return 0;

kali@kali:~/0.htb/challenges/Reversing/Baby_RE$ unhex 594234427b425448
YB4B{BTHkali@kali:~/0.htb/challenges/Reversing/Baby_RE$ unhex 3448545f5633525f
4HT_V3R_kali@kali:~/0.htb/challenges/Reversing/Baby_RE$ unhex 455f5354
E_STkali@kali:~/0.htb/challenges/Reversing/Baby_RE$ unhex 7d5a


gdb ida radare2 r2:
mov     rax, 594234427B425448h
mov     rdx, 3448545F5633525Fh
mov     qword ptr [rbp+var_40], rax
mov     [rbp+var_38], rdx
mov     [rbp+var_30], 455F5354h
mov     [rbp+var_2C], 7D5Ah
lea     rax, [rbp+var_40]
mov     rdi, rax        ; s
call    _puts
jmp     short loc_11E6


   0x00000000000011a3 <+78>:    movabs rax,0x594234427b425448
   0x00000000000011ad <+88>:    movabs rdx,0x3448545f5633525f
   0x00000000000011b7 <+98>:    mov    QWORD PTR [rbp-0x40],rax
   0x00000000000011bb <+102>:   mov    QWORD PTR [rbp-0x38],rdx
   0x00000000000011bf <+106>:   mov    DWORD PTR [rbp-0x30],0x455f5354
   0x00000000000011c6 <+113>:   mov    WORD PTR [rbp-0x2c],0x7d5a
   0x00000000000011cc <+119>:   lea    rax,[rbp-0x40]
   0x00000000000011d0 <+123>:   mov    rdi,rax
   0x00000000000011d3 <+126>:   call   0x1030 <puts@plt>
   0x00000000000011d8 <+131>:   jmp    0x11e6 <main+145>
   0x00000000000011da <+133>:   lea    rdi,[rip+0xe7f]        # 0x2060
   0x00000000000011e1 <+140>:   call   0x1030 <puts@plt>
   0x00000000000011e6 <+145>:   mov    eax,0x0

            0x000011a3      48b84854427b.  movabs rax, 0x594234427b425448 ; 'HTB{B4BY'
│       │   0x000011ad      48ba5f523356.  movabs rdx, 0x3448545f5633525f ; '_R3V_TH4'
│       │   0x000011b7      488945c0       mov qword [s], rax
│       │   0x000011bb      488955c8       mov qword [var_38h], rdx
│       │   0x000011bf      c745d054535f.  mov dword [var_30h], 0x455f5354 ; 'TS_E'
│       │   0x000011c6      66c745d45a7d   mov word [var_2ch], 0x7d5a  ; 'Z}'
│       │   0x000011cc      488d45c0       lea rax, [s]
│       │   0x000011d0      4889c7         mov rdi, rax                ; const char *s
│       │   0x000011d3      e858feffff     call sym.imp.puts           ; int puts(const char *s)
│      ┌──< 0x000011d8      eb0c           jmp 0x11e6