I'm following a tutorial on YouTube to learn about Buffer Overflow exploits. The main difference I can see between his machine and mine is that his addresses consist of 8-bytes and mine consist of 12. However, both of our memory blocks appear to be 8-bytes.
When he runs his exploit command inside of gdb, he uses
r $(python -c 'print "\xff\xff\xff\xff" + "%08x-" * 6 + "%s"')
where "\xff\xff\xff\xff"
is his memory address.
I run my command using
r $(python -c 'print "\xFF\xFF\xFF\xFF\xFF\xFF" + "%08x-" * 3 + "%s"')
where \xFF\xFF\xFF\xFF\xFF\xFF
is my memory address. (I changed his *6
to *3
as his stack pointer was 6 away from his memory address and mine was 3 away).
I have tried changing the number of "%08x"
values I have present as well as changing the value to %x012
as well as %x12
.
Is there a specific way of dealing with 12-byte addresses, or is this exploit present with 12-byte addresses? ASLS is disabled.
Most likely you compiled your program as 64bit, while the teacher did his in 32bit.
The buffer overflow won't work the same in a 64bit mode. There are different things to consider. Recommend compiling as 32bit and trying that way if you want to get the basics down first.