Windows Kernel: Exploit CVE-2022-35803 in Common Log File System
The patch for CVE-2022-24481 in the Windows CLFS driver was incomplete, allowing a type confusion by setting the client context type to a specific value so that the client context overlaps the container context. An attacker could then modify the container's pContainer pointer to point to user-controlled memory, leading to arbitrary kernel memory write and privilege escalation.
In Windows, the Common Log File System (CLFS) is a general-purpose logging service that can be used by software clients running in user-mode or kernel-mode. The Common Log File System (CLFS) is implemented in Windows Kernel through clfs.sys.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the patch for CVE-2022-24481 did not validate the cType field of the client context, so an attacker could set it to a value that caused the offset validation to use the wrong size, leading to overlapping contexts and a type confusion.
Impact
An attacker could achieve elevation of privilege on Windows Kernel by exploiting the type confusion to gain arbitrary kernel memory write and then escalate privileges.
What the attacker needed
Ability to craft a CLFS log file; Local access to the system
The fix
Microsoft fixed the vulnerability by adding a check on the cType field of context in CClfsBaseFile::GetSymbol.
How it was found
- Craft a CLFS log file with a client context whose cidNode.cType is set to 0xC1FDF008 and whose offset overlaps the container context's pContainer field.
- Set the CLFSHASHSYM fields (cbOffset and cbSymName) to valid values to pass GetSymbol checks.
- Trigger DeleteLogFile to set the flag that allows FlushMetadata to modify the eState field.
- Call FlushMetadata to overwrite the pContainer pointer with a user-space address (the container file size).
- Trigger RemoveContainer to call a virtual function through the corrupted pContainer, leading to a controlled function call and arbitrary write.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The Common Log File System (CLFS) is a Windows component that stores log data in files. A previous security fix tried to stop attackers from making two internal data structures overlap, but it missed a way to trick the system into thinking one structure was a different type. This let an attacker control a pointer that the kernel later used, ultimately allowing them to run code with higher privileges.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.