nerdexam
CompTIA

PT0-001 · 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. In a stack-based buffer overflow, the attacker overflows the buffer to corrupt stack memory, allowing manipulation of the stack pointer to redirect execution flow to attacker-controlled code.

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

(23 responses)
  • A
    83% (19)
  • B
    4% (1)
  • C
    4% (1)
  • D
    9% (2)

Why each option

In a stack-based buffer overflow, the attacker overflows the buffer to corrupt stack memory, allowing manipulation of the stack pointer to redirect execution flow to attacker-controlled code.

AStack pointer registerCorrect

The stack pointer register (ESP/RSP) governs the current top of the stack and the location from which return addresses are retrieved. By overflowing a buffer beyond its allocated boundary on the stack, an attacker overwrites the stored return address referenced by the stack pointer, effectively hijacking the value loaded into the instruction pointer on function return and redirecting execution to shellcode.

BIndex pointer register

The index pointer register is not a standard x86 architecture register targeted in simple stack-based buffer overflows; controlling execution requires corrupting the stack's return address, not an index register.

CStack base pointer

The stack base pointer (EBP) defines the base of the current stack frame but overwriting it alone does not redirect execution to attacker-controlled memory without also controlling the return address.

DDestination index register

The destination index register (EDI) is used for string and memory copy operations and has no role in controlling the return address or execution flow during a simple stack-based buffer overflow.

Concept tested: Stack-based buffer overflow execution control

Source: https://owasp.org/www-community/vulnerabilities/Buffer_Overflow

Topics

#buffer overflow#CPU registers#stack pointer#exploit development

Community Discussion

No community discussion yet for this question.

Full PT0-001 Practice