fix(deps): pin System.Security.Cryptography.Xml 10.0.6 for CVE-2026-26171/33116 - #681
Merged
Merged
Conversation
…6171/33116 Patches GHSA-w3x6-4m5h-cxqf (CVE-2026-26171) and GHSA-37gx-xxp4-5rgx (CVE-2026-33116) — HIGH-severity DoS vulnerabilities in System.Security.Cryptography.Xml affecting 10.0.0–10.0.5, fixed in 10.0.6. Cannot bump Microsoft.AspNetCore.DataProtection to 10.0.6 alongside it: that release has a regression in ManagedAuthenticatedEncryptor.CalculateAndValidateMac where the ComputeHash return value is discarded and the compare runs against an uninitialized buffer, causing every IDataProtector.Unprotect call to throw "The payload was invalid" on Linux/macOS — even same-process round-trips. Upstream issue: dotnet/aspnetcore#65889 (fix merged as #65934 but missed the 10.0.6 snap). Workaround: add System.Security.Cryptography.Xml as a direct package reference in Netclaw.Configuration so NuGet's highest-version-wins rule promotes the transitive dep to 10.0.6 while keeping DataProtection at 10.0.5. Drop the pin when 10.0.7 ships.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Patches two HIGH-severity DoS CVEs in
System.Security.Cryptography.Xmlby pinning the transitive dep to10.0.6via a directPackageReferenceinNetclaw.Configuration, while keepingMicrosoft.AspNetCore.DataProtectionat10.0.5.Supersedes #676 (closed).
Why not bump DataProtection to 10.0.6?
Microsoft.AspNetCore.DataProtection 10.0.6has a regression inManagedAuthenticatedEncryptor.CalculateAndValidateMacthat breaks everyIDataProtector.Unprotectcall on Linux/macOS — even same-process round-trips with a fresh key ring. The MAC compare runs against an uninitialized stack buffer because theComputeHashreturn value is discarded, so the time-constant compare always returns false and throwsCryptographicException: The payload was invalid.On #676 this surfaced as failures across every test touching encrypted secrets:
DataProtectionSecretsProtectorTests,SecretsFileWriterTests,SensitiveStringConverterTests,ConfigFileHelperSecretsRoundTripTests,McpCommandTests.Add_With*_WritesSecretsFile,ProviderManagerViewModelTests,ProviderCommandTests,SlackAuthDoctorCheckTests, etc. — all with the sameManagedAuthenticatedEncryptor.CalculateAndValidateMacstack frame.I reproduced locally and confirmed by decompiling both assemblies with `ilspycmd`:
lib/net10.0assembly — correct: uses `HMACSHA256.HashData(validationSubkey, hashSource, correctHash)` where `hashSource = payloadArray[ivOffset..macOffset]`, then compares the computed hash to the payload MAC.lib/net10.0assembly — buggy: calls `keyedHashAlgorithm.ComputeHash(payloadArray, macOffset, eofOffset - macOffset)` (hashing the MAC region, not IV+ciphertext), throws the return value away, then compares the uninitialized `correctHash` buffer against the payload MAC.This is the latent bug from dotnet/aspnetcore#65889. The fix (#65890, backported as #65934) merged to `release/10.0` on Mar 24, but the `dotnet/dotnet` commit 10.0.6 was built from (`47fb725a`, Mar 26) didn't include it — I verified the file at that SHA still has the pre-fix body. So the fix missed the 10.0.6 snap.
Unrelated side note: the `net10.0` assembly in 10.0.6 is also hitting the pre-`NET10_0_OR_GREATER` code path (no `HashData`, no `SetKey`/`EncryptCbc`, just `MemoryStream` + `CryptoStream`), even though the source and csproj are byte-identical to 10.0.5's snap. That's a build-environment regression in Microsoft's pipeline, separate from the MAC bug — but the combination is what makes the Managed path actively throw instead of silently using a slower code path.
How the pin works
`Microsoft.AspNetCore.DataProtection 10.0.5` declares a transitive dep on `System.Security.Cryptography.Xml 10.0.5`. Adding a direct `PackageReference Include="System.Security.Cryptography.Xml"` in `Netclaw.Configuration` (the only project that references DataProtection) lets NuGet's highest-version-wins rule promote the transitive to `10.0.6`. Verified in `project.assets.json`:
```
"System.Security.Cryptography.Xml/10.0.6": { "type": "package", ... }
```
Same pattern as petabridge/llm-email-gateway#739.
Test plan
dotnet test src/Netclaw.Configuration.Tests/Netclaw.Configuration.Tests.csproj --filter DataProtectionSecretsProtectorTests.Round_trip_preserves_value— passes locallySecretsFileWriterTests.DecryptJsonLeaves_round_trips_with_encrypt— passes locallyproject.assets.jsoninNetclaw.ConfigurationshowsSystem.Security.Cryptography.Xml/10.0.6resolvedMicrosoft.AspNetCore.DataProtection 10.0.7ships with theManagedAuthenticatedEncryptorfix