IT4510 @ utahtech
You should use your ubuntu instance to complete the following.
We are going to take a look at how to overflow a simple buffer of some c code to gain terminal access. Answer the following questions where indicated.
Here is a simple video to get you started.
I had to edit the /etc/network/interfaces
file to something like this:
auto eth0
iface eth0 inet static
address 144.38.216.29
netmask 255.255.255.248
gateway 144.38.216.25
dns-nameservers 8.8.8.8
buffer.c
and hack.c
. These are found here and here.gcc -o buffer buffer.c
./buffer
. You may have to chmod +x
to make it executable. It then waits for you to type in a string. Type one in and see what happens.*** stack smashing detected ***: ./buffer terminated
.
gcc -fno-stack-protector -U_FORTIFY_SOURCE -o buffer buffer.c
buffer = 0xbffd09c0
.sudo /bin/sh -c "echo 0 > /proc/sys/kernel/randomize_va_space"
. (If you need to re-enable it, you can change the 0 to a 1)gcc -o hack hack.c
gcc -fno-stack-protector -z execstack -o buffer buffer.c
apt-get install execstack
execstack -q buffer
(just make sure there aren’t any weird errors)./hack [buffer address] [diff] | ./buffer
, where the inputs to buffer address and diff are given by a run of ./buffer
ls
and hit enter
. (Ctrl-D to exit the shell)
A single pdf with the answers to the following questions. Many of these answers will require you to do some research on your part.