Blog | G5 Cyber Security

64bit Buffer Overflow Address Calculation

TL;DR

This guide explains how to calculate memory addresses for buffer overflow exploits on 64-bit systems, focusing on the stack. We’ll cover finding offsets and understanding address layouts.

Understanding 64-bit Memory Layout

On a 64-bit system, pointers are 8 bytes wide. This affects how we calculate addresses compared to 32-bit systems where pointers were 4 bytes wide. The stack grows downwards in memory.

Step-by-Step Address Calculation

  1. Find the Base Address of the Stack:
  • Identify the Target Variable’s Address:
  • Calculate the Offset:
  • Account for Return Address:
  • Consider Padding:
  • Address Calculation during Exploit Development:
  • Example Scenario

    Let’s say you have a vulnerable program with a buffer on the stack and want to overwrite the return address.

    To overwrite the return address, you would need to send 88 bytes of data to the program.

    Exit mobile version