




























































































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 1. Which x86 register contains the address of the next instruction to be executed? A) ESP B) EIP C) EBP D) EDX Answer: B Explanation: EIP (Instruction Pointer) always points to the next instruction; the CPU fetches code from this address. Question 2. In the x86 calling convention __stdcall, who is responsible for cleaning the stack? A) Caller B) Callee C) Operating system D) Compiler Answer: B Explanation: __stdcall specifies that the callee removes the arguments from the stack before returning. Question 3. Which WinDbg command lists all loaded modules in the target process?
A) lm B) bp C) dt D) .exr Answer: A Explanation: The “lm” (list modules) command displays each module’s base address, size, and path. Question 4. What does the WinDbg pseudo‑register “@esp” represent? A) Current stack pointer value B) Base pointer of the current function C) Instruction pointer D) Return address on the stack Answer: A Explanation: “@esp” evaluates to the contents of the ESP register, i.e., the current stack pointer. Question 5. Which breakpoint type can be set on a memory address that is not yet loaded? A) Software breakpoint B) Hardware breakpoint
Answer: A Explanation: “Search for Text” scans the binary for ASCII/Unicode strings, useful for locating messages, URLs, etc. Question 8. Which of the following functions is most commonly associated with stack‑based buffer overflows? A) strcpy B) fopen C) malloc D) strcmp Answer: A Explanation: strcpy copies data without length checking, allowing an attacker to overwrite adjacent stack data. Question 9. When exploiting a stack overflow, the offset to the saved return address is usually found using which technique? A) Pattern create / pattern offset in Metasploit B) Heap spray C) NOP sled D) Return‑oriented programming Answer: A
Explanation: A cyclic pattern helps determine the exact number of bytes needed to reach the saved EIP. Question 10. In a typical SEH overwrite exploit, which part of the overwritten structure is used to redirect execution? A) nSEH (next SEH record) B) SEH handler pointer C) Exception code D) Stack cookie Answer: B Explanation: Overwriting the SEH handler pointer allows the attacker to control where execution jumps when an exception occurs. Question 11. Which instruction sequence is commonly used as a “pop‑pop‑ret” (PPR) gadget? A) pop eax; pop ebx; ret B) pop ebp; pop ebx; ret C) pop esi; pop edi; ret D) pop ecx; pop edx; ret Answer: B Explanation: The “pop ebp; pop ebx; ret” sequence satisfies the two‑pop requirement before returning, making it a classic PPR gadget.
Question 14. When writing position‑independent shellcode, which register is typically used to obtain the current address of the code? A) EAX B) ESP C) EDX D) ESI Answer: D Explanation: A common technique is “call $+5; pop esi” which places the address of the next instruction into ESI, allowing relative addressing. Question 15. Which of the following is a characteristic of NULL‑free shellcode? A) It never contains the byte 0x B) It uses only ASCII characters C) It is limited to 200 bytes D) It runs only on 64‑bit systems Answer: A Explanation: NULL bytes terminate C‑style strings; avoiding 0x00 ensures the payload isn’t truncated when injected. Question 16. Data Execution Prevention (DEP) primarily protects which memory region?
A) Stack only B) Heap only C) All non‑executable pages (e.g., stack, heap) D) Code segment only Answer: C Explanation: DEP marks pages as non‑executable, preventing code execution from data regions like the stack or heap. Question 17. In Return‑Oriented Programming, a “gadget” is defined as: A) A full function call B) A short instruction sequence ending in a ret C) A NOP sled D) A memory leak primitive Answer: B Explanation: Gadgets are small snippets of existing code that end with a ret instruction, which can be chained together. Question 18. Which Win32 API is commonly called via a ROP chain to make a memory region executable? A) VirtualProtect B) HeapCreate
Answer: C Explanation: The PEB contains a linked list of loaded modules with their base addresses, accessible via WinDbg or code. Question 21. A “write‑what‑where” primitive is essential for which exploitation step? A) Information leakage B) Stack pivoting C) Overwriting a function pointer or SEH handler D) Bypassing DEP Answer: C Explanation: “Write‑what‑where” lets the attacker write arbitrary data (e.g., a new address) to an arbitrary location, enabling control‑flow hijack. Question 22. In a format‑string vulnerability, the specifier “%n” is used to: A) Print an integer B) Read a string from the stack C) Write the number of bytes printed so far to a memory address D) Flush the output buffer Answer: C Explanation: “%n” stores the current byte count into the address supplied as an argument, providing an arbitrary write primitive.
Question 23. When exploiting a format string to leak a stack address, which specifier is most appropriate? A) %x B) %s C) %p D) %c Answer: C Explanation: “%p” prints a pointer value (usually in hexadecimal), revealing addresses from the stack. Question 24. Which of the following is a reliable source of ROP gadgets on a typical Windows 7 system? A) ntdll.dll (non‑ASLR) B) kernel32.dll (ASLR) C) user32.dll (ASLR) D) msvcrt.dll (ASLR) Answer: A Explanation: Older versions of ntdll.dll are often compiled without ASLR, making their addresses predictable for gadget extraction. Question 25. In WinDbg, the command “!process 0 1” is used to:
C) Overwrite the stack canary D) Corrupt the SEH chain Answer: B Explanation: Heap spraying fills the heap with copies of the payload, increasing the chance that a later overflow lands on the shellcode. Question 28. Which instruction is commonly used in an egghunter to safely probe memory pages? A) int 0x2e B) inc eax C) or dx, 0x0FFF D) access violation handling via SEH (e.g., “push 0xFFFFFFFF; pop eax”) Answer: D Explanation: Egghunters often use a try‑except (SEH) wrapper to catch access violations when probing non‑readable pages. Question 29. In the context of shellcode, what does “API resolution” refer to? A) Determining the function’s calling convention B) Finding the memory address of required Windows APIs at runtime C) Encrypting the payload with a known key D) Allocating memory for the shellcode
Answer: B Explanation: API resolution is the process of locating function addresses (e.g., via GetProcAddress) so the shellcode can invoke them. Question 30. Which WinDbg command displays the current call stack of the selected thread? A) k B) lm C) dt D) .exr Answer: A Explanation: The “k” (stack backtrace) command prints the call stack frames for the current thread. Question 31. What is the primary purpose of a “stack pivot” in exploit development? A) Increase the size of the stack B) Move the stack pointer to a controlled buffer for ROP chaining C) Disable DEP D) Leak the stack canary Answer: B
Question 34. Which opcode is typically used to perform a “jmp esp” instruction, useful for stack‑based code execution? A) FF E B) 68 90 90 90 90 C) C D) 90 90 90 90 Answer: A Explanation: “FF E4” is the machine code for “jmp esp”, often searched for in binaries to redirect execution to the stack. Question 35. What does the WinDbg pseudo‑register “@eip” display? A) The current value of ESP B) The address of the next instruction to execute C) The base address of the loaded module D) The size of the stack frame Answer: B Explanation: “@eip” evaluates to the contents of the EIP register, i.e., the instruction pointer. Question 36. Which of the following is NOT a typical gadget classification in ROP?
A) “pop reg; ret” B) “mov reg, reg; ret” C) “jmp eax” D) “xor reg, reg; ret” Answer: C Explanation: “jmp eax” does not end with a ret, so it cannot be used as a standard ROP gadget (which must return). Question 37. In the context of SEH exploitation, what does “nSEH” stand for? A) Next SEH record pointer stored on the stack B) New Stack Execution Handler C) Non‑standard Exception Handler D) Null SEH pointer Answer: A Explanation: nSEH is the “next SEH” pointer that links to the previous record in the exception chain. Question 38. Which Windows API can be used to allocate executable memory from within shellcode? A) HeapAlloc B) VirtualAlloc
Answer: C Explanation: “%hn” writes the number of bytes printed so far to a 2‑byte (short) location. Question 41. Which WinDbg command can be used to set a hardware breakpoint on memory address 0x00401000? A) bp 0x B) ba e 1 0x C) bu 0x D) bc 0x Answer: B Explanation: “ba e 1 0x00401000” sets a hardware breakpoint for execution (e) of size 1 byte at the specified address. Question 42. What does the “.exr - 1” command display in WinDbg? A) The most recent exception record B) All loaded modules C) The current registers D) The stack trace of the current thread Answer: A Explanation: “.exr - 1” prints the exception record for the last exception that occurred.
Question 43. In IDA, which shortcut opens the “Names” window listing all identified symbols? A) Shift+F B) Ctrl+F C) Alt+N D) Ctrl+S Answer: A Explanation: Shift+F12 opens the Names window, where functions, variables, and other symbols are listed. Question 44. Which of the following is a common way to bypass DEP without using ROP? A) Using a JIT‑compiled script (e.g., JavaScript) that can execute data as code B) Overwriting the stack canary C) Disabling DEP via the registry D) Using a format‑string vulnerability Answer: A Explanation: JIT engines (e.g., in browsers) allocate executable pages for generated code, allowing attacker‑controlled data to be executed.