Skip to content

Fix SignCheck MSI/MSP/CAB/MSU signature verification on .NET Core - #5834

Merged
mmitche merged 3 commits into
release/11.0.1xx-preview3from
port-signcheck-msi-cab-verification
Apr 1, 2026
Merged

mmitche merged 3 commits into
release/11.0.1xx-preview3from
port-signcheck-msi-cab-verification

Conversation

@ViktorHofer

Copy link
Copy Markdown
Member

Fix SignCheck MSI/MSP/CAB/MSU signature verification on .NET Core

Problem

The default AuthentiCodeSecurityInfoProvider uses PEReader to extract Authenticode signatures, which only works for PE files (EXE/DLL). When SignCheck validates signed MSI, MSP, CAB, or MSU files, it fails with:

Invalid number of sections declared in PE header

Root Cause

  • MSI/MSP files are OLE Compound Documents. Their Authenticode signature is stored in a named stream (\x05DigitalSignature), not in a PE header.
  • CAB/MSU files use the cabinet format. Their PKCS#7 signature is stored at an offset specified in the per-cabinet reserved area of the cabinet header.

Fix

Added format-specific ISecurityInfoProvider implementations:

  • OleStorageSecurityInfoProvider - Reads the digital signature from the OLE structured storage \x05DigitalSignature stream (for MSI/MSP).
  • CabSecurityInfoProvider - Reads the PKCS#7 signature from the cabinet header's per-cabinet reserved area (for CAB/MSU).

Each verifier now passes the appropriate provider to the AuthentiCodeVerifier base class.

Upstream PR

Port of dotnet/arcade#16658

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team April 1, 2026 12:30
@ViktorHofer
ViktorHofer force-pushed the port-signcheck-msi-cab-verification branch from 5c366ba to 3d7ac01 Compare April 1, 2026 12:35
The default AuthentiCodeSecurityInfoProvider uses PEReader to extract
Authenticode signatures, which only works for PE files (EXE/DLL).

- MSI/MSP: Add OleStorageSecurityInfoProvider that reads the digital
  signature from the OLE structured storage \x05DigitalSignature stream.
- CAB/MSU: Add CabSecurityInfoProvider that reads the PKCS#7 signature
  from the cabinet header's per-cabinet reserved area.

This fixes 'Invalid number of sections declared in PE header' errors
when SignCheck validates signed MSI/MSP/CAB/MSU files.

Co-authored-by: Copilot <[email protected]>
@ViktorHofer
ViktorHofer force-pushed the port-signcheck-msi-cab-verification branch from 3d7ac01 to e81a2b7 Compare April 1, 2026 12:36
@ViktorHofer
ViktorHofer enabled auto-merge (squash) April 1, 2026 13:10
@mmitche
mmitche disabled auto-merge April 1, 2026 20:15
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team April 1, 2026 20:15
@mmitche
mmitche merged commit d918144 into release/11.0.1xx-preview3 Apr 1, 2026
11 checks passed
@mmitche
mmitche deleted the port-signcheck-msi-cab-verification branch April 1, 2026 20:17
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.

4 participants