Integer Overflow Vulnerability in Windows Driver Enables Privilege Escalation, PoC Published
An independent researcher has uncovered a critical vulnerability in the ksthunk.sys driver, a component of the Windows operating system responsible for facilitating 32-bit to 64-bit process communications. The flaw, which allows a local attacker to exploit an integer overflow for privilege escalation, has been successfully demonstrated and highlighted during the prestigious TyphoonPWN 2024 event, earning second place.
The vulnerability lies in the CKSAutomationThunk::ThunkEnableEventIrp function, which allocates buffers for managing input and output data within the kernel. The issue stems from a lack of integer overflow validation during buffer size alignment calculations. This oversight results in improperly sized allocations that trigger a heap overflow, enabling attackers to overwrite adjacent memory.
The SSD Secure Disclosure technical team explains: “At [1], there is no integer overflow validation while calculating outbuflen + 0x17. Therefore, outlen_adjust can be set to a small value, leading to an undersized allocation and eventual heap overflow during data copying at [4]”
The exploit leverages a series of steps to bypass kernel safeguards and achieve system-level privileges:
- Memory Manipulation: Attackers create gaps between named pipe objects in the kernel’s non-paged pool, making it easier to exploit the overflow.
- Arbitrary Memory Access: By corrupting adjacent named pipes, attackers gain arbitrary read and write capabilities.
- Token Overwrite: Exploiters modify the current process token to gain SYSTEM privileges, allowing complete control over the machine
Microsoft was notified of the vulnerability, but the vendor claimed it was a duplicate issue that had already been resolved. Despite these assurances, the researcher found the flaw to still be exploitable on Windows 11 23H2. No CVE number or detailed patch information has been provided to date.
This vulnerability exemplifies the risks associated with kernel-level flaws. The ability to escalate privileges via a driver underscores the importance of rigorous validation in kernel code. As SSD Secure Disclosure noted, the exploitability of this flaw “is not hard” due to the controllable allocation sizes and data involved, making it a potential tool for advanced threat actors.
To read the technical details and proof-of-concept (PoC) code, please visit the official advisory from SSD Disclosure.