
















































































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 register typically holds the base pointer for the current stack frame on x86 Linux? A) ESP B) EBP C) EIP D) EDX Answer: B Explanation: EBP (or RBP on x86-64) is conventionally used as the frame pointer, pointing to the base of the current stack frame. Question 2. In x86-64 calling convention, which register is used to pass the first integer argument to a function? A) RAX B) RBX C) RCX D) RDI Answer: D Explanation: The System V AMD64 ABI passes the first integer/pointer argument in RDI, followed by RSI, RDX, RCX, R8, and R9. Question 3. What does the instruction push ebp do to the stack? A) Decrements ESP by 4 and stores EBP at the new top B) Increments ESP by 4 and stores EBP at the new top C) Copies ESP into EBP D) Swaps the values of ESP and EBP Answer: A Explanation: push ebp decrements ESP by the size of the operand (4 bytes) and writes the value of EBP at the address now pointed to by ESP.
Question 4. Which segment of an ELF binary contains the program’s executable code? A) .data B) .bss C) .text D) .rodata Answer: C Explanation: The .text section holds the compiled executable instructions of a program. Question 5. A “NOP sled” is primarily used to: A) Prevent buffer overflow detection B) Align the stack pointer C) Increase the chance of landing in shellcode after an overflow D) Encode shellcode to bypass filters Answer: C Explanation: A NOP sled is a series of NOP instructions that give the instruction pointer a larger landing zone, improving exploit reliability. Question 6. Which of the following is a typical symptom of a stack canary being overwritten? A) Immediate program crash on function return B) Silent memory corruption without crash C) Increased network latency D) Elevated privileges for the user Answer: A Explanation: Stack canaries are checked on function return; if altered, the program aborts, often resulting in a crash.
Question 10. Which of the following best describes Address Space Layout Randomization (ASLR)? A) Randomly encrypts program code at runtime B) Randomly places stack, heap, and libraries at different virtual addresses each execution C) Forces all binaries to be compiled as Position-Independent Executables (PIE) D) Disables execution of code on the stack Answer: B Explanation: ASLR randomizes the base addresses of memory regions, making it harder for an attacker to predict addresses for exploits. Question 11. In a format string vulnerability, the %n specifier is used to: A) Print a string B) Write the number of bytes printed so far to a memory address C) Read input from the user D) Terminate the program Answer: B Explanation: %n writes the current count of printed characters to the address pointed to by the corresponding argument, enabling arbitrary memory writes. Question 12. Which tool can automatically generate ROP chains from a binary? A) GDB B) pwntools C) ROPgadget D) objdump Answer: C Explanation: ROPgadget scans binaries for instruction sequences ending in ret and helps build ROP chains.
Question 13. The Global Offset Table (GOT) in ELF binaries is primarily used for: A) Storing global variables B) Resolving addresses of external functions at runtime (PLT/GOT mechanism) C) Holding the program’s command-line arguments D) Managing heap allocations Answer: B Explanation: The GOT holds the actual addresses of dynamically linked functions; the PLT uses it to resolve symbols lazily. Question 14. Which of the following is a common technique to bypass DEP (NX) on Windows? A) Using a stack canary B) Overwriting the return address with a system call number C) Return-Oriented Programming (ROP) to call VirtualProtect or similar D) Disabling ASLR via registry edit Answer: C Explanation: ROP can be used to call memory-changing APIs (e.g., VirtualProtect) to make a region executable, bypassing DEP. Question 15. In a 64-bit Linux process, which register holds the system call number before invoking syscall? A) RAX B) RBX C) RCX D) RDX Answer: A Explanation: The system call number is placed in RAX; arguments go in RDI, RSI, RDX, R10, R8, and R9.
question 19. The jmp esp instruction is useful in exploits because: A) It directly calls the system’s random number generator B) It transfers execution to the current stack pointer, where attacker-controlled data may reside C) It disables DEP D) It clears the stack frame Answer: B Explanation: jmp esp redirects execution to the address stored in ESP, often pointing to attacker-controlled shellcode placed on the stack. question 20. Which of the following commands in GDB sets a breakpoint at the entry of the main function? A) break *0x08048400 B) break main C) watch main D) step main Answer: B Explanation: break main creates a breakpoint at the start of the function named main. question 21. When performing a heap overflow on the ptmalloc implementation, which metadata field is most commonly targeted? A) prev_size B) size C) fd (forward pointer) D) bk (backward pointer) Answer: C Explanation: Overwriting the fd pointer can corrupt the free list, leading to arbitrary write primitives during later allocations.
question 22. In a Linux environment, the LD_PRELOAD environment variable can be used to: A) Disable ASLR globally B) Load a shared library before others, allowing function interposition for exploitation C) Set the maximum stack size D) Enable kernel debugging mode Answer: B Explanation: LD_PRELOAD forces the dynamic linker to load a specified library first, enabling attackers to replace functions like system. question 23. Which of the following is NOT a typical characteristic of a Position-Independent Executable (PIE)? A) Base address is randomized at runtime B) Uses relative addressing for code and data C) Requires static linking of all libraries D) Can be loaded at any address without relocation fixes Answer: C Explanation: PIE works with dynamic linking; static linking is not a requirement and actually defeats PIE’s purpose. question 24. In Windows, the CreateProcessA API is commonly used in shellcode to: A) Allocate executable memory B) Spawn a new process, often a command shell C) Modify registry keys D) Disable DEP Answer: B
Explanation: All listed commands can be used to view the value of ESP: info registers esp, print $esp, or examining memory at $esp. question 28. In a format string exploit, what does the %08x specifier typically achieve? A) Prints eight characters B) Prints an 8-byte integer in hexadecimal, consuming stack arguments without revealing them C) Writes 8 bytes to a given address D) Terminates the format string processing Answer: B Explanation: %08x prints an 8-character wide hexadecimal value, allowing the attacker to “walk” the stack to reach a target address. question 29. Which of the following is a common way to bypass a stack canary when the canary value is known? A) Overwrite the canary with zeroes B) Use a format string to read the canary, then include it unchanged in the payload C) Disable the canary via environment variable D) Use a ROP chain that never returns Answer: B Explanation: If the attacker can leak the canary, they can place the exact value back in the payload, preserving the check while still overwriting the return address. question 30. In the context of Windows exploitation, the “partial overwrite” technique primarily targets which field? A) The low 2 or 3 bytes of a return address to redirect execution within a module that has a known base B) The high-order bytes of a pointer to bypass ASLR C) The entire 8-byte address of a function in the IAT
D) The size field of a heap chunk Answer: A Explanation: Partial overwrites modify only the least significant bytes of an address, allowing redirection to a predictable location within a module whose base is known. question 31. Which of the following statements about the .bss section is true? A) It contains initialized global variables B) It is read-only at runtime C) It holds zero-initialized data that does not occupy space in the binary file D) It stores executable code Answer: C Explanation: The .bss segment stores variables that are zero-initialized; the loader allocates space for them but they are not present in the file. question 32. In a Linux exploit, why is it important to identify “bad characters” before building shellcode? A) Bad characters can cause the payload to be truncated or misinterpreted by the vulnerable program B) Bad characters improve the stealth of the payload C) Bad characters are required to align the stack D) Bad characters are used to encode the payload Answer: A Explanation: Certain bytes (e.g., null, newline) may be filtered or cause string termination, breaking the shellcode execution. question 33. Which of the following is a typical use of the pwntools Python library? A) Compiling C code into binaries B) Automating interaction with remote services and generating exploit payloads C) Performing static binary analysis
Answer: A Explanation: The Microsoft x64 calling convention passes the first four integer/pointer arguments in RCX, RDX, R8, and R9. question 37. Which of the following is a common method to bypass ASLR on a 32 - bit Linux binary without PIE? A) Overwrite the stack canary B) Use a return-to-libc attack targeting a known libc address (since libc base is deterministic) C) Perform a format string attack to leak a stack address D) Use a NOP sled to guess the address of shellcode Answer: B Explanation: Non-PIE binaries have fixed code addresses; if libc is loaded at a predictable location, a return-to-libc attack can succeed despite ASLR on the stack/heap. question 38. In the context of heap exploitation, what does “fastbin” refer to? A) A fast-executing system call B) A singly-linked list of small freed chunks used by ptmalloc for quick allocation C) A memory region reserved for stack allocations D) The portion of the heap that stores environment variables Answer: B Explanation: Fastbins are a set of singly-linked lists for small chunk sizes (≤ 0x80) that enable rapid allocation and deallocation. question 39. Which of the following statements about the int 0x80 interrupt on Linux is correct? A) It is used only on x86-64 systems
B) It is the older system call interface for 32-bit Linux, superseded by syscall in x86- 64 C) It cannot be used in user-mode code D) It automatically disables DEP for the calling thread Answer: B Explanation: int 0x80 invokes a system call on 32-bit Linux; x86-64 uses the syscall instruction instead. question 40. Which of the following is the most reliable way to locate the address of system() in a remote binary when ASLR is enabled? A) Guess the address based on known offsets B) Leak a libc address (e.g., via a format string) and compute system() offset C) Use a NOP sled to land on system() D) Overwrite the GOT entry for printf with the address of system() without leaking anything Answer: B Explanation: Leaking any libc symbol address allows calculation of other libc function addresses using known offsets, bypassing ASLR. question 41. Which of the following is true about the .got.plt section in an ELF binary? A) It contains the actual code of all imported functions B) It stores the addresses of imported functions after they are resolved at runtime C) It is used to store global variables only D) It is only present in statically linked binaries Answer: B Explanation: The .got.plt holds the runtime-resolved addresses of functions used via the PLT mechanism. question 42. In Windows, the VirtualAlloc API is commonly used in exploits to:
question 45. In a Linux buffer overflow, why might an attacker need to “find bad characters” before constructing the final payload? A) To ensure the payload does not contain bytes that will be filtered, truncated, or cause premature string termination B) To increase the size of the payload C) To align the stack pointer to a 16-byte boundary D) To encrypt the payload for stealth Answer: A Explanation: Bad characters (e.g., null byte, newline) can break the payload’s delivery or execution. question 46. Which of the following is a typical effect of enabling “Full RELRO” when linking a Linux binary? A) Disables the execution of code on the stack B) Makes the GOT read-only after relocations are resolved, preventing GOT overwrite attacks C) Randomizes the base address of the binary D) Enables stack canaries automatically Answer: B Explanation: Full RELRO resolves relocations at load time and then marks the GOT read-only, mitigating GOT overwrite exploits. question 47. In a Windows SEH exploit, the “pop pop ret” sequence is used to: A) Bypass the SafeSEH list by causing the exception dispatcher to skip validation B) Overwrite the SEH handler with a NOP sled C) Increase the stack size dynamically D) Execute a system call directly Answer: A Explanation: “pop pop ret” discards the overwritten SEH record and returns to attacker-controlled code, bypassing SafeSEH validation.
question 48. Which of the following is the correct order of steps in a typical exploit development lifecycle? A) Payload creation → Vulnerability discovery → Exploit testing → Post-exploitation B) Vulnerability discovery → Fuzzing → Exploit development → Reliability testing → Post-exploitation C) Post-exploitation → Exploit development → Vulnerability discovery → Fuzzing D) Exploit testing → Vulnerability discovery → Payload creation → Fuzzing Answer: B Explanation: The standard flow starts with finding a vulnerability (often via fuzzing), then developing and testing the exploit, ensuring reliability, and finally performing post-exploitation actions. question 49. In the context of Linux, what does the term “PIE” stand for and what is its purpose? A) Position-Independent Executable; allows the binary to be loaded at random addresses, aiding ASLR B) Process-Isolation Environment; sandboxing mechanism C) Program-Integrity Enforcement; checks code signatures at runtime D) Parallel-Instruction Execution; CPU optimization feature Answer: A Explanation: PIE binaries are compiled as position-independent, enabling the loader to place them at random base addresses, enhancing ASLR effectiveness. question 50. Which of the following is the most common reason for a Windows exploit to fail after a successful buffer overflow? A) The presence of a stack canary that was not overwritten correctly B) The target system uses a 64-bit processor C) The attacker used the wrong shellcode architecture D) The process was compiled with /GS (stack protection) enabled
C) VirtualAlloc D) SetThreadContext Answer: A Explanation: GetModuleHandleA retrieves the base address of a module already loaded in the process, useful for calculating offsets. question 54. In a format string vulnerability, the attacker can use %p to: A) Print a pointer value from the stack, aiding in address disclosure B) Write a value to a memory address C) Terminate the program D) Overwrite the return address directly Answer: A Explanation: %p prints a pointer (address) from the stack, helping the attacker leak memory addresses for further exploitation. question 55. Which of the following best describes the purpose of the .rel.plt section? A) Stores relocation entries for the PLT, used at runtime to resolve external symbols B) Contains the executable code for the PLT stubs C) Holds read-only data for the binary D) Provides a table of environment variables Answer: A Explanation: .rel.plt (or .rela.plt on x86-64) contains relocation entries that the dynamic linker processes to resolve PLT entries. question 56. In a 64-bit Linux process, which register holds the return address after a call instruction? A) RSP B) RIP
Answer: B Explanation: RIP (Instruction Pointer) holds the address of the next instruction; after a call, the return address is pushed onto the stack, and execution continues at the callee. question 57. Which of the following is a typical symptom of a successful heap overflow that corrupts the bk pointer of a freed chunk? A) Immediate segmentation fault on free B) Delayed crash when the next allocation occurs, possibly leading to arbitrary write C) Stack canary failure D) Unexpected increase in file descriptor count Answer: B Explanation: Corrupting bk can cause the allocator to write an attacker-controlled value during the next consolidation, leading to an arbitrary write later. question 58. When using gdb to attach to a running process, which command is used? A) run B) attach C) start D) exec Answer: B Explanation: attach tells GDB to connect to the process with the specified PID for debugging. question 59. In Windows, which of the following mechanisms can be used to bypass DEP without ROP? A) Using a signed driver that disables DEP globally