nerdexam
CompTIA

PT0-002 · Question #119

Which of the following CPU register does the penetration tester need to overwrite in order to exploit a simple buffer overflow?

The correct answer is A. Stack pointer register. To exploit a buffer overflow, especially in more advanced scenarios, a penetration tester might aim to overwrite stack data that ultimately redirects the stack pointer (ESP) to an attacker-controlled memory region.

Attacks and Exploits

Question

Which of the following CPU register does the penetration tester need to overwrite in order to exploit a simple buffer overflow?

Options

  • AStack pointer register
  • BIndex pointer register
  • CStack base pointer
  • DDestination index register

How the community answered

(25 responses)
  • A
    96% (24)
  • B
    4% (1)

Why each option

To exploit a buffer overflow, especially in more advanced scenarios, a penetration tester might aim to overwrite stack data that ultimately redirects the stack pointer (ESP) to an attacker-controlled memory region.

AStack pointer registerCorrect

While a simple buffer overflow often targets the return address to control the Instruction Pointer (EIP), more sophisticated exploitation techniques, like a stack pivot, involve overwriting stack data in a way that the stack pointer (ESP) is redirected to an attacker-controlled memory area. This redirection then allows the attacker to control subsequent stack operations and program execution flow.

BIndex pointer register

The Instruction Pointer (EIP/RIP) holds the address of the next instruction to execute, and its value is controlled by overwriting the return address on the stack, not typically by directly overwriting the EIP register itself with overflowed buffer data.

CStack base pointer

The Stack Base Pointer (EBP/RBP) points to the base of the current stack frame; while it can be corrupted by an overflow, its direct overwriting is not the primary mechanism for gaining execution control in a simple buffer overflow.

DDestination index register

The Destination Index register (EDI/RDI) is primarily used for string and data manipulation operations and does not play a direct role in hijacking control flow during a buffer overflow exploit.

Concept tested: Buffer overflow exploitation - Stack Pointer manipulation (stack pivot)

Source: https://docs.pwntools.com/en/stable/rop.html

Topics

#buffer overflow#CPU registers#memory exploitation

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice