https://blogs.vmware.com/security/2023/10/hunting-vulnerable-kernel-drivers.html
https://github.com/TakahiroHaruyama/VDR
Microsoft Windows allows loading kernel drivers with signatures whose certificates are expired or revoked. This policy facilitates threat actors to defeat AV/EDR sensors or install bootkits using known vulnerable drivers. Since the Windows 11 2022 update, the vulnerable drivers are blocked by default using HVCI. However, this banned-list approach is only effective if the vulnerable driver is known in advance.
Previous research utilized symbolic execution for automating the discovery of vulnerable drivers. Symbolic execution sometimes fails by causing path explosions or false negatives. Additionally, previous research focused primarily on WDM drivers. WDF drivers, whose code and data structures are different by versions and compiler settings, have been unexplored sufficiently.
In this presentation, I will explain how to identify vulnerable WDM/WDF drivers that contain firmware access (physical memory read/write). Detecting the drivers is almost the only way for OS-level security software to catch bootkit installation behavior that modifies SPI flash memory. Moreover, the drivers handling such low-level I/O often contain other vulnerabilities like kernel virtual memory access.
I automated the hunting process using an IDAPython script with two functions based on the Hex-Rays Decompiler SDK: triage and analysis. The triage function identifies IOCTL handlers then finds execution paths to the target APIs/instructions. The analysis function fixes union fields in IOCTL-related structures and sets argument names/types of the WDF APIs. Then it propagates function argument names/types in subroutines recursively to quickly decide if the I/O can be controlled.
As a result of the research, I found 34 unique vulnerable drivers accepting firmware access. Six allow kernel memory access. As of the time of writing in October 2023, the filenames of the vulnerable drivers have not been made public. All give full control of the devices to non-admin users. I will demonstrate firmware erasing and elevation of OS privilege by exploiting the drivers.