Courseiva
Question 831 of 185
hardMultiple ChoiceObjective-mapped

PT0-002 Practice Question: A penetration tester is writing a return-oriented…

A penetration tester is writing a return-oriented programming (ROP) exploit for a Linux binary to bypass Data Execution Prevention (DEP). The binary has DEP enabled, but the tester identifies a gadget in a dynamically linked library that is not affected by ASLR. Which condition must be true for the ROP chain to succeed?

⚠ Common exam trap

Test-takers frequently assume ASLR must be fully bypassed for any exploit to work, but the question specifically isolates a library not affected by ASLR, making the ROP chain viable without bypassing ASLR for the main binary.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The library must be loaded at a fixed address

For a ROP chain to succeed when DEP is enabled, the attacker needs to control the execution flow by chaining together gadgets (small instruction sequences ending with a return) that reside in executable memory regions. If a dynamically linked library is not affected by ASLR, it means it is loaded at a fixed, predictable address, allowing the tester to reliably use gadgets from that library without needing to bypass ASLR for that specific module. This fixed address ensures the ROP chain's addresses are valid across runs, which is essential for the exploit to work.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The library must be loaded at a fixed address

    Why this is correct

    A ROP chain requires the attacker to hardcode the addresses of gadgets, which are sequences of instructions ending in `ret`. If the target library (such as libc) is loaded at a predictable, fixed base address because ASLR is disabled for that library, the attacker can compute the exact runtime addresses of those gadgets in advance. This makes the exploit reliable across reboots and processes, even if the main executable's own ASLR is enabled, because the chain never needs to reference the main binary's addresses.

  • The stack must be executable

    Why it's wrong here

    ROP is specifically a defense against Data Execution Prevention (DEP), also known as NX, which marks the stack as non-executable. If the stack were executable, the attacker could simply place shellcode on the stack and jump to it, eliminating the need for ROP entirely. ROP instead dereferences return addresses already on the stack, causing the CPU to `ret` into existing code within executable memory regions, while the stack itself remains non-executable throughout the exploit.

  • The binary must be compiled with stack canaries

    Why it's wrong here

    Stack canaries are a compile-time defense against stack buffer overflows, placing a random value between the buffer and the saved return address. They do not prevent ROP execution; they only attempt to detect the overflow before the function returns. An attacker can bypass canaries by leaking the canary value through another vulnerability, or by targeting a buffer that is not directly adjacent to a canary, so the presence of canaries is irrelevant to whether ROP can be executed.

  • The exploit must bypass ASLR for the main binary

    Why it's wrong here

    The ROP chain relies on gadget addresses in the library, not in the main binary. If the library is loaded at a fixed, non-ASLR base, those gadget addresses are stable regardless of whether the main executable uses ASLR. The main binary's ASLR would only randomize its own text, data, and stack regions, none of which are used as return-to-program destinations in the chain, so bypassing the main binary's ASLR is not a requirement.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PT0-003 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PT0-003 exam.