Shello World

Description

By tomadimitrie

Greetings, traveler

Downloads: shello-worldarrow-up-right

Solution

Basic file checks:

└─$ file ./shello-world
./shello-world: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=aa4c6aefb0f95c567829d1cde4be082c92c490a9, for GNU/Linux 3.2.0, not stripped

└─$ checksec ./shello-world
[*] '/home/kali/Desktop/TFC-CTF-2023/SHELLO-WORLD/shello-world'
    Arch:     amd64-64-little
    RELRO:    Partial RELRO
    Stack:    No canary found
    NX:       NX enabled         # No Shellcode This Time
    PIE:      No PIE (0x400000)

Vuln function (from Ghidra) :

void vuln(void) {
  ... 
  <unused local varaibles>
  ...
  fgets((char *)&local_108,0x100,stdin); // User Input
  printf("Hello, ");
  printf((char *)&local_108);            // Echo Input
  putchar(10);                           // Put Newline
  return;
}

The attack vector is to use Format String Vulnerabilityarrow-up-right. The approach I ended up using was to overwrite address in GOT (Global Offset Table) with different address to reach win function.

I was struggling to make the payload work, ended up watching full tutorial for pwntools from pwncollegearrow-up-right D:

circle-check
circle-info

For some reason overwriting printf wasn't working...

Last updated