一键导入
kernel-exploit
Kernel-mode exploitation — drivers, syscalls, privilege escalation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Kernel-mode exploitation — drivers, syscalls, privilege escalation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | Kernel Exploit |
| description | Kernel-mode exploitation — drivers, syscalls, privilege escalation |
| tags | ["kernel","exploit","privilege-escalation","driver","syscall"] |
Task: Kernel Exploit Development. Exploit kernel vulnerabilities for privilege escalation.
Kernel exploitation requires understanding kernel internals. Focus on: driver vulnerabilities, syscall bugs, race conditions.
Kernel Drivers
list_imports → Look for: ZwOpenEvent, ZwOpenSection, MmCopyMemorysearch_strings → Device names: \Device*, \DosDevices*System Calls
Kernel Objects
Stack Buffer Overflow (Kernel)
char buffer[128]; memcpy(buffer, user_buf, user_size);Heap Overflow (Kernel)
pool = ExAllocatePoolWithTag(size); copy(...)Use-After-Free (Kernel)
ObDereferenceObject(obj); ... obj->method();Race Condition (TOCTOU)
Integer Overflow (Kernel)
size = user_count * sizeof(struct)Type Confusion (Kernel)
Missing Validation (Kernel)
Kernel Address Leak
Targets:
- Kernel base address (ntoskrnl.exe)
- Driver base addresses
- Kernel heap addresses
- Function pointers in kernel objects
Methods:
1. Uninitialized kernel memory
2. Info leak vulnerabilities
3. Kernel heap spraying
4. Symbolic link attacks
Bypass KASLR
1. Pool spraying for predictable allocations
2. Exploit info leaks to find kernel base
3. Use fixed offsets from known locations
4. Guess non-randomized components
Token Privilege Escalation
1. Find current process EPROCESS
2. Locate token field in EPROCESS
3. Copy SYSTEM token to current process
4. Trigger: Create cmd.exe as SYSTEM
Offset (Windows 10 x64):
Token = EPROCESS + 0x208 (version-dependent)
Arbitrary Kernel Read/Write
Method 1: Pool Overflow
1. Spray kernel pool with controlled objects
2. Overflow adjacent object
3. Corrupt object pointers
4. Achieve arbitrary read/write
Method 2: Use-After-Free
1. Free kernel object with function pointer
2. Realloc with controlled data
3. Call corrupted function pointer
4. Control kernel execution
GDI Palette Exploit
1. Create palette objects (kernel pool)
2. Free and reallocate with controlled data
3. Corrupt palette function pointers
4. Trigger callback for code execution
BitMap Exploit
1. Create BitMap objects in kernel pool
2. Use-After-Free to corrupt Bitmap
3. Write to kernel memory via Bitmap APIs
4. Read kernel memory via Bitmap APIs
5. Overwrite EPROCESS token
SMEP Bypass (Supervisor Mode Execution Prevention)
Goal: Execute user-mode shellcode from kernel
Method 1: Stack Pivot
- ROP chain to user-mode memory
- Overwrite stack pointer (RSP)
- Return to user-mode shellcode
Method 2: Overwrite Code Segment
- Modify shellcode to look like kernel
- Change page protections
- Jump to shellcode
Method 3: ROP Only
- Build entire exploit in ROP
- No shellcode needed
- Use existing kernel code
SMAP Bypass (Supervisor Mode Access Prevention)
Goal: Access user-mode data from kernel
Method 1: Data-only attack
- Don't execute from user-mode
- Only read/write user data
- Use kernel-mode APIs
Method 2: Disable SMAP
- Modify CR4 register
- Clear bit 20 (0x100000)
- Enable user-mode access
KPTI Bypass (Kernel Page Table Isolation)
Goal: Access kernel memory from user-mode
Method 1: Info leak before KPTI
- Leak addresses before isolation
- Use leaked addresses later
Method 2: CPU spec exec
- Meltdown-style exploits
- Speculative execution bypass
PatchGuard Bypass
Goal: Modify kernel without crashing
Method 1: Race PatchGuard
- Exploit timeout window
- Make changes quickly
- Restore before check
Method 2: Hook non-guarded functions
- Avoid PatchGuard-protected structures
- Hook safe functions instead
Stage 1: Information Leak
1. Trigger info leak vulnerability
2. Read kernel addresses
3. Calculate offsets
4. Bypass KASLR
Stage 2: Primitive Setup
1. Build read/write primitive
2. Test on known kernel addresses
3. Verify: Can read/write kernel memory
4. Stabilize: Reliable exploitation
Stage 3: Privilege Escalation
1. Find current process EPROCESS
2. Locate SYSTEM process
3. Copy SYSTEM token
4. Trigger: SYSTEM shell
Stage 4: Cleanup
1. Restore modified kernel state
2. Avoid crash detection
3. Hide exploitation evidence
4. Maintain persistence
Local Testing
1. Enable kernel debugging
2. Use WinDbg for kernel debugging
3. Set breakpoints on kernel functions
4. Verify: Token copy, EPROCESS location
5. Check: System stability
VM Testing
1. Test in snapshot VM
2. Enable kernel debug mode
3. Monitor for BSOD
4. Adjust offsets for Windows version
5. Verify: Privilege escalation works
[KERNEL EXPLOIT] Driver Vulnerability
Driver: \Device\VulnDriver
IOCTL: 0x222003
Vulnerability: Stack buffer overflow
[Bug Details]
Location: Driver+0x1234 (IOCTL handler)
Buffer: 128 bytes stack buffer
Copy: Unbounded memcpy from user
Impact: Kernel code execution
[Exploit]
1. Info leak: Kernel base @ 0xfffff80012340000
2. Primitive: Arbitrary kernel R/W via pool overflow
3. Target: Current process EPROCESS @ 0xffff8d0012345678
4. Token: SYSTEM token @ 0xffff8d0099988000
5. Copy: Token[0] → CurrentProcess->Token
6. Result: SYSTEM privileges
[POC]
#include <windows.h>
HANDLE drv = CreateFile("\\.\VulnDriver", ...);
DWORD out;
DeviceIoControl(drv, 0x222003, payload, size, NULL, 0, &out, NULL);
system("cmd.exe"); // Runs as SYSTEM
Severity: CRITICAL (SYSTEM privilege escalation)
Bypasses: SMEP, SMAP, KPTI
Next-generation 0day discovery & exploit development — comprehensive code analysis, allocator vulnerabilities, compiler-induced bugs, SIMD/vector issues, JIT vulnerabilities, custom allocator attacks, ASLR/kASLR bypass, UAF, OOB, RCE with exploit generation, privilege escalation, backdoor establishment
Next-generation 0day discovery — novel overflow patterns, allocator exploits, compiler-induced bugs, bounds-check bypass, SIMD/vector overflows, JIT vulns, custom allocator attacks, ASLR/kASLR bypass, UAF, OOB, RCE with weaponized exploit generation, privilege escalation, backdoor establishment
Container escape vulnerability discovery — Docker, Kubernetes, container runtime exploitation, namespace isolation bypass, privilege escalation through container boundaries
Crypto implementation analysis — weak algorithms, side-channels, key management flaws, padding oracles, random generation failures, implementation bugs
IoT device security analysis — firmware extraction, RTOS exploits, hardware interfaces, protocol vulnerabilities, side-channel attacks, update mechanism exploitation
Industrial control system security — Modbus, DNP3, IEC 104, Ethernet/IP, PLC exploitation, control logic manipulation, sensor/actuator attacks, ICS protocol analysis