BabyPWN

Binary Exploitation

I hope you are having a nice day.

16KB
Open
Arch:       amd64-64-little
RELRO:      Partial RELRO
Stack:      No canary found
NX:         NX unknown - GNU_STACK missing
PIE:        No PIE (0x400000)
Stack:      Executable
RWX:        Has RWX segments
SHSTK:      Enabled
IBT:        Enabled
Stripped:   No

An extremely short buffer overflow challenge, with an executable stack! Meaning I can use shellcode and the question was just HOW?

void vuln(void)

{
  undefined local_78 [112];
  
  FUN_00401040(local_78);
  return;
}

This was the entire program being decompiled using Ghidra. An array of 112 size and a gets function call. Just those two things. Now something new I just learned is that the way gets works is that:

  • it accepts input into the buffer

  • it returns the pointer to the buffer

  • saves the buffer in RAX

Coincidentally, there was a ROP gadget that does exactly jmp rax :

Using a shellcode stored in the beginning of the buffer, and a gadget pointing there. I built a ROP chain using pwntools:

Last updated