The majority of the examples of stack-based exploits use the x86 or 32-bit version of the operating system. In this section, we will look at writing a vulnerable program and compiling it within the 64-bit architecture. We then debug it as we did in the previous section, and determine the address of the instruction pointer.
Following this, we attempt to take control of the instruction pointer. Since this is with 64-bit code, the process is somewhat of a challenge. So, let's get started.
One of the biggest differences is in the size of the memory. Since we have 64-bits, we can only address 47 of these in the user space. This results in a value of 0x4141414141414141
not being able to be used because it is too large, since it takes up all 64 bits; therefore, we can address a value of 0x0000414141414141
and we will be safe.
Tip
The examples in this section are created using the Kali 2.0 64 bit version, which is using Debian kernel 4.0.
Like we did earlier in this chapter, we will...