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.
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)- A83% (19)
- B4% (1)
- C4% (1)
- D9% (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.
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.
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.
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.
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
Community Discussion
No community discussion yet for this question.