Executive Summary

None

Overview

7.8
CVSS HIGH
Important
MS Severity
Not Exploited
MS Exploit Status
Less Likely
MS Exploit Likelihood
Category Elevation of Privilege
Released Jun 8 2021
Last Updated Jun 8 2021
Publicly Disclosed No
CISA KEV Not Listed
Known Exploits None Known
EPSS Score 0.01208 — 0.65676 percentile
NVD CVSS 7.8 HIGH — matches MSRC

Verified Attribution

Report-backed
Verified binarycldflt.sys
FunctionHsmpRpiDecompressBuffer
WeaknessCWE-191
SourceZDI (Hossein Lotfi)
NoteCloud Files mini-filter: reparse length set to 0, +8 then -12 integer underflow -> 0xFFFFFFF4 to RtlDecompressBuffer -> kernel heap overflow EoP. Patch adds length>=4 check.

Binary/function confirmed from a public vendor or researcher report; this pin overrides the keyword heuristic.

CVSS Vector

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
ATTACK VECTOR
Local
ATTACK COMPLEXITY
Low
PRIVILEGES REQUIRED
Low
USER INTERACTION
None
SCOPE
Unchanged
CONFIDENTIALITY
High
INTEGRITY
High
AVAILABILITY
High
EXPLOIT CODE MATURITY
Unproven
REMEDIATION LEVEL
Official Fix
REPORT CONFIDENCE
Confirmed
Temporal Score: 6.8

EPSS Score

0.01208
probability of exploitation in the next 30 days
0.65676 percentile - updated 2026-08-14
View on FIRST.org

Affected Products

18 affected products
Product KB Article Severity Impact Restart Required
Windows 10 Version 1809 for 32-bit Systems 5003646 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 1809 for ARM64-based Systems 5003646 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 1809 for x64-based Systems 5003646 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 1909 for 32-bit Systems 5003635 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 1909 for ARM64-based Systems 5003635 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 1909 for x64-based Systems 5003635 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 2004 for 32-bit Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 2004 for ARM64-based Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 2004 for x64-based Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 20H2 for 32-bit Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 20H2 for ARM64-based Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 21H1 for 32-bit Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 21H1 for ARM64-based Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows 10 Version 21H1 for x64-based Systems 5003637 (Security Update) Important Elevation of Privilege Yes
Windows Server 2019 5003646 (Security Update) Important Elevation of Privilege Yes
Windows Server 2019 (Server Core installation) 5003646 (Security Update) Important Elevation of Privilege Yes
Windows Server, version 2004 (Server Core installation) 5003637 (Security Update) Important Elevation of Privilege Yes
Windows Server, version 20H2 (Server Core Installation) 5003637 (Security Update) Important Elevation of Privilege Yes

Patches

3 patches
Article Type Restart
5003646 Security Update Yes
5003635 Security Update Yes
5003637 Security Update Yes

Patch Diff

ghidriff · cldflt.sys (KB5003646)

Integer underflow in cldflt.sys HsmpRpiDecompressBuffer leading to controlled paged pool overflow from 0x20-byte allocation. cstmDataSize (WORD) controls allocation size (cstmDataSize + 8). No minimum check allows value 0, causing allocatedSize - 12 to underflow to 0xFFFFFFF4 for RtlDecompressBuffer. LZNT1 header can be set to uncompressed, making the call behave as memcpy with attacker-controlled size and content. Patch adds if (cstmDataSize >= 4) guard. Related: CVE-2023-36036 (same function, missing max check, exploited ITW).

Pre-patch version 10.0.19041.906
Post-patch version 10.0.19041.1052
Function Address Change Note
HsmpRpiDecompressBuffer code (minimum size check added) Added check that cstmDataSize >= 4 before computing allocatedSize = cstmDataSize + 8. Prevents unsigned integer underflow when (allocatedSize - 12) is passed as UncompressedBufferSize to RtlDecompressBuffer.
View full diff report View RCA report Download PoC

Root Cause Analysis

Root Cause Analysis — CVE-2021-31969

Metadata

Field Value
CVE CVE-2021-31969
Binary cldflt.sys (Windows Cloud Files Mini Filter Driver)
Severity Important (CVSS 7.8)
Impact Elevation of Privilege
Bug Class CWE-190: Integer Underflow → Paged Pool Overflow
Patch KB5003646 (June 2021)
Exploit Author Chen Le Qi (STAR Labs SG)

1. Executive Summary

CVE-2021-31969 is an integer underflow in cldflt.sys HsmpRpiDecompressBuffer that results in a controlled paged pool overflow from a 0x20-byte allocation. The cstmDataSize field in cloud filter reparse data controls the pool allocation size (cstmDataSize + 8). Without a minimum value check, a value < 4 causes allocatedSize - 12 to underflow to 0xFFFFFFF4, which is passed as UncompressedBufferSize to RtlDecompressBuffer. By marking the LZNT1 header as uncompressed, RtlDecompressBuffer acts as memcpy with attacker-controlled size and content.

2. Vulnerable Function

HsmpRpiDecompressBuffer in cldflt.sys

Pre-patch (KB5003217)

v7 = *(_DWORD *)(a1 + 8);
someSize = HIWORD(v7);
// No minimum check on someSize
allocatedSize = someSize + 8;
allocatedMem = ExAllocatePoolWithTag(PagedPool, someSize + 8, 'pRsH');
// ...
v3 = RtlDecompressBuffer(
    COMPRESSION_FORMAT_LZNT1,
    (PUCHAR)allocatedMem + 12,    // uncompressed_buffer
    allocatedSize - 12,           // BUG: underflows if allocatedSize < 12
    (PUCHAR)(a1 + 12),            // compressed_buffer (user-controlled)
    a2 - 12,                      // compressed_size
    (PULONG)va);

Post-patch (KB5003646)

someSize = *(_WORD *)(a1 + 10);
if (someSize >= 4u) {   // NEW: minimum size check
    // ... rest of function
}

3. Root Cause

The cstmDataSize WORD field at offset +2 in HSM_REPARSE_DATA controls the allocation. With cstmDataSize = 0:

  • allocatedSize = 0 + 8 = 8
  • Pool allocation: 0x8 bytes → rounded up to 0x20 by pool allocator
  • UncompressedBufferSize = 8 - 12 = 0xFFFFFFF4 (unsigned underflow)

The LZNT1 compressed buffer is user-controlled. By setting the first WORD of the buffer to specify “uncompressed” data, RtlDecompressBuffer simply copies the data verbatim. Since the LZNT1 format supports multiple chunks of up to 0x1000 bytes each, and HsmpRpReadBuffer retrieves up to 0x4000 bytes of reparse data, the attacker can overflow approximately 4 pages past the 0x20 allocation.

4. Reachability / Attack Surface

Call chain

Attacker opens directory in sync root
  -> NTFS post-create callback
    -> HsmFltPostCREATE
      -> HsmpSetupContexts
        -> HsmpRpReadBuffer
          -> FltFsControlFile(FSCTL_GET_REPARSE_POINT)
          -> HsmpRpiDecompressBuffer
            -> RtlDecompressBuffer(underflowed size)  // OVERFLOW

Prerequisites

  1. Register cloud sync root via CfRegisterSyncRoot() + CfConnectSyncRoot() (attaches cldflt.sys minifilter)
  2. Create directory in sync root
  3. Set reparse data with FSCTL_SET_REPARSE_POINT_EX (pre-op blocks FSCTL_SET_REPARSE_POINT)
  4. Craft HSM_REPARSE_DATA with cstmDataSize = 0, flag = 0x8000, LZNT1 header marking data as uncompressed
  5. Close and reopen the directory handle to trigger decompression path

Pool constraints

  • Allocation size: 0x20 bytes (LFH-managed for common sizes)
  • Overflow content and size: fully attacker-controlled
  • Maximum overflow: ~0x4000 bytes (limited by HsmpRpReadBuffer retrieval size)

5. Exploitation (STAR Labs — Chen Le Qi)

Challenge

The 0x20 allocation falls in the Low Fragmentation Heap (LFH), which only places it adjacent to other 0x20-sized chunks. Finding a 0x20-sized object that provides both read and write primitives is impractical.

Strategy: overflow past LFH into VS subsegment

  1. LFH exhaustion spray: Allocate many _TERMINATION_PORT objects (0x20 each, paged pool) via NtRegisterThreadTerminatePort to fill existing LFH buckets and force new segment allocation.
  2. VS subsegment spray: Allocate _WNF_STATE_DATA and _TOKEN objects in the Variable Size allocator, hoping they land contiguous to an LFH bucket.
  3. Overflow: Write 4 pages of DWORDs with value 0x1000 past the LFH allocation. If a WNF object is hit, its AllocatedSize and DataSize fields are overwritten to 0x1000, granting relative page read/write.
  4. Identify corruption: Query all WNF state names; objects returning STATUS_BUFFER_TOO_SMALL have enlarged DataSize. Check that the adjacent _TOKEN is undamaged by reading its TokenId.

Arbitrary read (via _TOKEN)

Set Token->BnoIsolationHandlesEntry to a usermode buffer with forged IsolationPrefix.Buffer and MaximumLength. Call NtQueryInformationToken(TokenBnoIsolation) — kernel copies data from the forged pointer to usermode output buffer.

Arbitrary write (via _TOKEN)

Set Token->PrimaryGroup to one byte before a null to make the DynamicPart offset calculation yield +2. Set Token->DynamicPart to (target_address - 8). Call NtSetInformationToken(TokenDefaultDacl) with a crafted ACL buffer — SepAppendDefaultDacl writes the buffer to the computed address.

PreviousMode null

Target _KTHREAD + 0x232 (PreviousMode). Once zeroed, the exploit thread can use NtReadVirtualMemory/NtWriteVirtualMemory directly for kernel R/W.

Token theft

Walk ActiveProcessLinks from any leaked EPROCESS → find System (PID 4) → copy Token to exploit process.

Success rate

~1 in 15 attempts. Primary failure mode: WNF corruption also damages the adjacent TOKEN.

  • CVE-2023-36036: Same function (HsmpRpiDecompressBuffer), different root cause — missing maximum cap on cstmDataSize allowing OOB. Exploited in the wild. Patched November 2023.

7. Detection

YARA rule

rule CVE_2021_31969_cldflt_pool_overflow {
    meta:
        description = "Detects exploit artifacts for CVE-2021-31969 (cldflt.sys integer underflow)"
        cve = "CVE-2021-31969"
        author = "OnlyFm252"
    strings:
        $sync_reg = "CfRegisterSyncRoot" ascii
        $reparse_ex = "FSCTL_SET_REPARSE_POINT_EX" ascii
        $terminate = "NtRegisterThreadTerminatePort" ascii
        $wnf_create = "NtCreateWnfStateName" ascii
        $dup_token = "DuplicateTokenEx" ascii
        $set_token = "NtSetInformationToken" ascii
        $bno = "TokenBnoIsolation" ascii
    condition:
        uint16(0) == 0x5A4D and
        3 of ($sync_reg, $reparse_ex, $terminate) and
        2 of ($wnf_create, $dup_token, $set_token, $bno)
}

Sigma rule

title: CVE-2021-31969 cldflt.sys Pool Overflow Exploitation
id: a9b7c2d1-2021-31969-cldflt-pool
status: experimental
description: Detects cloud filter sync root registration followed by reparse point manipulation
references:
    - https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-31969
    - https://starlabs.sg/blog/2023/11-exploitation-of-a-kernel-pool-overflow-from-a-restrictive-chunk-size-cve-2021-31969/
logsource:
    product: windows
    category: driver_load
detection:
    selection_driver:
        ImageLoaded|endswith: '\cldflt.sys'
    filter_normal:
        Image|contains:
            - 'OneDrive'
            - 'svchost.exe'
    condition: selection_driver and not filter_normal
falsepositives:
    - Third-party cloud file sync providers
level: medium

8. References

Attack Path

Local EoP via an integer underflow in HsmpRpiDecompressBuffer turning RtlDecompressBuffer into an unbounded copy

Attack path for CVE-2021-31969 Local EoP via an integer underflow in HsmpRpiDecompressBuffer turning RtlDecompressBuffer into an unbounded copy 01 — ENTRY Attacker registers a cloud sync root and creates a directory inside it CfRegisterSyncRoot() + CfConnectSyncRoot() attaches the cldflt.sys minifilter. Any authenticated user; no admin rights. 02 — CONTROLLED INPUT Sets reparse data declaring a zero-length custom block FSCTL_SET_REPARSE_POINT_EX (the pre-op blocks the plain FSCTL) with HSM_REPARSE_DATA carrying cstmDataSize = 0, flag = 0x8000, and an LZNT1 header marking the payload as uncompressed. 03 — PATH Reopening the directory drives the post-create callback into the decompressor HsmFltPostCREATE -> HsmpSetupContexts -> HsmpRpReadBuffer -> FltFsControlFile(FSCTL_GET_REPARSE_POINT) -> HsmpRpiDecompressBuffer. 04 — MISSING CHECK No minimum check on cstmDataSize before computing the decompression bounds allocatedSize = cstmDataSize + 8, then (allocatedSize - 12) is passed as UncompressedBufferSize. With cstmDataSize = 0 that underflows to 0xFFFFFFF4. The patch adds a cstmDataSize >= 4 guard. 05 — PRIMITIVE Paged pool overflow from a 0x20-byte allocation with attacker-controlled contents The uncompressed LZNT1 header makes RtlDecompressBuffer behave as a memcpy of attacker-chosen size and data. Same function as CVE-2023-36036, which was exploited in the wild via a missing maximum check.

Derived from the patch delta: the checks added by the vendor identify which fields crossed a trust boundary unvalidated. Reachability and privilege are taken from the call chain in the RCA report.

Exploits & PoC

Detection Rules

Acknowledgments

Anonymous working with Trend Micro Zero Day Initiative
Keqi Hu