Our Feeds

Sunday 19 June 2016

Ajith KP

Buffer Buffer Overflow Exploiting - PROTOSTAR STACK 6 in Linux x64

This is another tutorial on Buffer Overflow... Here we used the `PROTOSTAR STACK 6` challenge code is used to exploit in Linux x64 Linux.
The tools used in this tutorial is Peda debugger, an extension of GDB(Gnu Debugger). You can use this video also for to understand how to use Peda debugger.

Buffer Oveflow
Image from: wonderhowto.com

Source Code

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

void getpath()
{
  char buffer[64]; 
  unsigned int ret;

  printf("input path please: "); 
  fflush(stdout); 

  gets(buffer);

  ret = __builtin_return_address(0);
  printf("No /bin/sh for you\n");

  if((ret & 0x700000000000) == 0x700000000000) {
      printf("bzzzt (%p)\n", ret);
      _exit(1);
  }

  printf("got path %s\n", buffer);
}

int main(int argc, char **argv)
{
  getpath();
}

Tutorial Video