If you run ASP.NET Core on .NET 10 and you haven't updated in the last 48 hours, stop reading and update now. Microsoft released an emergency out-of-band patch for CVE-2026-40372 — a CVSS 9.1 privilege escalation vulnerability in the Data Protection stack that lets unauthenticated attackers forge authentication cookies and decrypt protected payloads. This isn't a theoretical concern: the bug sits in the cryptographic validation path that guards every cookie, antiforgery token, and TempData value your application issues.
But here's the part most teams will miss: updating to .NET 10.0.7 fixes the validation routine, but it doesn't invalidate tokens that were forged while the bug was live. If your application served internet-facing traffic on any .NET 10 release from 10.0.0 through 10.0.6, patching is step one of a multi-step response.
What Broke
ASP.NET Core's Data Protection system uses AES-256-CBC with HMACSHA256 for authenticated encryption. The flow is straightforward: encrypt the payload, compute an HMAC tag over the ciphertext, and append it. On decryption, verify the HMAC before touching the ciphertext. This "encrypt-then-MAC" pattern is the industry standard for preventing tampering.
The bug in Microsoft.AspNetCore.DataProtection versions 10.0.0 through 10.0.6 broke both sides of that contract. The managed authenticated encryptor computed its HMAC validation tag over the wrong bytes of the payload and then, in some cases, discarded the computed hash entirely. The server would accept tampered ciphertext as legitimate.
// IMPORTANT
Microsoft classifies this as CWE-347 (Improper Verification of Cryptographic Signature). The CVSS vector is AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N — network-exploitable, no privileges required, no user interaction needed, with high impact on both confidentiality and integrity.
The Exploitation Path
With HMAC validation effectively disabled, the vulnerability opens a classic padding-oracle attack surface. An attacker can repeatedly modify ciphertext and observe the server's response to recover plaintext block by block. This requires many requests per byte recovered, but the attack is well-understood and automatable.
The practical impact goes beyond reading protected data. Once an attacker can forge a valid authentication cookie, the application treats them as the impersonated user. Worse, during that authenticated session, the application may issue legitimate downstream artefacts — refresh tokens, API keys, password reset links — that are properly signed with the real key material. Those artefacts survive the patch because they were genuinely issued by your application.
This is what makes CVE-2026-40372 different from a typical "update and move on" vulnerability. The attack creates legitimate credentials that outlive the bug.
What's Affected
The vulnerability exists in the managed cryptographic implementation path, which means the impact varies by platform:
Primary affected configurations:
- .NET 10 applications on Linux and macOS, which use the managed encryptor by default
- Applications on any OS that consume the
net462ornetstandard2.0target framework assets from the NuGet package (these always use the managed path)
Less affected:
- .NET 10 on Windows using the default CNG (Cryptography Next Generation) implementation — the CNG code path is separate from the managed encryptor and was not affected at this layer
// WARNING
Don't assume Windows means safe. If your application explicitly configures a non-default encryptor, or if you're consuming the package via net462/netstandard2.0 assets, you're on the managed path regardless of OS.
Everything Data Protection Touches
Before deciding this doesn't affect you, consider what Data Protection actually secures in a typical ASP.NET Core application:
- Authentication cookies — session identity for cookie-based auth
- Antiforgery tokens — CSRF protection on forms and AJAX requests
- TempData — the cookie-based TempData provider encrypts values with Data Protection
- OAuth/OIDC state parameters — correlation values that prevent authorisation code interception
- Custom
IDataProtectorusage — anything you've explicitly encrypted with the Data Protection API
If the server can't reliably distinguish authentic protected data from attacker-controlled ciphertext, this stops being a narrow cryptography issue and becomes a trust-boundary failure across your entire request pipeline.
How It Was Discovered
The vulnerability came to light almost accidentally. After the .NET 10.0.6 Patch Tuesday release in April 2026, users started reporting decryption failures in their applications (tracked in dotnet/aspnetcore#66335). Microsoft's investigation into these decryption regressions revealed the underlying HMAC validation flaw — a bug that had been present since .NET 10.0.0 but only became apparent when a related code change in 10.0.6 started causing visible failures.
Microsoft compared the vulnerability to MS10-070, which exploited a similar padding-oracle condition in ASP.NET's legacy encryption infrastructure back in 2010. The parallel is apt: both involve broken cryptographic validation in a framework component that applications trust implicitly.
Step 1: Patch
Update Microsoft.AspNetCore.DataProtection to 10.0.7 or install the .NET 10.0.7 runtime:
dotnet --info | grep "Microsoft.AspNetCore.App"
Verify you're running 10.0.7 or later. For containerised deployments, rebuild your images — updating the host runtime doesn't help if your container ships the vulnerable binary.
Check for transitive dependencies pulling in the old package:
dotnet package list --include-transitive --vulnerable
// TIP
Use dotnet nuget why to trace exactly how a vulnerable package enters your dependency graph. Direct references are obvious; transitive ones often aren't.
Step 2: Rotate the Key Ring
This is the step most teams will skip, and it's the most important one for internet-facing applications. Patching fixes the validation routine going forward, but any tokens forged during the vulnerable window remain valid until the keys that issued them are revoked.
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddDataProtection();
// Add your key storage configuration — FileSystem, DbContext, Redis, Azure Blob, etc.
using var provider = services.BuildServiceProvider();
var keyManager = provider.GetRequiredService<IKeyManager>();
keyManager.RevokeAllKeys(
revocationDate: DateTimeOffset.UtcNow,
reason: "Emergency revocation: CVE-2026-40372 remediation");
This forces all new protection operations onto fresh keys and invalidates every previously-issued protected payload. The consequences are intentional and immediate:
- All users are signed out and must re-authenticate
- Antiforgery tokens in flight are invalidated (forms submitted during the rotation window will fail)
- TempData from prior requests is lost
- OAuth/OIDC state parameters from in-progress flows become invalid
// WARNING
If you run a web farm, the key revocation must propagate to the shared key store (database, Redis, Azure Blob Storage, file share) before all nodes pick it up. Ensure your key ring persistence is correctly configured before running the revocation.
Step 3: Audit Application-Layer Artefacts
Key rotation handles everything Data Protection encrypts directly. But if an attacker used a forged cookie to authenticate and then triggered your application to issue downstream artefacts, those live outside the key ring:
- Refresh tokens stored in your database
- API keys generated during authenticated sessions
- Password reset links and email confirmation tokens
- Any long-lived capability issued by an authenticated endpoint
These need to be invalidated or rotated separately. If you store creation timestamps, you can scope the invalidation to the vulnerable window. If you don't — consider invalidating all active tokens and forcing reissuance.
Step 4: Rotate Secrets Protected by Data Protection
This is the step that catches people off guard. If your application uses IDataProtector.Protect() to encrypt long-lived secrets — database connection strings, third-party API keys, sensitive configuration values — those secrets should be treated as potentially disclosed.
// Bad — if this pattern exists in your codebase, rotate the underlying secret
var encrypted = protector.Protect(thirdPartyApiKey);
await store.SaveAsync("payment-gateway-key", encrypted);
The encrypted value itself isn't the concern — it's that an attacker with a forged cookie could have called endpoints that return or use the decrypted value. Rotate the secrets at their source (the third-party dashboard, the database password, the storage account key).
Step 5: Hunt for Exploitation Evidence
If your application was internet-facing during the vulnerable window, check your logs for signs of a padding-oracle attack:
- Abnormal request volume against authentication endpoints (login callbacks, token refresh, CSRF-protected routes)
- Repeated requests with varying cookie or parameter values against the same route — the hallmark of an oracle probe
- Correlation failed errors in OpenID Connect middleware
- Unexpected authentication failures followed by successful ones
- Antiforgery validation failures in bursts
# Search application logs for correlation failures during the vulnerable window
grep -i "correlation failed\|antiforgery.*failed\|data protection.*failed" /var/log/app/*.log
// NOTE
Absence of evidence is not evidence of absence. A sophisticated attacker may have probed during low-traffic windows or used distributed source IPs. Treat the key rotation and artefact audit as necessary regardless of what your logs show.
Verifying Remediation
After completing all steps, validate that the fix is working:
- Old cookies are rejected — attempt to use a pre-rotation authentication cookie and confirm it's denied
- Pre-rotation reset links fail — password reset tokens issued before key rotation should no longer work
- Fresh artefacts succeed — new logins, new tokens, and new protected payloads work normally
dotnet package list --vulnerablereturns clean forMicrosoft.AspNetCore.DataProtection
Common Pitfalls
Confusing runtime and package patching. Containerised deployments must rebuild images with the updated NuGet package or runtime. Patching the host operating system doesn't change what's inside the container.
Checking only direct dependencies. Many applications reference Microsoft.AspNetCore.DataProtection transitively through authentication, identity, or antiforgery packages. Use --include-transitive when checking for vulnerable packages.
Assuming patching is the complete response. The patch fixes the validation routine. It doesn't revoke forged tokens, invalidate downstream artefacts, or rotate compromised secrets. Those are separate, mandatory steps for any application that was exposed.
Misunderstanding the Windows exception. The CNG code path exception applies only to net10.0 framework-dependent deployments on Windows. If your application targets net462 or netstandard2.0, or explicitly configures a managed encryptor, you're vulnerable on Windows too.
Skipping key rotation because "we're internal." Internal applications behind a VPN are lower risk, but not zero risk. If your threat model includes compromised internal networks (and it should), the key rotation cost — a brief user disruption — is worth the certainty.
Summary
- CVE-2026-40372 is a CVSS 9.1 privilege escalation in
Microsoft.AspNetCore.DataProtection10.0.0-10.0.6 that breaks HMAC validation, enabling authentication cookie forgery - The managed encryptor path is affected — primarily Linux/macOS deployments and any application using
net462/netstandard2.0assets - Upgrade to 10.0.7 immediately, but don't stop there
- Rotate the DataProtection key ring with
IKeyManager.RevokeAllKeys()to invalidate tokens forged during the vulnerable window - Audit and invalidate application-layer artefacts (refresh tokens, API keys, reset links) issued during the exposure period
- Rotate any long-lived secrets that were encrypted with Data Protection
- Review logs for padding-oracle attack patterns, but treat remediation steps as necessary regardless of findings