brett
2019-09-11 06:36:50 UTC
I am trying to create a shell to exploit a buffer overflow vulnerability in ubuntu in Linux. I have a simple C code with a buffer overflow vulnerability. It reads a list of hexidecimal values from a data.txt file and sorts them and prints the output. If I input more than 17 hexidecimal values into the data.txt file, I get a segfault (as expected). If I use less than 17, it runs fine.
I have used GDB debugger to find the addresses in memory of system, the function parameter for system (/bin/sh), and exit.
I tried putting those memory addresses into the data.txt file, but I still get a segfault instead of spawning a shell.
Do they need to be in a certain order? If so, how do I keep the sorting feature from messing that order up once I achieve it? And how do I figure out that order in the first place? Or is there something else I'm doing wrong?
Will put code into a response (too long for post)