Report
Report
Buffer Overflow is done by the attacker in order to execute his code by modifying the return
address. In this type of attack the buffer which is in the form of a stack is overloaded and made
to overflow.
The attack can be well understood in this program with the help of buf size and arglen.
The overflow can be depicted by observing that the buf size is a positive value whereas the
arglen value is a negative one. This is one of the cases where the memory can be overridden and
security can be breached.
STEPS:
1. The files vital for this attack that are used are target.c, exploit.c and shellcode.h
Initially we need to draw the stack and so we insert the files target.c and exploit.c without the
shellcode.h
For this purpose we need to find the values of buf,maxlen and len.
-
Insert the code into the exploit.c and modify the target address.
Execute and get the executable files for the two programs
Create the makefile by using the code provided to us.
The make file is then created and the values can be found out as follows.
Buf x buf
Maxlen x &maxlen
Len x &len
In order to find the values of saved stack pointer and return address we can use the
command info frame. This gives us the remaining two values required for constructing the
stack.
STACK :
Return Address
0xbfff7e1c
0xbfff7e18
0xbfff7e0c
Maxlen
0xbfff7e08
Len
0xbfff7da4
Buf
Overflow:
Now the files are executed with shellcode.h where the buf size is a positive value and
the arglen value is negative. Also we can see that $ symbol appears twice.
BEFORE OVERFLOW:
AFTER OVERFLOW: