




























































































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 return address on the x86‑ 64 calling convention? A) RAX B) RBX C) RSP D) RIP Answer: D Explanation: In the System V AMD64 ABI, the instruction pointer (RIP) holds the return address after a call instruction pushes it onto the stack; the CPU jumps to the address in RIP when returning. Question 2. In little‑endian representation, the 32‑bit value 0x12345678 is stored in memory as: A) 12 34 56 78 B) 78 56 34 12 C) 34 12 78 56 D) 56 78 12 34 Answer: B Explanation: Little‑endian stores the least‑significant byte first, so 0x78 is at the lowest address, followed by 0x56, 0x34, and 0x12. Question 3. Which of the following is the primary purpose of a stack canary? A) Detect heap corruption
B) Detect buffer overflows on the stack C) Randomize library addresses D) Prevent code injection Answer: B Explanation: A stack canary is a known value placed before the return address; if a stack buffer overflow overwrites it, the program detects the change and aborts. Question 4. The most common calling convention on 32‑bit Windows is: A) cdecl B) stdcall C) fastcall D) thiscall Answer: B Explanation: The Microsoft __stdcall convention passes arguments on the stack and callee cleans the stack, which is the default for WinAPI functions. Question 5. Which of the following memory regions is typically marked as non‑executable on modern OSes? A) .text B) .data C) .bss
Explanation: UAF occurs when a program continues to use a pointer after the underlying memory has been returned to the allocator. Question 8. The primary difference between a double‑free and a use‑after‑free is: A) Double‑free occurs on the stack, UAF on the heap B) Double‑free frees the same pointer twice, UAF reads/writes after a free C) Double‑free is mitigated by ASLR, UAF is not D) Double‑free only affects Windows, UAF only affects Linux Answer: B Explanation: Double‑free re‑invokes free() on the same pointer, while UAF uses a dangling pointer after a single free. Question 9. Which instruction sequence is commonly used as a “NOP sled” in shellcode on x86? A) jmp 0x0 B) inc eax C) xor eax, eax D) nop Answer: D Explanation: The nop (0x90) instruction does nothing and allows the instruction pointer to slide into the actual shellcode payload.
Question 10. To generate alphanumeric shellcode on x86, which of the following techniques is most useful? A) Using push with immediate values containing only alphanumerics B) Encoding with XOR and a decoder stub that uses only alphanumeric bytes C) Using int 0x80 directly D) Using jmp instructions exclusively Answer: B Explanation: Alphanumeric encoders transform arbitrary bytes into alphanumeric characters and prepend a small decoder stub that also respects the character set. Question 11. Which of the following is a common way to bypass DEP on Windows without ROP? A) Return-to-libc B) Heap spraying of executable pages C) Using VirtualProtect via a known function pointer D) Overwriting the stack canary Answer: C Explanation: If an attacker can control a function pointer, they can call VirtualProtect (or VirtualAlloc) to mark memory as executable, then jump to shellcode. Question 12. In a Return‑Oriented Programming (ROP) chain, a “gadget” is defined as:
C] Bypass stack canaries D) Disable ASLR completely Answer: B Explanation: By overwriting only the low bytes, the attacker can redirect execution to an address that shares the high‑order bytes (e.g., within the same library), useful when full address control is impossible. Question 15. Which of the following is a reliable method to leak a libc address on a Linux binary with PIE disabled? A) Reading /proc/self/maps via a format string B) Using an uninitialized global variable that contains a libc pointer C) Overwriting the GOT entry of printf D) Triggering a segmentation fault and reading the core dump Answer: B Explanation: An uninitialized global that inadvertently holds a libc pointer can be read to disclose an address, aiding ASLR bypass. Question 16. The Global Offset Table (GOT) is primarily used for: A) Storing function pointers for dynamically linked symbols B) Holding environment variables C) Managing heap metadata D) Implementing stack canaries
Answer: A Explanation: The GOT contains resolved addresses of external functions; the PLT uses it to jump to the correct library routine. Question 17. Which of the following is a typical first step in exploiting a use‑after‑free in the Linux kernel? A) Overwrite the fs segment register B) Spray the kernel heap with controlled objects C) Disable SELinux D) Modify the IDT Answer: B Explanation: Kernel heap spraying fills freed slots with attacker‑controlled data, increasing the chance that a dangling pointer will reference malicious content. Question 18. In Windows Structured Exception Handling (SEH), the “nseh” field points to: A) The next exception registration record B) The exception handler function C) The saved EIP value D) The stack canary Answer: B
Question 21. Which of the following is a typical way to escape a Docker container? A) Overwrite the host’s /etc/passwd file from inside the container B) Exploit a privileged mount (e.g., bind‑mounting / with --privileged) C) Use a kernel vulnerability that gives access to host resources D) Modify the container’s network namespace Answer: C Explanation: Container escapes often rely on kernel bugs that let the attacker break out of namespace isolation and interact with the host. Question 22. In Windows, the “token stealing” technique for LPE primarily manipulates which structure? A) The Process Environment Block (PEB) B) The Security Identifier (SID) list C) The access token associated with the process D) The Registry hive for services Answer: C Explanation: Token stealing replaces the current process’s token with a higher‑privilege token (e.g., SYSTEM), granting elevated rights. Question 23. Which of the following is a common way to achieve kernel‑mode code execution on Linux via a race condition? A) Exploiting a TOCTOU bug in /proc file handling
B) Overwriting the init_module system call pointer C) Using a dangling pointer in a network driver’s buffer handling D) Modifying the syscall table directly Answer: C Explanation: Race conditions in drivers can allow an attacker to replace a buffer with malicious data while the kernel still references the original pointer. Question 24. The ptmalloc2 heap allocator uses which of the following metadata fields for each chunk? A) size, prev_size, fd, bk B) next, prev, type C) magic, checksum D) flags, refcount Answer: A Explanation: ptmalloc2 stores the chunk size, previous chunk size (if free), and forward/backward pointers for free list management. Question 25. In ARM 64‑bit (AArch64) assembly, which register is used as the link register for function returns? A) X B) X C) X
Explanation: By providing an explicit format string, the user input cannot be interpreted as format specifiers. Question 28. In a Linux binary compiled with PIE, which of the following statements is true? A) The base address of the executable is fixed at 0x B) All code addresses are randomized at load time C) The GOT is disabled D) Stack canaries are automatically disabled Answer: B Explanation: Position‑Independent Executables (PIE) are loaded at a random base address, making code addresses unpredictable. Question 29. Which of the following tools is commonly used to generate ROP gadgets automatically? A) GDB B) objdump C) ROPgadget D) strace Answer: C Explanation: ROPgadget scans binaries and libraries to list instruction sequences ending in ret or other control‑transfer instructions.
Question 30. The “shadow stack” mitigation in Windows primarily protects against: A) Buffer overflows on the heap B) Return address overwrites on the regular call stack C) Code injection via DLL loading D) ASLR bypasses Answer: B Explanation: The shadow stack maintains a protected copy of return addresses, detecting tampering with the normal call stack. Question 31. Which of the following is a typical way to achieve a “write‑what‑where” primitive on Windows using a vulnerable driver? A) Overwrite the IAT entry of LoadLibraryA B) Use DeviceIoControl with a malformed IOCTL that copies user data to an arbitrary kernel address C) Exploit a DLL search order hijacking D) Manipulate the registry key for ImagePath Answer: B Explanation: Many vulnerable drivers expose IOCTLs that copy user‑supplied buffers into kernel memory without proper validation, enabling arbitrary writes. Question 32. In a JIT‑compiled JavaScript engine, which mitigation helps prevent arbitrary native code execution?
C) Section header table D) Relocation entries in .data Answer: B Explanation: ret2dlresolve crafts fake relocation structures to force the dynamic linker to resolve an attacker‑controlled symbol at runtime. Question 35. Which of the following is the most reliable way to bypass ASLR on a 64‑bit Linux system without a memory leak? A) Brute‑force address guesses B) Use a kernel information leak to obtain the base address of a shared library C) Overwrite the stack canary D) Disable SELinux Answer: B Explanation: Obtaining a leaked address (e.g., via an info‑leak) reveals the base of a library, allowing calculation of other addresses despite ASLR. Question 36. In Windows, the “Event Tracing for Windows (ETW)” feature can be abused to: A) Bypass DEP B) Leak kernel addresses via uninitialized buffers C) Elevate privileges through token duplication D) Disable UAC
Answer: B Explanation: Certain ETW APIs expose uninitialized kernel memory to user space, providing address leaks useful for ASLR bypass. Question 37. Which of the following best describes a “sandbox escape” in the context of a web browser? A) Using a cross‑site scripting (XSS) payload to steal cookies B) Exploiting a memory corruption bug to execute code outside the browser’s process C) Performing a clickjacking attack D) Manipulating the DOM to hide elements Answer: B Explanation: A sandbox escape involves breaking out of the browser’s restricted execution environment, typically via a memory corruption vulnerability. Question 38. Which of the following is a typical characteristic of a “null‑byte free” shellcode payload? A) Uses only printable ASCII characters B) Avoids the byte 0x00 to prevent string termination issues C) Is always less than 100 bytes D) Relies on the int 0x80 syscall interface Answer: B
Question 41. The primary purpose of the seccomp filter in Linux is to: A) Encrypt network traffic B) Restrict system calls a process may invoke C) Randomize memory layout D) Provide kernel-level debugging information Answer: B Explanation: seccomp allows a process to define a whitelist of allowed syscalls, reducing the attack surface. Question 42. Which of the following is the most effective way to mitigate integer overflow vulnerabilities in C code? A) Use unsigned integers exclusively B) Perform explicit bounds checking before arithmetic operations C) Compile with -fstack-protector D) Enable ASLR Answer: B Explanation: Explicit checks ensure that arithmetic does not wrap around, preventing overflow/underflow bugs. Question 43. In a Windows PE file, the Import Address Table (IAT) is used to: A) Store the entry point of the executable B) Resolve addresses of imported functions at load time
C) Hold the list of exported symbols D) Define the section alignment Answer: B Explanation: The IAT contains pointers that the loader fills with the actual addresses of imported functions from DLLs. Question 44. Which of the following is a typical symptom of a successful stack‑based buffer overflow exploitation attempt? A) The program prints “Segmentation fault” and exits B) The program crashes after returning from the vulnerable function, possibly executing attacker‑controlled code C) The process silently continues with corrupted data D) The kernel panics Answer: B Explanation: Overwriting the return address causes control flow to jump to attacker‑controlled code when the function returns. Question 45. The __attribute__((optimize("O0"))) directive in GCC is sometimes used by exploit developers to: A) Disable all compiler optimizations for a function, making it easier to predict register usage B) Enable stack canaries C) Force the function to be inlined