Kernel driver exploits are the highest risk privilege escalation path in this domain, because a driver runs in kernel context and a mistake crashes the host, corrupts data, or triggers a bugcheck that destroys the session. This sub-skill exists to impose order on driver work - enumerate drivers first, understand the IOCTL or module interface second, reproduce in a lab third, and only then consider a target run with explicit authorization and a recovery plan. It builds on the parent skill privesc-kernel-triage, which covers version enumeration and exploit matching generally. The focus here is drivers specifically - Windows kernel drivers and Linux loadable modules, signed vulnerable drivers brought by an attacker (BYOVD), and the privileges that let a low-privilege user load a driver at all.
Quick Workflow
- Enumerate loaded drivers and modules, plus driver files on disk, and record versions, signers, and load state before any exploit research.
- Check loading privileges - SeLoadDriverPrivilege on Windows, CAP_SYS_MODULE and module loading policy on Linux - because without a load path, a vulnerable driver that is not already loaded is not reachable.
- Match drivers against public vulnerability data, and read the vulnerability description for the exact trigger - IOCTL code, buffer size, or module parameter.
- Read the full exploit or proof of concept source before compiling anything, and list every assumption it makes about OS build, driver version, and architecture.
- Reproduce in an isolated lab VM with the same OS build and driver version, with snapshots, and confirm the exploit effect and its failure modes.
- Assess crash risk, get explicit authorization for a target run, confirm a snapshot or rebuild path, and run a minimal one-shot payload first.
- Capture evidence, unload or remove any driver you loaded, and document the driver, version, IOCTL, and hardening fix for the report.
1. Enumerating drivers on Windows and Linux
Driver enumeration is different on each platform, but the goal is the same - a complete list of what is loaded, what is installed but not loaded, and who signed it.
driverquery /v /fo list
Get-CimInstance Win32_SystemDriver | Select-Object Name, State, PathName
whoami /priv | findstr /i "LoadDriver"
The driverquery output gives the display name, type, and start mode. The CIM query gives the driver path, which matters for version checks and for finding drivers in writable locations. The privilege check is decisive - SeLoadDriverPrivilege lets an administrator load drivers, and on some configurations a lower privileged account holds it through group policy, which is itself a finding worth reporting before any exploit work.
lsmod
modinfo vulnerable_module 2>/dev/null | head -20
cat /proc/modules | cut -d ' ' -f 1
The lsmod output lists loaded modules and their use counts. The modinfo output gives version, author, and parameters for a specific module, and the proc modules list is the ground truth when tooling output is filtered. Also check for modules available on disk but not loaded, under the kernel modules directory for the running kernel, because a loadable module with a known vulnerability becomes reachable if module loading is permitted. Record the kernel version from the parent skill alongside every driver version, since driver exploits are often build specific.
2. IOCTL attack surface and how driver bugs become privilege escalation
Windows drivers expose device objects that user-mode code reaches through CreateFile and DeviceIoControl, passing an IOCTL code and a buffer. A driver that fails to validate the buffer length, the caller privilege, or the pointer origin can be tricked into writing to kernel memory, reading kernel memory, or executing a callback in kernel context. Common bug classes are buffer overflows in IOCTL handlers, arbitrary read and write primitives through insufficient validation, uninitialized memory disclosure, and missing access checks that let any user open the device.
Get-CimInstance Win32_PnPEntity | Where-Object { $_.Service -match "VulnDriver" } |
Select-Object Name, DeviceID, Service
fltmc instances
The first query ties a driver service to its Plug and Play device, and the second lists filter driver instances where relevant. To find the device name a driver exposes, check the driver documentation, the lab reproduction, or a device enumeration tool in the lab - do not guess IOCTL codes on a production target. The IOCTL code, the expected input structure, and the vulnerable handler must all come from public research or lab analysis, and the exploit source should be read to confirm which IOCTL it uses before it runs.
On Linux, the equivalent surface is the module device node, ioctl handler, proc or sysfs interface, or netlink handler the module registers. A module that exposes a world-writable device node, or an ioctl handler without capability checks, gives a low-privilege user direct access to kernel code paths. Check device node permissions alongside module versions.
ls -l /dev/ | grep -i vuln
find /dev -type c -perm -o+w 2>/dev/null | head -20
ls -l /proc/sys/kernel/ | head -20
World-writable character devices are rare and high value when found, because they often indicate a driver or module that did not restrict its interface. A device node owned by root with mode 666, or a proc entry writable by unprivileged users, is a finding on its own, before any memory corruption analysis begins.
3. Signed vulnerable drivers and BYOVD
Bring Your Own Vulnerable Driver (BYOVD) is the pattern where an attacker loads a legitimately signed but vulnerable driver, then exploits the driver vulnerability to gain kernel access. The signature bypasses driver signing enforcement, because the driver is genuinely signed, and the vulnerability provides the kernel primitive. This is why driver blocklists matter - Microsoft maintains a vulnerable driver blocklist, and endpoint products maintain their own, but a driver not yet on the blocklist, or an older version of a blocklisted driver, may still load.
Get-AuthenticodeSignature "C:\Drivers\vulndriver.sys" |
Select-Object Status, SignerCertificate
certutil -verify "C:\Drivers\vulndriver.sys"
Signature verification confirms the driver is signed and by whom, but it says nothing about vulnerability - a valid signature and a known vulnerability coexist in every BYOVD case. Check the driver version against the vendor advisory and the blocklist, check whether the target enforces the blocklist through policy, and check whether loading requires administrator privilege in the first place. If loading needs an administrator and you are not one, BYOVD is not your current path, and the finding is the presence of the vulnerable driver file, not an exploitable chain.
Linux has an analogous pattern with signed modules under Secure Boot, where module signing enforcement limits which modules load. A vulnerable signed module, or a configuration that disables module signature enforcement, changes the analysis the same way - the signature is not the vulnerability, the code is.
4. Safe lab reproduction and crash risk assessment
Never run an untested driver exploit against a target you cannot rebuild. The lab reproduction step is mandatory, not optional, and it has a specific checklist.
uname -r
lsmod | grep -i vuln
cp /boot/config-$(uname -r) /tmp/lab-kernel-config.txt 2>/dev/null || echo "kernel config not available"
Record the lab kernel version, confirm the vulnerable module loads in the lab, and save the kernel config where available, because config options decide whether a vulnerability is reachable - a module compiled out, a mitigation enabled, or an architecture difference can all make a lab success meaningless or a lab failure misleading. In the lab, run the exploit with a harmless payload first, such as reading a marker value or printing a kernel log message, before running a payload that changes credentials or tokens. Observe failure modes - does a failed attempt crash the lab VM, hang the driver, or return cleanly? A crash in the lab predicts a crash on target, and a crash on target may be treated as a denial of service finding in the report, not as a successful escalation.
Crash risk factors to record for every driver exploit:
- Whether the exploit writes to kernel memory blindly or uses a controlled primitive with bounds checks.
- Whether the driver vulnerability triggers on a single IOCTL or needs a race condition with timing dependence.
- Whether the target OS build matches the exploit supported range exactly, or only approximately.
- Whether a snapshot, backup, or rebuild path exists for the target, and who can restore it.
- Whether the engagement explicitly authorizes kernel exploitation, or limits testing to enumeration and lab proof.
If any factor is unknown, the honest report entry is enumeration plus lab proof, with the target run deferred. That is a complete finding, not an incomplete one.
5. From kernel primitive to privilege, and cleanup
A driver vulnerability typically yields a kernel read or write primitive, which exploit code converts into privilege by modifying the current process token, disabling protections, or executing a callback in kernel context. The conversion step is where most exploits differ by OS build, because token structures and offsets change between builds. That is why build-specific exploit code must be matched exactly, and why generic exploit code that hardcodes offsets for one build fails or crashes on another.
id
cat /proc/self/status | grep -i cap
After a successful run, confirm privilege with identity and capability checks, capture the exact commands and output for evidence, and then clean up - unload any module or driver you loaded, remove exploit binaries and driver files from the target, and restore any device permissions you changed. On Windows, check that the driver service returns to its prior start mode. On Linux, confirm the module list matches the pre-test baseline. Cleanup is part of the exploit, not an afterthought, because a leftover vulnerable driver is a persistent path for anyone who finds it next.
Detection note for this family - driver loading generates audit events on both platforms, including Windows event 6 for driver loaded and Sysmon driver load events, and Linux audit rules for module loading syscalls. Defenders should enforce the vulnerable driver blocklist, audit SeLoadDriverPrivilege assignments, monitor for driver loads outside maintenance windows, and alert on unsigned or newly introduced drivers. As the tester, timestamp every driver load, so the blue team can correlate their telemetry with the authorized test window.
Edge cases
- A vulnerable driver that is installed but not loaded, and not loadable by your account, is not an exploitable path from your current context.
- Driver signing enforcement and Secure Boot block unsigned drivers, but do not block signed vulnerable drivers, which is the entire BYOVD problem.
- IOCTL handlers may require a specific device open privilege or an administrator token to reach the vulnerable code path.
- Kernel mitigations such as SMEP, SMAP, KASLR, and HVCI change exploit reliability and may block payload techniques that worked on older builds.
- Module and driver versions reported by package managers may differ from the loaded version, so check the loaded module, not just the installed package.
- A race condition exploit that succeeds once in twenty lab runs is not a reliable target technique, and repeated attempts increase crash probability.
- Some drivers are only vulnerable in a specific configuration, such as a debug mode or an optional feature enabled, so check configuration, not just version.
- Unloading a driver after exploitation may crash the host if the exploit corrupted driver state, so plan cleanup as part of the lab reproduction.
Key references
- MITRE ATT&CK T1068 (Exploitation for Privilege Escalation), T1547.006 (Kernel Modules and Extensions), T1611 (Escape to Host)
- Microsoft vulnerable driver blocklist documentation - https://learn.microsoft.com/en-us/windows/security/application-security/application-control/app-control-for-business/design/applications-that-can-bypass-appcontrol
- Linux kernel module documentation - https://www.kernel.org/doc/html/latest/admin-guide/module-signing.html
- HackTricks kernel and driver section - https://book.hacktricks.xyz/linux-hardening/privilege-escalation
- LOLDrivers project for known vulnerable drivers - https://www.loldrivers.io
