


















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































Question 81. Which WinDbg command can be used to display the current thread’s stack contents as a series of 4-byte values? A) dps B) db C) dp D) du Answer: A Explanation: “dps” (Display Pointer-sized values) shows a stack dump with each entry interpreted as a pointer (4-byte on x86). Question 82. In IDA Pro, what does the shortcut “Ctrl+F” accomplish? A) Finds the next function call B) Opens the “Find Text” dialog to search for strings or identifiers C) Formats the current function as pseudo-C code D) Flattens the graph view Answer: B Explanation: Ctrl+F brings up the search dialog, allowing you to locate symbols, strings, or hex patterns in the disassembly. Question 83. Which of the following registers is NOT preserved across a stdcall function call on 32-bit Windows? A) EBX B) ESI C) EDI D) EAX Answer: D Explanation: EAX is caller-saved (used for return value), while EBX, ESI, and EDI are callee-saved per the stdcall convention.
Question 84. When constructing a ROP chain to call WriteProcessMemory, which argument must contain the handle of the target process? A) lpBaseAddress B) hProcess C) nSize D) lpBuffer Answer: B Explanation: The first parameter of WriteProcessMemory is the handle to the process whose memory will be written. Question 85. What is the primary purpose of the “jmp esp” gadget in a non-ASLR module? A) To pivot the stack pointer to a new location B) To transfer execution directly to shellcode placed on the stack C) To clear the stack canary D) To disable DEP for the current thread Answer: B Explanation: “jmp esp” jumps to the address contained in ESP, which typically points to attacker-controlled shellcode on the stack. Question 86. Which of the following is a reliable way to discover the offset of the saved EBP in a vulnerable function? A) Count the number of local variables in the source code B) Use pattern_create to generate a unique string and locate it in the crash dump C) Look at the function’s prologue in IDA and calculate the stack frame size D) Guess based on the size of the input buffer Answer: B Explanation: A cyclic pattern allows you to pinpoint the exact offset where the pattern overwrites EBP/EIP when the crash occurs.
Question 90. In the context of a format-string write, what does the “%hn” specifier do? A) Writes a 2-byte half-word to the target address B) Writes a 4-byte word to the target address C) Writes the number of characters printed as a string D) Writes a null-terminated string to the target address Answer: A Explanation: “%hn” stores the number of characters printed so far into a 16-bit location, enabling 2-byte writes. Question 91. Which of the following is the most common reason an egghunter fails to locate the “egg” on a 64-bit system? A) The egghunter uses the “int 2e” syscall, which is unavailable on x86- 64 B) The egghunter scans only 32-bit address space, missing 64-bit pointers C) The egghunter relies on a NULL terminator that is filtered out D) The egghunter exceeds the maximum allowed instruction length for 64-bit mode Answer: B Explanation: A 32-bit egghunter only generates 32-bit addresses, so it cannot correctly traverse the full 64-bit address space. Question 92. In a Windows PE file, where is the Import Address Table (IAT) typically referenced? A) In the .text section’s first instruction B) Through the IMAGE_DIRECTORY_ENTRY_IAT entry in the Optional Header C) Inside the .reloc section D) In the .rsrc resource directory Answer: B
Explanation: The Optional Header contains a data directory entry that points to the IAT. Question 93. Which of the following is a common technique to defeat a stack canary when the canary value can be leaked via an out-of-bounds read? A) Overwrite the canary with zero after leaking it B) Use the leaked canary value in the overflow payload to preserve it C) Disable the canary by setting a registry key at runtime D) Replace the canary with a NOP sled using a format-string write Answer: B Explanation: By inserting the exact leaked canary value back into the overflow payload, the canary check passes. Question 94. Which WinDbg command can be used to view the contents of the Process Environment Block (PEB)? A) !peb B) !process 0 0 C) !teb D) !env Answer: A Explanation: “!peb” displays the PEB structure for the current process. Question 95. In a ROP chain, why is it often necessary to include a “pop ebx; ret” gadget before calling VirtualProtect? A) To align the stack pointer to a 16-byte boundary B) To load the address of the shellcode into EBX as the lpAddress argument C) To clear the EFLAGS register D) To set the DEP flag to disabled Answer: B
Answer: B Explanation: “!exploitable” analyses the exception record, registers, and stack to classify the crash as exploitable, non-exploitable, or unknown. Question 99. In a 32-bit binary compiled with stack protection, where is the canary value typically stored? A) At the beginning of the .data section B) Immediately before the saved EIP on the stack C) In the .bss section as a global variable D) Inside the executable header Answer: B Explanation: The compiler inserts the canary just before the saved return address on the stack to detect overwrites. Question 100. Which of the following is the most common way to locate a “jmp esp” gadget in a module that is compiled with /SAFESEH? A) Search only the .text section for the byte pattern “FFE4” B) Look in the .reloc section for jump tables C) Scan the Safe Exception Handlers table for the opcode D) Use the “!search -b FFE4” command in WinDbg on the module’s image base Answer: D Explanation: “!search -b FFE4” scans the entire module for the byte sequence representing “jmp esp”, regardless of SafeSEH. Question 101. In the context of Windows exploitation, what does “ROP-NOP” refer to? A) A gadget that performs a no-operation (e.g., “xor eax, eax; ret”) used for alignment B) A special instruction that disables DEP temporarily C) A technique that replaces NOP sleds with a series of return-oriented gadgets that have no side effects
D) A Windows API that clears the process’s memory Answer: C Explanation: ROP-NOPs are gadgets that effectively act as NOPs (do nothing useful) but are used to pad or align a ROP chain. Question 102. Which of the following is a typical indicator that a binary has been compiled with the /DYNAMICBASE flag? A) Presence of a .reloc section containing relocation entries B) The IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE flag set in the Optional Header C) An import of the function “VirtualAllocEx” D) A .tls section in the PE file Answer: B Explanation: The flag in the Optional Header explicitly signals that the binary supports ASLR. Question 103. When using a format-string vulnerability to write an arbitrary 4-byte value, which of the following sequence is required? A) Place the target address on the stack, then use “%n” with proper padding B) Use “%s” to write the string “0xdeadbeef” directly C) Use “%p” to print the address, then “%c” to write a character D) Overwrite the return address directly with “%x” Answer: A Explanation: The address to be written is placed on the stack, and “%n” stores the number of characters printed so far into that address. Question 104. In IDA Pro, what does the “Y” shortcut do when the cursor is on a function name? A) Renames the function B) Adds a comment to the function
B) or esp, 0xF C) sub esp, 0x D) add esp, 0x Answer: A Explanation: “and esp, 0xFFFFFFF0” clears the lower four bits, aligning ESP down to the nearest 16-byte boundary. Question 108. Which of the following best describes the purpose of the “!heap - stat” extension in WinDbg? A) Shows a summary of heap allocations, including size classes and counts B) Displays the current heap’s protection flags C) Dumps the contents of the heap as a hex string D) Lists all heap handles opened by the process Answer: A Explanation: “!heap -stat” provides statistical information about heap usage, useful for identifying large allocations. Question 109. What is the effect of the “push 0x0; pop eax; ret” gadget in a ROP chain? A) Sets EAX to zero without affecting other registers B) Increments the stack pointer by two words C) Writes zero to the memory address pointed by EAX D) Calls a function at address 0x0 (causing a crash) Answer: A Explanation: The gadget loads 0 into EAX, a common step for preparing arguments that require a zero value. Question 110. Which of the following is a common way to discover the address of a “pop esi; ret” gadget in a module that has been rebased by ASLR? A) Use the module’s export table to locate it directly
B) Leak a pointer into the module (e.g., via an info-leak) and calculate the offset from a known base C) Guess the address based on the file’s timestamp D) Search the .reloc section for the opcode sequence “5E C3” Answer: B Explanation: By leaking any address from the module, you can compute the runtime base and add the known static offset to locate the gadget. Question 111. In a format-string exploit, why is it important to include a “%08x” specifier when trying to align the stack for a subsequent “%n” write? A) It prints exactly eight characters, controlling the write count for %n B) It discards eight bytes from the stack, moving the target address into the correct position C) It forces the program to allocate eight more bytes on the heap D) It hashes the stack contents before writing Answer: B Explanation: “%08x” consumes an argument from the stack, effectively shifting the stack pointer so that the address intended for %n is correctly positioned. Question 112. Which of the following Windows API calls is commonly used by egghunter shellcode to test whether a memory page is readable? A) NtQuerySystemInformation B) NtReadVirtualMemory C) NtProtectVirtualMemory D) NtAccessCheckAndAuditAlarm Answer: D Explanation: NtAccessCheckAndAuditAlarm can be invoked with minimal parameters to probe a page’s accessibility without causing an exception. Question 113. In IDA Pro, what does the “P” hotkey do when the cursor is on a call instruction?
Question 116. In a 32-bit Windows process, which of the following instructions is typically used to obtain the address of the current function’s return address? A) mov eax, [esp] B) lea eax, [ebp+4] C) pop eax D) push ebp Answer: B Explanation: The return address is located at EBP+4 after the standard function prologue; “lea eax, [ebp+4]” loads its address. Question 117. Which of the following best explains why a “heap spray” is often combined with a “jmp esp” technique? A) The spray ensures that many heap blocks contain the “jmp esp” opcode B) The spray creates many copies of the shellcode, increasing the chance that a corrupted pointer lands on it, while “jmp esp” redirects execution to the stack where the spray can be referenced C) The spray disables DEP, allowing “jmp esp” to work D) The spray automatically patches the IAT to point to “jmp esp” Answer: B Explanation: Heap spraying populates memory with the payload; a separate vulnerability (e.g., a stack overflow using “jmp esp”) provides the execution redirection to that payload. Question 118. Which of the following is a legitimate reason to use the “VirtualProtectEx” API instead of “VirtualProtect” in an exploit? A) To change the protection of memory in a remote process B) To allocate memory that is automatically zero-filled C) To bypass DEP in the current process without a ROP chain D) To retrieve the current protection flags of a memory region Answer: A
Explanation: VirtualProtectEx operates on a handle to another process, useful when the exploit writes into a different process’s address space. Question 119. In a 32-bit Windows binary, which register is typically used to pass the first argument to a function that follows the fastcall convention? A) ECX B) EDX C) EAX D) No register; fastcall does not exist on x Answer: A Explanation: Fastcall passes the first argument in ECX, the second in EDX, with remaining arguments on the stack. Question 120. Which of the following statements about the “!heap -p -a ” WinDbg command is true? A) It prints the allocation stack trace for the heap block at B) It patches the heap block at with NOPs C) It displays the raw bytes of the heap block in ASCII D) It frees the heap block at Answer: A Explanation: “!heap -p -a” shows the backtrace of the allocation that created the specified heap block, useful for forensic analysis. Question 121. In a format-string exploit, why might an attacker use the “%c” specifier before a “%n” write? A) To increment the printed character count by a precise amount, controlling the value written by %n B) To clear the target address from the stack C) To convert the address to a character string D) To cause the program to allocate more memory
C) It forces the program to allocate a new heap block. D) It resets the process’s environment variables. Answer: A Explanation: “%s” treats the corresponding argument as a pointer to a string; if the pointer is controlled, the program may read from an arbitrary address, leading to information leaks or crashes. Question 125. Which WinDbg command can be used to display the current thread’s TLS (Thread Local Storage) array? A) !tls B) !teb C) !thread D) !peb Answer: B Explanation: “!teb” shows the Thread Environment Block, which contains the TLS array for the current thread. Question 126. In a 32-bit Windows exploit, why might an attacker prefer to use a “pop ebp; ret” gadget as part of a stack pivot? A) To restore the original base pointer after the pivot, maintaining stack frame integrity for later calls B) To clear the EFLAGS register C) To disable DEP automatically D) To increment the instruction pointer by two bytes Answer: A Explanation: Restoring EBP helps maintain a valid stack frame, which may be required for subsequent function calls or for the stability of the ROP chain. Question 127. Which of the following is the most direct way to obtain a leak of the stack address in a format-string vulnerable program?
A) Use “%p” repeatedly to print stack values until an address that falls within the process’s stack range is observed B) Use “%n” to write a known value and then read it back C) Trigger an exception and read the exception record D) Call GetCurrentThreadId and interpret the result as an address Answer: A Explanation: By printing stack contents with “%p”, the attacker can locate a value that lies within the known stack memory region, revealing a stack address. Question 128. Which of the following Windows APIs can be used to allocate executable memory without directly calling VirtualProtect? A) VirtualAlloc with PAGE_EXECUTE_READWRITE flag B) HeapCreate with HEAP_EXECUTE flag (available only on Windows 10) C) CreateFileMapping with PAGE_EXECUTE_READWRITE D) All of the above Answer: D Explanation: All listed APIs can allocate memory that is executable, either directly via protection flags or via mapping mechanisms. Question 129. In a 32-bit binary, which instruction sequence would be most useful for aligning ESP after a series of pushes that leave the stack mis-aligned? A) sub esp, 0xC B) add esp, 0x C) and esp, 0xFFFFFFF D) xor esp, esp Answer: C Explanation: “and esp, 0xFFFFFFF0” forces ESP down to the nearest 16-byte boundary, correcting mis-alignment.
Question 133. In IDA Pro, what does the “Shift+F12” shortcut do? A) Jumps to the next occurrence of the current symbol in the disassembly B) Opens the “Search for text” dialog C) Toggles the graph view D) Renames the current function Answer: A Explanation: Shift+F12 moves the cursor to the next reference (cross-reference) of the selected symbol. Question 134. Which Windows API is commonly used by attackers to locate the base address of a module when they have a pointer to an exported function? A) GetModuleHandleA B) GetProcAddress C) VirtualQuery D) None; the base address can be derived by aligning the function pointer down to the nearest 0x1000 boundary Answer: D Explanation: Exported function pointers are inside the module’s image; masking the lower bits (e.g., aligning down to 0x1000) yields the module base address. Question 135. In a 32-bit stack buffer overflow, why might an attacker prefer to overwrite the saved EBP before the saved EIP? A) Overwriting EBP can be used to create a “stack pivot” that changes the location of subsequent reads/writes B) Overwriting EBP disables DEP automatically C) Overwriting EBP triggers a Windows security event log entry D) Overwriting EBP is required to bypass SafeSEH Answer: A Explanation: By controlling EBP, the attacker can manipulate the stack frame and redirect subsequent stack operations to attacker-controlled memory.
Question 136. Which of the following is a typical characteristic of a “ret2dlresolve” technique? A) It abuses the dynamic linker’s resolution process to call arbitrary functions without directly referencing them in the binary B) It directly writes shellcode into the .data section C) It uses a ROP chain to call VirtualProtect D) It relies on the presence of a hard-coded “jmp esp” gadget Answer: A Explanation: “ret2dlresolve” crafts fake ELF/PE structures so that the dynamic loader resolves a function name at runtime, allowing execution of arbitrary code. Question 137. In WinDbg, which command displays the current process’s environment variables? A) !env B) !processenv C) !peb D) !process 0 1 Answer: A Explanation: “!env” lists the environment block for the current process. Question 138. Which of the following is a common way to bypass a “NULL-free” restriction when constructing shellcode? A) Use the “push 0xFFFFFFFF” instruction as a substitute for NULL B) Encode the payload with an XOR encoder that removes NULL bytes at runtime C) Place the shellcode at address 0x0 using VirtualAlloc D) Insert a “jmp 0” instruction at the start of the payload Answer: B Explanation: An encoder transforms the payload to avoid forbidden bytes (including NULL) and decodes it in memory before execution.