Buffer OverFlow - Stack1

Created by: Mrx-Exploit

Featured image

Source Code

In this part i will read the code and i will try to get any bug on it, So see what will happen

image

Code Review

image

In this part he just Creating variable easy.

image

There is if condition What to do ??
It’s just to check if there argument after the program name or not
if not it will print “please specify an argument”

image

In this part he put value in the “modified” so now it’s equal “ZERO” Then its take anything will be in the argument and will put it in the “buffer” variable

image

Last part in the code there is another if condition it’s compare if “modified” == “0x61626364” or not

Solution time

Let’s see Who can we get this addr in the if condition
Here i will use “r2” to read the functions as assembly but you can use anytool you love, np :D

image

image

Here we go we got the addr without source code, So what’s mean “cmp” that’s mean compare
What next…!?
Let’s full the “buffer” variable How can we do that with python

image

That’s mean run the program then print “A * 76” so now “buffer” was full to be sure let’s do ….

image

Now we can see our “C” as hex, So we are in the right way, So what will happen if we did that…

image

Damn thats so easy
And we did it