ZeroHour
Kaspersky Securelistpublished ()ingested @Securelist

Windows CLFS and five exploits used by ransomware operators (Exploit #4 – CVE-2023

Vulnerabilities mentionedAll →

CVEVulnerabilityCVSSEPSSFlagsAffectedExposurePublished
CVE-2021-36955
Local Privilege Escalation in Microsoft Windows CLFS Driver

CVE-2021-36955 is an elevation-of-privilege vulnerability in the Windows Common Log File System (CLFS) driver, the kernel component responsible for managing log files used by various Windows features. An attacker who can already run code locally with limited user privileges can trigger the flaw in the CLFS driver and escalate to SYSTEM without any user interaction (CVSS 3.1: 7.8, local vector, low privileges required). Successful exploitation grants full SYSTEM-level control of the host, which adversaries use to disable security tooling and chain with other exploits during ransomware operations. The affected footprint is broad: Windows 7, 8.1, RT 8.1, Windows 10 builds 1507 through 21H1, and Windows Server 2004 and 2008 as listed in CISA's data. The flaw is confirmed exploited in the wild and was added to CISA's Known Exploited Vulnerabilities catalog on 2021-11-03 with known ransomware use; no standalone public proof-of-concept is known.

Do: Apply the Microsoft Windows security updates that fix this flaw across all affected versions immediately, per the CISA KEV required action (the fix was shipped in Microsoft's monthly Patch Tuesday updates, including the September 2021 release). Prioritize hosts where untrusted users can log on locally or via RDP, since this is a local privilege escalation used to reach SYSTEM in ransomware chains. Verify remediation with vulnerability scans and confirm your assets are cleared against the CISA KEV catalog.

7.84% KEV ransomware
  • Microsoft Windows 10 1507, 1607, 1809, 1909, 2004, 20H2, 21H1
  • Microsoft Windows 7
  • Microsoft Windows 8.1
  • +3 more
masshundreds of millions of Windows client and server installations worldwide
CVE-2021-36963
+1 in the same advisory: …38633
Windows Common Log File System Driver Elevation of Privilege Vulnerability

Windows Common Log File System Driver Elevation of Privilege Vulnerability

NVD description · AI analysis pending
7.81%
  • microsoft windows 10
  • microsoft windows 7
  • microsoft windows 8.1
  • +1 more
CVE-2022-24521
Out-of-bounds Write Privilege Escalation in Microsoft Windows CLFS Driver

CVE-2022-24521 is an elevation-of-privilege flaw in the Windows Common Log File System (CLFS) driver, a kernel component, caused by an out-of-bounds write (CWE-787). A local attacker who already has limited privileges on an affected Windows machine can trigger the bug and gain elevated (SYSTEM/administrator) rights without any user interaction. Because the CLFS driver is part of the operating system, every user and service on an unpatched host is exposed to post-compromise escalation, which ransomware operators use to move from an initial foothold to full control. Affected products per the data include Windows 10 releases 1507, 1607, 1809, 1909, 20H2, 21H1, and 21H2, Windows 11 21H2, Windows 7, Windows 8.1, Windows RT 8.1, and Windows Server 2008. The flaw was patched in Microsoft's April 2022 Patch Tuesday, added to CISA's Known Exploited Vulnerabilities catalog on 2022-04-13, and is known to be used in ransomware campaigns, with public reporting tying exploitation to Cuba ransomware activity.

Do: Apply the April 2022 Microsoft security updates (Patch Tuesday, released April 12, 2022) to all affected Windows 10/11, Windows 7/8.1/RT 8.1, and Windows Server 2008 systems immediately, per the CISA KEV required action; note that Windows 7/8.1/RT 8.1 and Server 2008 may require Extended Security Updates to receive the fix. Because this is a local privilege escalation, prioritize hosts reachable for initial access, review endpoint telemetry for suspicious limited-user-to-SYSTEM activity, and watch for indicators associated with Cuba ransomware campaigns exploiting this flaw.

7.87% KEV ransomware
  • Microsoft Windows 10 1507, 1607, 1809, 1909, 20H2, 21H1, 21H2
  • Microsoft Windows 11 21H2
  • Microsoft Windows 7 all supported editions
  • +3 more
mass≈1 billion+ Windows devices (the CLFS driver ships in all supported Windows 10/11 and legacy client releases)
CVE-2023-23376
Out-of-Bounds Write Privilege Escalation in Microsoft Windows CLFS Driver

CVE-2023-23376 is a heap-based buffer overflow (out-of-bounds write, CWE-122/CWE-787) in the Windows Common Log File System (CLFS) kernel driver. A local attacker with low privileges can trigger the flaw when the driver mishandles CLFS log-file data, with no user interaction required. Successful exploitation elevates the attacker from a low-privileged user to SYSTEM/kernel-level privileges, which is why ransomware operators chain it with other bugs after gaining an initial foothold. All supported Windows 10 (1507, 1607, 1809, 20H2, 21H2, 22H2), Windows 11 (21H2, 22H2), and Windows Server 2008, 2012, 2016, and 2019 releases as of February 2023 are affected. The flaw is actively exploited in the wild: it was added to CISA's Known Exploited Vulnerabilities catalog on February 14, 2023 with known ransomware use, Microsoft shipped the fix in the February 2023 Patch Tuesday release, and EPSS estimates roughly an 11% probability of exploitation within the next 30 days (96th percentile).

Do: Apply the Microsoft security updates released on February 14, 2023 (February Patch Tuesday) to every Windows 10, Windows 11, and Windows Server system in the affected version list, prioritizing servers and endpoints exposed to ransomware-prone environments. Verify patch status via update history or vulnerability scanning, since exploitation requires only local low-privileged access and there is no substitution for patching. Given confirmed ransomware chaining, also hunt for signs of post-compromise privilege escalation on hosts that were unpatched before mid-February 2023.

7.811% KEV ransomware
  • Microsoft Windows 10 1507 (all builds prior to the February 2023 security updates)
  • Microsoft Windows 10 1607 (all builds prior to the February 2023 security updates)
  • Microsoft Windows 10 1809 (all builds prior to the February 2023 security updates)
  • +9 more
mass~1 billion+ Windows devices (the CLFS driver ships in every listed Windows 10/11 client and Windows Server 2008-2019 release)
CVE-2023-28252
Heap Overflow in Microsoft Windows CLFS Driver Enables Local Privilege Escalation

CVE-2023-28252 is a heap-based buffer overflow (CWE-122) in the Microsoft Windows Common Log File System (CLFS) driver that allows privilege escalation. The flaw is triggered when the kernel's CLFS driver processes malformed or maliciously crafted log file data, corrupting heap memory; an attacker who can already run code on a target system (e.g., a low-privileged user or an attacker chained with another flaw such as a remote code execution bug) can leverage it to gain SYSTEM-level privileges. Because the CLFS driver ships with supported Windows client and server releases, essentially the entire Windows installed base is potentially exposed. The vulnerability is being actively exploited: CISA added it to the KEV catalog on 2023-04-11 with known ransomware use, and EPSS estimates a 49.0% probability of exploitation within 30 days (99th percentile). It was addressed in Microsoft's April 2023 security updates, and the required remediation action is to apply the vendor updates.

Do: Apply Microsoft's April 2023 (or later) cumulative security updates to all Windows clients and servers per vendor instructions, prioritizing high-value and domain infrastructure systems given the known ransomware use; there is no public PoC or known workaround, so patching is the primary mitigation. Note that this is a local elevation-of-privilege flaw, so also hunt for prior low-privilege access or exploitation chains on hosts, and confirm remediation by checking installed update levels across the estate.

7.849% KEV ransomware PoC
  • Microsoft Windows Wide range of supported Windows client and server releases (CISA lists 'Microsoft Windows'); exact affected builds are enumerated in Microsoft's April 2023 secu
masshundreds of millions of Windows devices (the CLFS driver is present across essentially all modern Windows 10/11 and Windows Server installations)
Full article1,122 words · extracted from securelist.com · click to collapse

This is part five of our study about the Common Log File System (CLFS) and five vulnerabilities in this Windows OS component that have been used in ransomware attacks throughout the year. Please read the previous parts first if you haven’t already.

You can skip to the other parts using this table of contents or using the link at the end of this part.

Exploit #4 – CVE-2023-23376

The October changes complicated the exploitation of the GENERAL block, and the author of the previously discussed exploits switched to exploiting the CONTROL block. CVE-2023-23376 was discovered as a zero-day in the wild by the Microsoft Threat Intelligence Center (MSTIC) and the Microsoft Security Response Center (MSRC). It was fixed in February 2023.

To discuss this vulnerability, we need to take a closer look at the CLFS_CONTROL_RECORD structure. As mentioned in part one of our study that discussed CLFS internals, it is used to hold an array of CLFS_METADATA_BLOCK structures with information about all the blocks present in the file, and also contains additional fields used to change the size of blocks. We are interested in the fields associated with the block extension operation: eExtendState – state of operation (None (0) / Extending (1) / Flushing (2)); iExtendBlock – index of the block being extended; iFlushBlock – index of the block being written; cNewBlockSectors – size of the new block (in sectors); cExtendStartSectors – original block size; cExtendSectors – number of sectors added.

When the driver opens an existing BLF file, the CClfsBaseFilePersisted::OpenImage function checks whether the interrupted block expansion operation should continue.

CClfsBaseFilePersisted::OpenImage function

This function checks the iExtendBlock and iFlushBlock indexes – they should be less than six. Otherwise, the block pointer will be read outside the block map buffer m_rgBlocks in the ExtendMetadataBlock function.

It’s important to note that the ExtendMetadataBlock function does not check the iExtendBlock and iFlushBlock indexes. The indexes are only checked by the OpenImage function that calls ExtendMetadataBlock. However, the ExtendMetadataBlock function is called in other functions that do not check indexes. It is assumed that “bad” indexes can only be passed from a file on disk, and the checks in OpenImage should protect against this. Could anything go wrong? Yes. If code uses malicious CLFS_CONTROL_RECORD or “bad” indexes after the initial check in OpenImage, this can be exploited to pass an arbitrary address as a pointer to a block and use it to escalate privileges.

It’s also worth mentioning that exploitation of CLFS_CONTROL_RECORD is not entirely new. The same attack method was previously described in the Exodus Intelligence blog post dedicated to the exploitation of CVE-2021-36955/CVE-2021-36963/CVE-2021-38633. The author of the exploit most likely read that blog post and realized that the ExtendMetadataBlock function could be exploited again using the same tricks from the GENERAL block exploit.

The exploit patches many bytes in a freshly created BLF file:

  1. The exploit moves the legitimate CLFS_CONTROL_RECORD structure to offset 0x1FF so that the offset of the DumpCount field matches the offset of the sector signature.
  2. The values of eExtendState, iExtendBlock, iFlushBlock and other fields in the CLFS_CONTROL_RECORD structure are changed to cause the code to execute the ExtendMetadataBlock function from the OpenImage
  3. The exploit builds a malicious CLFS_CONTROL_RECORD structure at offset 0x2FF.
  4. The exploit increases the cbSymbolZone value in the record of the GENERAL block so that the ExtendMetadataBlock function will be executed again when the code tries to add a new symbol.
  5. The exploit patches CLFS_LOG_BLOCK_HEADER->SignaturesOffset just like in exploit #2, but now for the CONTROL block. The array with the original bytes is moved from the last sector, where it should be, to the first sector where the block header is located (offset before patch: 0x3F8, offset after patch: 0x28).

Overlap of new signatures data array with existing block header

As a result of the changes made in steps 1 and 5, the record offset now overlaps the location of the original bytes for sector #0, and the sector #0 signature now partially overlaps CLFS_CONTROL_RECORD->DumpCount.

Overlap of the CLFS_CONTROL_RECORD->DumpCount field with the signature for sector #0

As you may have already guessed, the root cause of this vulnerability is almost identical to the root cause of the vulnerability from exploit #2. The main difference is that the exploit now targets CLFS_CONTROL_RECORD instead of CLFS_BASE_RECORD_HEADER. The RecordOffsets[0] and DumpCount fields are now connected by the signature of sector #0, resulting in the following:

  1. When opening a BLF file, the ClfsDecodeBlock function will copy the original bytes from CLFS_LOG_BLOCK_HEADER->RecordOffsets[0] to the position of the sector #0 signature (which is also CLFS_CONTROL_RECORD->DumpCount). The word at offset 0x1FE will be equal to 0x1FF.
  2. The code will proceed to the ExtendMetadataBlock function, and it will make changes to CLFS_CONTROL_RECORD. The value of the DumpCount field will be incremented. The word at offset 0x1FE becomes equal to 0x2FF.
  3. The FlushMetadata function will call the WriteMetadataBlock/ClfsEncodeBlock functions to encode the blocks and then write the changes to disk.
  4. ClfsEncodeBlock will copy the updated original bytes from the position of the sector #0 signature to where it should be stored, overwriting CLFS_LOG_BLOCK_HEADER->RecordOffsets[0] (0x1FF -> 0x2FF).
  5. The exploit adds a new container and because of the patched cbSymbolZone, the ExtendMetadataBlock function is executed again, but now the malicious CLFS_CONTROL_RECORD will be used instead of the legitimate record.

As a result, the exploit manages to pass “bad” iExtendBlock and iFlushBlock indexes, forcing the code to use a pointer sprayed into memory as the pointer of the block. The WriteMetadataBlock function, called from the ExtendMetadataBlock function, uses the pointer of the block to increment the DumpCount field, allowing an arbitrary value to be incremented in memory. On operating systems that support the PreviousMode technique, it is exploited by corrupting another BLF file and then following the same exploitation process as all the other exploits described previously. On newer builds of Windows 11 that do not support the PreviousMode technique, it is exploited by corrupting pipe attribute fields and building an arbitrary read/write primitive via the NtFsControlFile API function.

Use the following link to read the next part:

Text extracted automatically; images, tables and formatting may be missing. Original: https://securelist.com/windows-clfs-exploits-ransomware-cve-2023-23376/111593/