Skip to content

Remove GVFS.GVFlt and ESENT legacy disk layout upgrades - #2

Closed
tyrielv wants to merge 1 commit into
tyrielv/net10-central-packagesfrom
tyrielv/net10-remove-legacy
Closed

tyrielv wants to merge 1 commit into
tyrielv/net10-central-packagesfrom
tyrielv/net10-remove-legacy

Conversation

@tyrielv

@tyrielv tyrielv commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Remove GVFS.GVFlt and ESENT legacy disk layout upgrades

⚠️ Stacked on microsoft#1937 — target branch is tyrielv/net10-central-packages. GitHub will retarget to master once microsoft#1937 merges.

Summary

Remove the GVFlt compatibility shim project (legacy ProjFS predecessor) and all DiskLayout upgrade paths that depend on ManagedEsent (layouts 7→8, 8→9, 9→10, 13→14). These upgrades are 6+ years old and no longer needed.

Raises minimum supported disk layout version from 7 to 15. Users on ancient layouts must upgrade through an intermediate GVFS version first.

Removes ManagedEsent, Microsoft.Database.Collections.Generic, and Microsoft.Database.Isam NuGet packages entirely — eliminates a .NET Framework-only dependency that has no .NET 5+ target and would block updating.

What was removed

  • GVFS.GVFlt project (entire directory) — legacy ProjFS compat shim
  • 4 DiskLayout upgrade files — 7→8, 8→9, 9→10, 13→14 (all ESENT-dependent)
  • ESENTDatabase.cs — functional test helper
  • 3 NuGet packages — ManagedEsent, Microsoft.Database.Collections.Generic, Microsoft.Database.Isam
  • 7 unit tests — ESENT-dependent upgrade tests

Review guide

  • WindowsDiskLayoutUpgradeData.cs — key file: verify minimum version raised to 15, ESENT code path removed, 4 upgrade registrations removed
  • GVFSHelpers.cs — functional test minimum version matches (15)
  • GVFS.Platform.Windows.csproj — GVFlt project ref + 3 ESENT packages removed
  • Payload.csproj / FastFetch.csproj — GVFS.GVFlt.dll removed from signing lists

Verification

  • ✅ All C# projects build
  • ✅ 793/793 unit tests pass (ESENT-dependent tests removed, count unchanged)

Context

Phase 2C+2E of .NET 10 NativeAOT migration. Stacked on microsoft#1937 (central packages).

Remove the GVFlt compatibility shim project (legacy ProjFS predecessor)
and all DiskLayout upgrade paths that depend on ManagedEsent (layouts
7→8, 8→9, 9→10, 13→14). These upgrades are 6+ years old and no longer
needed.

Raise minimum supported disk layout version from 7 to 15. Users on
ancient layouts must upgrade through an intermediate GVFS version first.

Removes ManagedEsent, Microsoft.Database.Collections.Generic, and
Microsoft.Database.Isam NuGet packages entirely.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <[email protected]>
@tyrielv tyrielv closed this Apr 8, 2026
tyrielv added a commit that referenced this pull request Jun 4, 2026
The previous Authenticode check had two security bugs that combined
to make it ineffective:

1. X509Certificate.CreateFromSignedFile only extracts the signer
   certificate from a PE file — it does NOT verify that the signed
   digest matches the file's contents. X509Chain.Build then validates
   the certificate chain but not the file. An attacker could take any
   Microsoft-signed binary, modify arbitrary bytes in the PE, keep the
   signature blob attached, and this verifier would return success.

2. The signer check was a substring match on the certificate Subject:
   subject.Contains("CN=Microsoft Corporation"). This passes for
   surprising DNs such as CN="Microsoft Corporation Ltd" or DNs where
   the attacker's CN appears alongside "Microsoft Corporation" in
   another field (e.g. O="Microsoft Corporation, CN=Attacker").

Fix #1: Add a WinVerifyTrust P/Invoke and call it with
WINTRUST_ACTION_GENERIC_VERIFY_V2 before inspecting the cert. This is
the same code path Windows uses for SmartScreen / SRP / WDAC and is
the only supported way to verify Authenticode on Windows. Map the
common HRESULTs (TRUST_E_NOSIGNATURE, TRUST_E_BAD_DIGEST, etc.) to
specific error messages so users get actionable feedback. Fail closed
on non-Windows.

Fix #2: Replace the Subject.Contains match with an exact-string
comparison against certificate.GetNameInfo(X509NameType.SimpleName,
forIssuer: false). GetNameInfo parses the DN and returns just the CN
value, eliminating substring-collision attacks. Use the ordinal
comparer for the equality check.

Verified end-to-end on Windows:
  - Tampering one byte of a signed installer → rejected with
    "Installer Authenticode hash does not match — file has been
    tampered with" (was previously accepted)
  - Unsigned dev installer → rejected with "Installer is not signed"
  - notepad.exe (Microsoft-signed, ProductName mismatch) → still
    rejected by the ProductName check first
  - Real signed SetupGVFS.2.0.26147.6.exe → accepted, runs upgrade

Assisted-by: Claude Opus 4.7
Signed-off-by: Tyrie Vella <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant