Executive Summary

Use after free in Microsoft Brokering File System allows an authorized attacker to elevate privileges locally.

Overview

7
CVSS HIGH
Important
MS Severity
Not Exploited
MS Exploit Status
Less Likely
MS Exploit Likelihood
Category Elevation of Privilege
Released Jul 8 2025
Last Updated Jul 8 2025
Publicly Disclosed No
CISA KEV Not Listed
Known Exploits None Known
EPSS Score 0.00972 — 0.58903 percentile
NVD CVSS 7 HIGH — matches MSRC

Verified Attribution

Report-backed
Verified binarybfs.sys
SourceBug-hunter LPE writeup (shared collection)
NoteBFS LPE (PoC in BfsTest.cpp; writeup is a PDF, exact fn not text-extracted).

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

CVSS Vector

CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
ATTACK VECTOR
Local
ATTACK COMPLEXITY
High
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.1

EPSS Score

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

Affected Products

2 affected products
Product KB Article Severity Impact Restart Required
Windows 11 Version 22H2 for ARM64-based Systems 5062552 (Security Update) Important Elevation of Privilege Yes
Windows 11 Version 22H2 for x64-based Systems 5062552 (Security Update) Important Elevation of Privilege Yes

Patches

1 patch
Article Type Restart
5062552 Security Update Yes

Patch Diff

ghidriff · bfs.sys (KB5062553)

Use-after-free (CWE-416) in the Microsoft Brokering File System driver bfs.sys policy-entry reference lifecycle, local EoP to SYSTEM (race, AC:H). bfs.sys stores per-user/per-container policy entries (tag EsfB) reference-counted (RefNo) in an RTL_DYNAMIC_HASH_TABLE, driven from \Device\Bfs IOCTL 0x228004 (BfsDeviceIoControl -> BfsProcessSetPolicyRequest -> BfsInsertPolicyEntry/BfsGetPolicyEntry/BfsDereferencePolicyEntryEx). The policy-entry RefNo lifecycle was not consistently paired with hash-table membership/lookups, so an entry (the EsfB pool block) could be freed (via BfsInsertPolicyEntry -> ExFreePoolWithTag on a dropped refcount) while a concurrent BfsProcessSetPolicyRequest/BfsGetPolicyEntry still looked it up/used it -> UAF (reporter observed a steadily reproducible bugcheck whose freed block was the EsfB policy entry). Diff of bfs.sys 10.0.26100.4484 -> .4652 (Jul 8 2025, KB5062553) confirms the July fix reworks the policy-entry reference lifecycle across BfsInsertPolicyEntry, BfsDereferencePolicyEntryEx, BfsInsertNotPresentPolicyEntry and BfsCheckAndApplyPolicy, all newly gated by CFR flag Feature_3148938554, so an entry is not freed while still referenced/looked up. AppSilo token required (BfsIsApplicableToken/SeAppSiloSid). MSRC: exploitation requires winning a race; grants SYSTEM. Note: our diff shows Feature_3148938554 (build/arch); paired double-free is CVE-2025-49693.

Pre-patch version 10.0.26100.4484 Download
Post-patch version 10.0.26100.4652 Download
Function Address Change Note
BfsInsertPolicyEntry / BfsDereferencePolicyEntryEx / BfsInsertNotPresentPolicyEntry / BfsCheckAndApplyPolicy code change code (policy-entry reference lifecycle rework, CFR-gated) Pre: EsfB policy-entry RefNo lifecycle not consistently paired with hash-table membership/lookups -> entry freed while concurrently referenced/looked up -> UAF. Post (Feature_3148938554): reference handling reworked so the entry is not freed while still referenced; local pointer copies nulled after ownership transfer (see CVE-2025-49693).
Feature_3148938554 gate added (CFR gate) CFR flag gating the policy-entry lifecycle rework; original path still ships when disabled.
View full diff report View RCA report

Root Cause Analysis

CVE-2025-49677 — Microsoft Brokering File System bfs.sys Policy-Entry Use-After-Free in the SetPolicy Path


Summary

Product Windows — bfs.sys (Microsoft Brokering File System; policy store)
CVE ID CVE-2025-49677
Impact Elevation of Privilege (to SYSTEM)
MSRC severity Important
CVSS 7.0 / 6.1 — CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
CWE CWE-416: Use After Free (policy-entry reference lifecycle)
Delivery Local — a SetPolicy request over \Device\Bfs IOCTL 0x228004 (race)
KB / Fixed build KB5062553 — bfs.sys 10.0.26100.4652 (Win11 24H2 x64)
Patch Date July 8, 2025 (2025-Jul)
Pre-patch binary bfs.sys 10.0.26100.4484 — SHA256 0fb28e775b40c35f96ab4cb22df9c5ea5873fbaff012fa2268a253aa94361626
Post-patch binary bfs.sys 10.0.26100.4652 — SHA256 678c670cb8ba6b2a02260ccb27540f5894d5668b411404d07c16a262ab074411
Feature flag Feature_3148938554 — the fix is CFR-gated
Exploitability Exploitation Less Likely; not publicly disclosed; not exploited (per MSRC)

Product Description

bfs.sys (Microsoft Brokering File System) manages per-user / per-container policy entries in a hash table (RTL_DYNAMIC_HASH_TABLE), each entry allocated with tag EsfB and reference-counted (RefNo). The policy store is driven from \Device\Bfs IOCTL 0x228004 (BfsDeviceIoControl → BfsProcessSetPolicyRequest → BfsInsertPolicyEntry / BfsGetPolicyEntry / BfsDereferencePolicyEntryEx), and the entries back a config file under \SystemRoot\System32\config\BFS\{usersid}\{containerid}.


Vulnerability Summary

The policy-entry reference lifecycle was mishandled, so an entry (the EsfB pool block) could be freed while another code path still held / looked it up — a use-after-free. The reporter observed a steadily reproducible bugcheck whose freed block was the EsfB policy-entry pool, freed via BfsInsertPolicyEntry → ExFreePoolWithTag and then still referenced when a subsequent BfsProcessSetPolicyRequest / BfsGetPolicyEntry walked the policy hash table:

nt!ExFreePoolWithTag
bfs!BfsInsertPolicyEntry        // frees the EsfB policy entry (dropped refcount)
bfs!BfsGetPolicyEntry           // later lookup finds/uses the freed entry
bfs!BfsProcessSetPolicyRequest
bfs!BfsDeviceIoControl

Because the hash-table slot / entry lifetime was not consistently synchronized with the RefNo reference counting, a concurrent SetPolicy operation could free an entry another thread was about to use (or double-drop its reference), yielding a use-after-free of a kernel pool object (CWE-416). BFS runs in kernel and the SetPolicy surface is reachable locally (from an AppSilo/AppContainer token), so the UAF is an EoP-to-SYSTEM primitive; MSRC notes exploitation requires winning a race.


Prerequisites and Constraints

  • Local (PR:L, AV:L); AC:H — the attacker must win a race between SetPolicy operations on the policy hash table.
  • The BFS interface requires an AppSilo token (BfsIsApplicableToken checks the SeAppSiloSid capability); the reporter reached it via an AppContainer/AppSilo process.
  • Result: a freed policy entry is reused → kernel UAF → SYSTEM.

Vulnerability Details

Root Cause

The EsfB policy-entry lifetime was governed by a RefNo reference count that was not consistently paired with the hash-table membership and lookups, so an entry could be dropped to zero and freed while still reachable/used by a concurrent SetPolicy path.

The patch (confirmed — diff, .4484 → .4652)

Gated behind Feature_3148938554, the July 2025 update reworks the policy-entry reference lifecycle across the SetPolicy path — our diff shows code changes in BfsInsertPolicyEntry, BfsDereferencePolicyEntryEx, BfsInsertNotPresentPolicyEntry and BfsCheckAndApplyPolicy, all newly gated by Feature_3148938554. The reference handling is corrected so an entry is not freed while still referenced/looked up (and the local pointer copies are nulled after ownership transfer — see the paired double-free fix CVE-2025-49693), closing the race that freed a still-in-use policy entry.

Patch Completeness Assessment

CFR-gated behind Feature_3148938554. The corrected lifecycle runs only when the flag is enabled; the original path still ships when disabled. Verify Feature_3148938554 is enabled to confirm the fix is live.


Detection Guidance

Behavioural. BFS SetPolicy requests (IOCTL 0x228004) from AppSilo/AppContainer processes, especially concurrent ones on the same user/container; UAF / pool- corruption bugchecks in bfs!BfsInsertPolicyEntry / BfsGetPolicyEntry / BfsDereferencePolicyEntryEx (tag EsfB) on unpatched/flag-disabled builds.

Config. The fix is CFR-gated — confirm Feature_3148938554 is enabled.


References

  • MSRC advisory — CVE-2025-49677 (Microsoft Brokering File System Elevation of Privilege), released 2025-07-08, KB5062553.
  • Full binary diff: /data/patch_diffs/bfs_sys-cve-2025-49677-49693-ghidriff.md
  • Related same-KB BFS double-free: CVE-2025-49693.

Attack Path

A BFS policy entry is freed while a concurrent SetPolicy lookup still uses it, yielding a UAF to SYSTEM

Attack path for CVE-2025-49677 A BFS policy entry is freed while a concurrent SetPolicy lookup still uses it, yielding a UAF to SYSTEM 01 — ENTRY AppSilo/AppContainer process issues BFS SetPolicy requests (\Device\Bfs IOCTL 0x228004) bfs.sys BfsProcessSetPolicyRequest manages EsfB policy entries reference-counted (RefNo) in a hash table. AV:L/PR:L, AC:H (race). 02 — CONTROLLED INPUT Concurrent SetPolicy operations on the same user/container policy entry One path drops the entry's reference/frees it while another is looking it up in the hash table. 03 — MISSING CHECK RefNo lifecycle not paired with hash-table membership/lookup (CWE-416) An EsfB policy entry is freed via BfsInsertPolicyEntry -> ExFreePoolWithTag while still reachable/used. 04 — PATH BfsGetPolicyEntry / BfsProcessSetPolicyRequest walks the table and uses the freed entry The dangling entry (or a double-dropped reference) is dereferenced after free. 05 — PRIMITIVE Use of the freed policy entry -> kernel UAF -> EoP to SYSTEM The Jul 2025 fix (Feature_3148938554) reworks the policy-entry reference lifecycle so entries are not freed while still referenced.

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

ChenJian with Sea Security Orca Team