CVE-2025-21372 — Microsoft Brokering File System Elevation of Privilege Vulnerability
Executive Summary
None
Overview
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H/E:U/RL:O/RC:C
EPSS Score
Affected Products
| Product | KB Article | Severity | Impact | Restart Required |
|---|---|---|---|---|
| Windows 11 Version 24H2 for ARM64-based Systems | 5050009 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 24H2 for x64-based Systems | 5050009 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2022, 23H2 Edition (Server Core installation) | 5049984 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2025 | 5050009 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2025 (Server Core installation) | 5050009 (Security Update) |
Important | Elevation of Privilege | Yes |
Patches
| Article | Type | Restart |
|---|---|---|
5050009 |
Security Update | Yes |
5049984 |
Security Update | Yes |
Patch Diff
Patch diff 10.0.26100.2454 -> 10.0.26100.2894 (per-CVE override for CVE-2025-21372; same bfs.sys diff as bfs_sys-kb5050009.json, with this CVE's own RCA and PoC links)
| Function | Address | Change | Note |
|---|---|---|---|
BfsDereferencePolicyEntryEx |
1c0004fa0 -> 1c0005160 |
code, name, fullname, length, sig, address, called | similarity 0.92 |
BfsCheckAndReleaseIdlePolicy |
1c0004e00 -> 1c0004ea4 |
code, length, address, called | similarity 0.61 |
Root Cause Analysis
RCA — CVE-2025-21372 (bfs.sys named-pipe mapping UAF race)
- Binary:
bfs.sys(Brokering File System minifilter) - Patch: KB5050009 (Jan 2025),
10.0.26100.2454→10.0.26100.2894 - Class: CWE-416 use-after-free (race) | Impact: EoP | ITW: no
- Diff:
ghidriff/CVE-2025-21315/output/bfs-10.0.26100.2454.sys-bfs-10.0.26100.2894.sys.ghidriff.md(shared with CVE-2025-21315)
Root cause
BfsReleaseNamedPipeMapping() decrements PipeEntry->RefCt before acquiring
the PipeMappingTable pushlock:
if ( _InterlockedExchangeAdd(&PipeEntry->RefCt, -1) == 1 ) // dec first
{
ExAcquirePushLockExclusiveEx(PipeMappingTable, 0); // lock second (too late)
if ( !PipeEntry->RefCt ) { ...free PipeEntry... }
ExReleasePushLockExclusiveEx(...);
}
Race with two threads holding the same named-pipe mapping (RefCt = 2):
- Thread A decrements RefCt 2→1, then waits on the lock.
- Thread B decrements RefCt 1→0, acquires the lock, frees
PipeEntry, unlocks. - Thread A acquires the lock and evaluates
if (!PipeEntry->RefCt)on freed memory → UAF read; a reclaimed entry turns this into type confusion.
Patch
Gated by Feature_752421176: the PipeMappingTable pushlock is taken at function
entry (before the refcount decrement) and held for the whole release path.
The gate is referenced only in BfsReleaseNamedPipeMapping — a clean
attribution anchor. Confirmed in the ghidriff diff:
- Added:
Feature_752421176__private_IsEnabledDeviceUsageNoInline,..._IsEnabledFallback - Modified:
BfsReleaseNamedPipeMapping(72% match)
Reaching the bug
Named-pipe operations brokered by BFS from an AppContainer/AppSilo process:
open two handles to the same named pipe under BFS management and race
close/release on two threads. No IOCTL needed — the minifilter intercepts the
pipe I/O path. Objects: PipeMappingTable { PushLock, RTL_DYNAMIC_HASH_TABLE },
PipeEntry { HashEntry, RefCt, UserSid, AppContainerSid, FilePath, ... }.
Detection notes
- Race-window bug: look for processes under AppContainer spawning threads that hammer duplicate named-pipe create/close.
- Crash signature: access violation in
bfs!BfsReleaseNamedPipeMapping. - Same-month sibling: CVE-2025-21315 (PolicyTable locking) — see
rca-cve-2025-21315.md.
Attack Path
Refcount decremented before the lock is taken - two releasers both observe the last reference
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
hazard