CVE-2023-28252 - How the Windows Common Log File System EoP Flaw Was Exploited (With Code)

---

In April 2023, Microsoft fixed a serious security bug in Windows known as CVE-2023-28252. This vulnerability is in the Common Log File System (CLFS) - a core part of Windows used to store log data for applications and system services. The bug allows attackers to get SYSTEM privileges, meaning they could completely take over a Windows machine if they already have a user account on it.

In this deep-dive, we’ll break down in simple words what went wrong, how it was exploited in the wild, and even look at exploit code snippets to help you understand what you should patch and why.

What is the CLFS and the Vulnerability?

The Common Log File System (CLFS) helps software and Windows itself keep reliable logs—think of it as a structured log file writer provided by Microsoft.

CVE-2023-28252 is an “Elevation of Privilege” (EoP) vulnerability. Using this bug, an attacker running code as a regular user can trick the CLFS driver (clfs.sys) into overwriting sensitive areas in memory, allowing them to run any code they want with higher, SYSTEM-level permissions.

- Microsoft Security Guide for CVE-2023-28252
- Kaspersky Blog: Exploiting CVE-2023-28252 in Clfs.sys
- NIST NVD for CVE-2023-28252

The Bug, in Simple Terms

The problem is in how CLFS handles “base log files.” Attackers can craft a log file with certain headers and directory entries. When Windows tries to read this file, it trusts the sizes and offsets specified inside without proper checking—leading to a classic “out of bounds write.” That means the system will write data to places in memory it shouldn’t, allowing the attacker to corrupt Windows’ security structures.

In short: You give Windows a specially made log file, Windows believes it, and accidentally gives you the keys to the castle.

Prepare a malicious .blf file (the CLFS base log format).

2. Place this file somewhere the system will interact with it, or trigger the CLFS API directly via code.
3. The kernel parses the file, hits the bug, and allows an overwrite of sensitive memory (“pool overflow”).

Simplified Exploit Code (for Education Only!)

Below is a *very simplified* C snippet that demonstrates calling CLFS APIs. Note: Full public exploits are available on Github, but DO NOT run them on anything but a test machine!

#include <windows.h>
#include <winioctl.h>
#include <stdio.h>

// You must add CLFS structures from the Windows SDK or reverse analysis.
HANDLE hDevice = INVALID_HANDLE_VALUE;

int main() {
    hDevice = CreateFileW(L"\\\\.\\C: ", GENERIC_READ | GENERIC_WRITE,
                          FILE_SHARE_READ | FILE_SHARE_WRITE,
                          NULL, OPEN_EXISTING, , NULL);

    if (hDevice == INVALID_HANDLE_VALUE) {
        printf("Failed to get handle to disk\n");
        return 1;
    }

    // This is the vulnerable DeviceIoControl call:
    DWORD bytesReturned;
    char maliciousBuffer[x100];
    // Fill maliciousBuffer with fake CLFS structures here

    BOOL result = DeviceIoControl(
        hDevice,
        /* IOCTL_CLFS_* value here */,
        maliciousBuffer, sizeof(maliciousBuffer),
        maliciousBuffer, sizeof(maliciousBuffer),
        &bytesReturned,
        NULL
    );
    if (!result) {
        printf("Exploit failed\n");
    } else {
        printf("Exploit triggered\n");
    }
}

*Note: The real exploit is more complex, using heap feng shui and privilege hunting. This is a simplified educational illustration.*


### How Was This Found/Exploited In The Wild?

Threat researchers at Kaspersky first saw this bug used by ransomware attackers, who dropped custom exploits on victim machines and gained SYSTEM privileges to deploy ransomware using Nokoyawa or similar strains.

CLFS has been targeted before: similar bugs were exploited in 2022 and 2023, so it’s a repeating issue.

- Microsoft Patch Release
- Kaspersky Exploit Analysis
- Proof-of-Concept Exploit

Patch now, watch for malicious log files, and stay informed about kernel-level bugs!

If you’re responsible for Windows machines, this is an essential bug to understand and defend against.

Timeline

Published on: 04/11/2023 21:15:00 UTC