



















































































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. What does the “breakpoint” command in GDB primarily do? A) Modify the source code at runtime B) Pause program execution when a specific address is reached C) Change the value of a register automatically D) Dump the entire memory of the process Answer: B Explanation: A breakpoint tells GDB to stop the program when the instruction pointer reaches the specified address, allowing inspection of registers, memory, and stack. Question 2. In WinDbg, which command displays the contents of the stack pointer register? A) !reg B) dd esp C) r esp D) kv Answer: C Explanation: The r command prints register values; r esp shows the current value of the stack pointer. Question 3. Which register holds the return address after a CALL instruction on x86‑64? A) RAX B) RBX C) RIP D) RSP Answer: C Explanation: The CALL instruction pushes the next instruction address onto the stack and then jumps; the CPU uses RIP (instruction pointer) to fetch the next instruction.
Question 4. What is the typical purpose of the function prologue in x86 assembly? A) To allocate heap memory B) To save callee‑saved registers and set up the stack frame C) To perform arithmetic operations D) To load immediate values into EAX Answer: B Explanation: The prologue usually pushes EBP, moves ESP to EBP, and allocates space for local variables, preserving the caller’s environment. Question 5. Which segment of an ELF binary contains the executable code? A) .data B) .bss C) .text D) .rodata Answer: C Explanation: The .text segment stores the compiled machine instructions that the loader maps as executable. Question 6. During execution, where are global variables typically stored in a PE file? A) Stack segment B) Heap segment C) .data section D) .text section Answer: C
Answer: C Explanation: Overwriting EIP (instruction pointer) redirects execution to attacker‑controlled code. Question 10. Which format‑string specifier writes the number of bytes printed so far to a memory address? A) %x B) %p C) %s D) %n Answer: D Explanation: %n stores the count of characters output up to that point into the supplied pointer argument. Question 11. What mitigation does NX (No‑Execute) provide? A) Prevents writing to read‑only sections B) Disallows execution of code on data pages such as the stack C) Randomizes base addresses of libraries D) Adds a canary value before buffers Answer: B Explanation: NX marks certain memory regions as non‑executable, stopping shellcode placed on the stack or heap. Question 12. In a ret2libc attack, which function is most commonly used to spawn a shell? A) printf B) strcpy
C) system D) memcpy Answer: C Explanation: system("/bin/sh") invokes the shell; the attacker redirects execution to this libc function. Question 13. Which of the following is a prerequisite for building a reliable ROP chain? A) Presence of a JIT compiler B) Availability of “pop; ret” gadgets in a non‑ASLR module C) A large stack canary D) Disabled DEP Answer: B Explanation: “pop; ret” gadgets allow the attacker to control registers and stack values; non‑ASLR modules provide stable addresses. Question 14. What does PIE stand for in Linux binaries? A) Position‑Independent Executable B) Protected Intel Encryption C) Process‑Isolation Engine D) Pre‑Initialized Entry Answer: A Explanation: PIE binaries are compiled to be relocatable, enabling ASLR to randomize the base address. Question 15. How can an attacker bypass a stack canary? A) Overwrite the canary with the correct value after leaking it
Question 18. In SEH exploitation, what does the “POP POP RET” sequence accomplish? A) It clears the stack of all arguments B) It forces the exception dispatcher to continue execution at a controlled address C) It disables DEP permanently D) It overwrites the stack canary automatically Answer: B Explanation: POP POP RET removes the SEH record from the stack and returns to an attacker‑controlled address, bypassing the handler. Question 19. Which Windows protection mechanism checks that a target address is within a known safe module before indirect calls? A) SafeSEH B) CFG (Control Flow Guard) C) DEP D) ASLR Answer: B Explanation: CFG validates indirect call/jump targets against a whitelist of known safe locations. Question 20. What does the term “null‑byte free shellcode” refer to? A) Shellcode that does not contain any 0x00 bytes, which could truncate strings B) Shellcode that runs without using the NULL pointer C) Shellcode that is encrypted with a null cipher D) Shellcode that only uses the null register (R0) Answer: A Explanation: Null bytes often terminate C strings; avoiding them ensures the payload is not cut off during transmission.
Question 21. Which msfvenom option adds a polymorphic encoder to the generated payload? A) - p B) - e C) - b D) - f Answer: B Explanation: The -e flag selects an encoder, making the payload harder to detect by signatures. Question 22. When reusing an existing socket for a reverse shell, which system call is typically invoked first? A) socket() B) connect() C) dup2() D) bind() Answer: C Explanation: dup2 redirects standard input/output to the already‑opened socket, allowing the shell to communicate over it. Question 23. What is the main advantage of a staged payload over an inline payload? A) Staged payloads require no network connectivity B) Staged payloads are smaller initially, evading size‑based filters, and fetch a larger second stage later C) Staged payloads automatically bypass DEP without ROP D) Staged payloads are always null‑byte free
B) The output format (binary, exe, etc.) C) The target architecture D) The payload encoder Answer: A Explanation: -b lists bytes that must not appear in the generated shellcode, such as null bytes. Question 27. Which GDB command can be used to view the call stack? A) info registers B) backtrace C) disassemble D) list Answer: B Explanation: backtrace (or bt) prints the function call stack, showing return addresses and arguments. Question 28. In a 64‑bit Windows process, which register typically holds the first function argument? A) RCX B) RDX C) R D) R Answer: A Explanation: The Microsoft x64 calling convention passes the first integer/pointer argument in RCX. Question 29. What is the effect of the “-f” flag in msfvenom?
A) Sets the output format (e.g., raw, exe, c) B) Forces the use of a specific function name C) Filters out bad characters automatically D) Enables fast encoding mode Answer: A Explanation: -f defines how the generated payload is presented (raw binary, C source, etc.). Question 30. Which of the following best describes a “gadget” in ROP? A) A small piece of reusable code ending with a RET instruction B) An encryption routine used to hide shellcode C) A kernel driver that assists exploitation D) A memory allocation routine in libc Answer: A Explanation: Gadgets are short instruction sequences that end with RET, allowing attackers to chain them for arbitrary computation. Question 31. What does the term “heap spraying” refer to? A) Filling the stack with NOPs to increase reliability B) Allocating many objects with identical content to increase the chance of hitting shellcode C) Overwriting the heap metadata to cause a use‑after‑free D) Randomizing heap addresses to prevent exploitation Answer: B Explanation: Heap spraying creates many copies of a payload in memory, raising the probability that a corrupted pointer lands on it.
Explanation: The canary value is checked before returning; if altered, the program aborts, indicating a possible overflow. Question 35. Which instruction sequence is typically used to align the stack pointer on a 16 ‑byte boundary in x86‑64? A) sub rsp, 0x B) and rsp, - 0x C) xor rsp, rsp D) lea rsp, [rsp-0x10] Answer: B Explanation: and rsp, - 0x10 clears the lower 4 bits, aligning RSP to a 16‑byte boundary required by the ABI. Question 36. When analyzing a PE file, which directory entry points to the Import Table? A) .text B) .rsrc C) IMAGE_DIRECTORY_ENTRY_IMPORT D) IMAGE_DIRECTORY_ENTRY_BASERELOC Answer: C Explanation: The Import Table address is stored in the IMAGE_DIRECTORY_ENTRY_IMPORT field of the PE optional header. Question 37. What does the “-p” option in msfvenom specify? A) Payload to generate (e.g., windows/meterpreter_reverse_tcp) B) Platform (linux, windows) C) Port number for the reverse shell
D) Preferred encoding method Answer: A Explanation: -p selects the desired payload module. Question 38. Which of the following is a typical sign that a program is compiled with Stack Protector enabled? A) Presence of “__stack_chk_fail” in the binary B) Absence of .got section C) Executable flag set on the .data segment D) Use of “jmp esp” gadgets only Answer: A Explanation: The compiler inserts a call to __stack_chk_fail when the canary check fails. Question 39. In a format‑string exploit, what does “%7$x” do? A) Prints the 7th argument as a hexadecimal value B) Writes the 7th argument to memory C) Prints 7 spaces D) Reads 7 bytes from the stack Answer: A Explanation: %7$x accesses the seventh parameter on the stack and prints it in hex. Question 40. Which of the following is NOT a typical step in the exploit development lifecycle? A) Fuzzing to discover crashes B) Writing a full‑featured GUI for the target application
B) Forces immediate resolution of all symbols (no lazy binding) C) Disables ASLR for the binary D) Strips all debugging symbols Answer: B Explanation: -z,now resolves all PLT entries at load time, preventing certain GOT‑overwrite techniques. Question 44. Which Windows exception code indicates an access violation? A) 0xC B) 0x C) 0xC D) 0xC000001D Answer: A Explanation: 0xC0000005 is the NTSTATUS code for an access violation (read/write to invalid memory). Question 45. What does the “jmp esp” instruction commonly enable for an attacker? A) Direct execution of shellcode placed on the stack B) Bypass of DEP by changing page permissions C) Overwrite of the stack canary D) Automatic heap grooming Answer: A Explanation: jmp esp transfers control to the address pointed to by ESP, which often contains attacker‑controlled shellcode. Question 46. In a 64‑bit Linux binary, which register holds the syscall number?
Answer: A Explanation: The syscall number is placed in RAX before invoking the syscall instruction. Question 47. Which tool is primarily used for fuzzing network protocols? A) GDB B) AFL C) Burp Suite D) WinDbg Answer: C Explanation: Burp Suite includes a scanner and fuzzer for HTTP/HTTPS traffic, making it suitable for network protocol fuzzing. Question 48. What does the “-g” option in msfvenom control? A) The size of the generated payload in bytes B) The number of bad characters to exclude C) The number of NOP sled bytes to prepend D) The architecture (x86, x64) Answer: C Explanation: -g specifies a “guard” of NOPs (or a specific pattern) before the payload. Question 49. Which of the following best describes “Control Flow Guard (CFG)”?
Question 52. Which of the following is a typical symptom of a successful format‑string exploit that overwrites a GOT entry? A) The program crashes with a segmentation fault on startup B) The program prints the contents of the stack repeatedly C) The program redirects execution to attacker‑controlled code when the overwritten function is called D) The program’s heap usage spikes dramatically Answer: C Explanation: Overwriting a GOT entry changes the address a function call jumps to, allowing redirection to malicious code. Question 53. In the context of ROP, what does “stack pivot” refer to? A) Changing the base pointer (EBP) to a controlled location B) Overwriting the return address with a gadget that sets RSP to a location chosen by the attacker C) Using a different thread’s stack for execution D) Aligning the stack to a 32‑byte boundary Answer: B Explanation: A stack pivot gadget (e.g., “xchg esp, eax; ret”) redirects the stack pointer to attacker‑controlled data, enabling the ROP chain. Question 54. Which Linux kernel feature can be disabled to simplify exploitation of kernel vulnerabilities? A) SELinux B) AppArmor C) Kernel Address Space Layout Randomization (KASLR)
D) Control Groups (cgroups) Answer: C Explanation: Disabling KASLR removes randomization of kernel memory addresses, making it easier to predict gadget locations. Question 55. What does the “-o” option in msfvenom specify? A) Output file name B) Optimization level for the payload C) Overwrite mode for existing files D) Operating system target Answer: A Explanation: -o defines the path and name of the generated output file. Question 56. Which register is used to pass the second argument to a function in the Microsoft x64 calling convention? A) RCX B) RDX C) R D) R Answer: B Explanation: The second integer/pointer argument is placed in RDX. Question 57. In a Windows PE file, what is the purpose of the “Relocation Table”? A) Store import addresses for DLL functions B) Provide addresses that must be adjusted when the image is loaded at a non‑preferred base