Docsity

Spyder Forensics Kernel Programming Exploitation Exam, Exams of Technology

Toggle sidebar
bg1
Spyder Forensics Kernel Programming Exploitation
Exam
**Question 1.** Which CPU privilege level corresponds to user‑mode code execution in Windows?
A) Ring 0
B) Ring 1
C) Ring 2
D) Ring 3
Answer: D
Explanation: Windows places user‑mode applications in Ring 3, the least‑privileged execution level,
while kernel code runs in Ring 0.
**Question 2.** What mechanism does Windows use to transfer control from user mode to kernel
mode for system services?
A) Interrupt Vector Table (IVT)
B) System Service Descriptor Table (SSDT)
C) Global Descriptor Table (GDT)
D) Interrupt Descriptor Table (IDT)
Answer: B
Explanation: The SSDT holds pointers to kernel routines that implement system calls; the
`syscall`/`sysenter` instructions index this table to switch to kernel mode.
**Question 3.** In the EPROCESS structure, which member holds the pointer to the process token?
A) Token
B) UniqueProcessId
C) ActiveProcessLinks
D) Pcb
Answer: A
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f

Partial preview of the text

Download Spyder Forensics Kernel Programming Exploitation Exam and more Exams Technology in PDF only on Docsity!

Exam

Question 1. Which CPU privilege level corresponds to user‑mode code execution in Windows? A) Ring 0 B) Ring 1 C) Ring 2 D) Ring 3 Answer: D Explanation: Windows places user‑mode applications in Ring 3, the least‑privileged execution level, while kernel code runs in Ring 0. Question 2. What mechanism does Windows use to transfer control from user mode to kernel mode for system services? A) Interrupt Vector Table (IVT) B) System Service Descriptor Table (SSDT) C) Global Descriptor Table (GDT) D) Interrupt Descriptor Table (IDT) Answer: B Explanation: The SSDT holds pointers to kernel routines that implement system calls; the syscall/sysenter instructions index this table to switch to kernel mode. Question 3. In the EPROCESS structure, which member holds the pointer to the process token? A) Token B) UniqueProcessId C) ActiveProcessLinks D) Pcb Answer: A

Exam

Explanation: The Token field in _EPROCESS stores the security token representing the process’s privileges. Question 4. Which field of the ETHREAD structure identifies the thread’s previous mode (User or Kernel)? A) StartAddress B) Teb C) PreviousMode D) KernelStack Answer: C Explanation: PreviousMode indicates whether the thread was entered from user mode (User) or kernel mode (Kernel), influencing security checks. Question 5. What is the primary purpose of the KPRCB structure? A) Store per‑process information B) Manage I/O request packets C) Represent a processor’s control block D) Hold the list of loaded drivers Answer: C Explanation: The Kernel Processor Control Block (KPRCB) contains per‑CPU data such as the current thread, interrupt counts, and scheduler information. Question 6. Which of the following is true about a Page Table Entry (PTE) on x64 Windows? A) It always maps a 4 KB page B) The Present bit indicates if the page is resident in physical memory C) The Dirty bit is only used for user‑mode pages

Exam

B) Providing per‑process isolation C) Enabling executable code in the pool D) Supporting user‑mode allocation of kernel memory Answer: A Explanation: The Segment Heap groups allocations into segments, reducing internal fragmentation and improving allocation speed for many small objects. Question 10. Which SSDT hooking technique replaces a function pointer in the SSDT with a custom routine? A) Inline hooking B) Import Address Table (IAT) patching C) Direct SSDT patching D) VTable hooking Answer: C Explanation: Direct SSDT patching modifies the function pointer entry in the SSDT to point to attacker‑controlled code. Question 11. In a WDM driver, which routine is called when the driver is first loaded? A) DriverUnload B) DriverEntry C) AddDevice D) DispatchCreate Answer: B Explanation: DriverEntry is the mandatory entry point executed during driver loading to initialize driver objects.

Exam

Question 12. Which IRP major function code is used for creating or opening a handle to a device object? A) IRP_MJ_READ B) IRP_MJ_WRITE C) IRP_MJ_CREATE D) IRP_MJ_DEVICE_CONTROL Answer: C Explanation: IRP_MJ_CREATE handles requests to open a handle to a device, similar to CreateFile in user mode. Question 13. When a driver receives an IRP_MJ_DEVICE_CONTROL request, which structure contains the IOCTL code? A) IO_STACK_LOCATION::Parameters.DeviceIoControl.IoControlCode B) IRP::AssociatedIrp.SystemBuffer C) DRIVER_OBJECT::DriverExtension D) DEVICE_OBJECT::DeviceExtension Answer: A Explanation: The IO_STACK_LOCATION for the IRP holds the IoControlCode field that identifies the specific IOCTL operation. Question 14. Which of the following is the correct way for a driver to signal that it has completed processing an IRP? A) Return STATUS_PENDING without further action B) Call IoCompleteRequest(IRP, IO_NO_INCREMENT) C) Set IRP->IoStatus.Status = STATUS_SUCCESS and return STATUS_SUCCESS D) Delete the IRP using ExFreePool

Exam

C) Interrupt Output Command List D) Inter‑OS Communication Transaction Layer Answer: A Explanation: IOCTL stands for Input/Output Control, a mechanism for sending commands from user mode to drivers. Question 18. Which of the following best describes a “write‑what‑where” primitive in kernel exploitation? A) Overwriting the CR0 register to disable write protection B) Controlling both the data to write and the destination address in kernel memory C) Using a null‑pointer dereference to read kernel memory D) Leveraging a stack buffer overflow to execute shellcode Answer: B Explanation: A “write‑what‑where” vulnerability lets an attacker specify arbitrary data and an arbitrary kernel address to write that data to. Question 19. Which kernel object is typically targeted to achieve token stealing? A) _KTHREAD B) _EPROCESS C) _KAPC_STATE D) _OBJECT_DIRECTORY_ENTRY Answer: B Explanation: The attacker locates the Token field inside the _EPROCESS of the System process and copies it to the current process’s token.

Exam

Question 20. Which of the following techniques is used to discover undocumented IOCTL codes in a driver? A) Static analysis of the driver’s PE export table B) Hooking the SSDT to intercept all system calls C) Fuzzing the device with random IOCTL values and monitoring responses D) Using Process Explorer to view driver properties Answer: C Explanation: IOCTL fuzzing sends random or semi‑random control codes to the driver to observe crashes or abnormal behavior, revealing hidden IOCTLs. Question 21. What does the “PreviousMode” field in the KTHREAD structure influence? A) The scheduling priority of the thread B) Whether kernel‑mode checks allow user‑mode pointers C) The size of the thread’s stack D) The affinity mask for the thread Answer: B Explanation: PreviousMode tells the kernel if the current call originated from user mode, guiding validation of user‑supplied pointers. Question 22. Which of the following is a symptom of a pool overflow vulnerability? A) Immediate blue screen of death (BSOD) on driver load B) Corruption of adjacent pool allocations leading to object type confusion C. Failure to allocate memory from the non‑paged pool D) Inability to open a handle to the device Answer: B

Exam

D. To bypass PatchGuard by overwriting its structures Answer: B Explanation: Pool spraying allocates many objects of a known size with attacker‑controlled contents, shaping the heap layout for later exploitation. Question 26. Which Windows security feature randomizes the base address of the kernel image at boot time? A) SMEP B) KASLR C) PatchGuard D) CFG Answer: B Explanation: Kernel Address Space Layout Randomization (KASLR) moves the kernel’s load address to make static address references unreliable. Question 27. How can an attacker bypass SMEP to execute user‑mode shellcode in kernel mode? A) By modifying the CR0 register to disable write protection B) By setting the EFER.SVME bit C) By clearing the SMEP bit in CR4 (bit 20) D) By patching the SSDT entry for NtCreateFile Answer: C Explanation: SMEP is controlled by CR4’s bit 20; clearing it allows kernel mode to execute code from user‑mode pages. Question 28. What does PatchGuard (Kernel Patch Protection) monitor? A. Modifications to the SSDT table only

Exam

B. Changes to kernel code sections and critical data structures C. Writes to the non‑paged pool D. Calls to user‑mode functions from kernel mode Answer: B Explanation: PatchGuard periodically scans the kernel’s code and certain data structures for unauthorized modifications and triggers a bug check if tampering is detected. Question 29. Which of the following is a mitigation that Control Flow Guard (CFG) provides for kernel drivers? A. Randomizes the kernel base address B. Prevents indirect calls to addresses not in a validated bitmap C. Disallows execution of code from writable pages D. Enforces mandatory access control on driver objects Answer: B Explanation: CFG maintains a bitmap of valid indirect‑call targets; any attempt to branch to an address outside the bitmap causes a crash. Question 30. In Windows, which register holds the address of the current process’s KTHREAD structure? A. CR B. GS (or KPCR->Prcb->CurrentThread) C. FS D. ESP Answer: B Explanation: The GS segment base points to the KPCR; offsetting into it yields the current KTHREAD pointer, used by the kernel to access thread‑specific data.

Exam

Explanation: MmProbeAndLockPages checks the accessibility of a user buffer and locks the pages into memory for kernel access. Question 34. In a KMDF driver, which object represents an I/O request? A. WDFDEVICE B. WDFQUEUE C. WDFREQUEST D. WDFINTERRUPT Answer: C Explanation: WDFREQUEST abstracts an I/O request packet (IRP) in the KMDF framework. Question 35. What is the purpose of the IoCreateDeviceSecure routine? A. To create a device object with a security descriptor that enforces access control B. To allocate non‑paged memory for a driver C. To register a driver’s unload routine D. To map a driver’s image into kernel space Answer: A Explanation: IoCreateDeviceSecure creates a device object and attaches a security descriptor, limiting which users can open the device. Question 36. Which of the following is a common indicator of a successful token‑stealing exploit? A. The process receives a SYSTEM process ID (PID 4) B. The process’s token field matches that of the System process C. The process’s name changes to “System” D. The process’s priority becomes REALTIME

Exam

Answer: B Explanation: After token stealing, the compromised process’s Token field contains the same value as the System process token, granting SYSTEM privileges. Question 37. Which kernel structure contains the list of all loaded drivers? A. _KPCR->Prcb->DriverList B. _PEB->Ldr->InLoadOrderModuleList C. _EPROCESS->ActiveProcessLinks D. _KLDR_DATA_TABLE_ENTRY linked via PsLoadedModuleList Answer: D Explanation: The PsLoadedModuleList is a doubly‑linked list of _KLDR_DATA_TABLE_ENTRY structures representing each loaded kernel module. Question 38. What does the KeBugCheckEx function do? A. Logs an error to the event viewer B. Triggers a blue screen with a custom bug check code C. Sends a debug message to WinDbg D. Frees all kernel memory pools Answer: B Explanation: KeBugCheckEx causes an intentional system crash (BSOD) with a specified bug‑check code, often used by PatchGuard when tampering is detected. Question 39. Which of the following is a valid way to locate the kernel base address at runtime? A. Reading the value of the KUSER_SHARED_DATA structure’s NtSystemRoot field B. Using MmGetSystemRoutineAddress with a known exported function name

Exam

Question 42. What does the ObReferenceObjectByHandle routine do? A. Creates a new kernel object with a given handle B. Translates a user‑mode handle to a kernel object pointer and increments its reference count C. Frees a kernel object associated with a handle D. Registers a callback for handle creation events Answer: B Explanation: ObReferenceObjectByHandle validates a handle, maps it to the underlying kernel object, and increments the object's reference count to prevent premature deletion. Question 43. Which IOCTL method uses a system buffer that is automatically allocated by the I/O manager? A. METHOD_BUFFERED B. METHOD_IN_DIRECT C. METHOD_OUT_DIRECT D. METHOD_NEITHER Answer: A Explanation: METHOD_BUFFERED copies data to/from a kernel‑allocated buffer that resides in the IRP’s AssociatedIrp.SystemBuffer. Question 44. When a driver calls ExAllocatePoolWithTag with the PagedPool flag at DISPATCH_LEVEL, what will happen? A. Allocation succeeds because paged pool is always available B. The system raises an exception due to illegal allocation at high IRQL C. The call silently fails and returns NULL D. The allocation is deferred until a lower IRQL is reached Answer: B

Exam

Explanation: Paging operations are not allowed at DISPATCH_LEVEL; attempting to allocate from the paged pool at such IRQL triggers a bug check. Question 45. Which of the following is NOT a typical use of the KeInitializeDpc routine? A. Scheduling work to run at DISPATCH_LEVEL B. Executing a routine in the context of a specific processor C. Deferring execution of a routine to a lower IRQL D. Creating a kernel thread that runs in user mode Answer: D Explanation: KeInitializeDpc sets up a Deferred Procedure Call (DPC); it never creates a user‑mode thread. Question 46. In a driver’s AddDevice routine, what is the primary purpose of calling IoCreateDevice? A. To register a device interface GUID B. To allocate a device object that represents the driver’s functional device C. To map the driver’s image into kernel memory D. To allocate a user‑mode buffer for I/O operations Answer: B Explanation: IoCreateDevice creates a DEVICE_OBJECT that the driver uses to represent the hardware or virtual device. Question 47. Which of the following statements about the KeRaiseIrql function is true? A. It can raise the IRQL to any value, including PASSIVE_LEVEL B. It can only raise the IRQL, not lower it C. It returns the previous IRQL value for later restoration

Exam

B. Concatenating several small instruction sequences to perform arbitrary computation C. Creating a circular linked list of kernel objects D. Using a single large function as a “super‑gadget” Answer: B Explanation: Gadget chaining assembles multiple “pop‑reg; ret” or similar snippets into a sequence that accomplishes the attacker’s goal. Question 51. Which of the following is a legitimate reason for a driver to use ExAcquireFastMutex? A. To protect a critical section that may be entered at IRQL DISPATCH_LEVEL B. To synchronize access to a shared resource at PASSIVE_LEVEL only C. To block thread execution until an I/O completion routine finishes D. To allocate memory from the non‑paged pool atomically Answer: B Explanation: ExAcquireFastMutex can only be used at PASSIVE_LEVEL; it is intended for low‑IRQL synchronization. Question 52. What is the primary difference between METHOD_IN_DIRECT and METHOD_OUT_DIRECT IOCTL buffering? A. METHOD_IN_DIRECT copies data from user to kernel, METHOD_OUT_DIRECT copies from kernel to user B. METHOD_IN_DIRECT uses system buffer, METHOD_OUT_DIRECT uses MDL directly C. METHOD_IN_DIRECT maps the user buffer for input, METHOD_OUT_DIRECT maps it for output via MDL D. There is no difference; they are synonyms Answer: C

Exam

Explanation: METHOD_IN_DIRECT creates an MDL for the input buffer (read‑only), while METHOD_OUT_DIRECT creates an MDL for the output buffer (write‑only). Question 53. Which kernel routine is responsible for converting a user‑mode address to an MDL? A. IoAllocateMdl B. MmProbeAndLockPages C. IoGetCurrentIrpStackLocation D. KeInitializeEvent Answer: A Explanation: IoAllocateMdl creates an MDL (Memory Descriptor List) that describes a user‑mode buffer, which can then be probed and locked. Question 54. Which of the following is a typical symptom of a kernel stack overflow? A. The driver fails to load due to insufficient memory B. The system experiences a bug check with code 0x7F (UNEXPECTED_KERNEL_MODE_TRAP) C. The process’s handle table becomes corrupted D. The driver’s device object disappears from Device Manager Answer: B Explanation: A stack overflow in kernel mode often triggers the UNEXPECTED_KERNEL_MODE_TRAP bug check (0x7F). Question 55. In the Windows kernel, what does the PsLookupProcessByProcessId routine return? A. A pointer to the process’s _EPROCESS structure B. The base address of the process’s executable image C. The process’s security token