Repository navigation
Description
Executive summary
Microsoft is releasing this security advisory to provide information about a vulnerability in ASP.NET Core. This advisory provides guidance on updating affected applications and components.
ASP.NET Core Identity scaffolding templates use the request-supplied email instead of the account's stored email for password-reset and confirmation messages.
Discussion
Discussion for this issue can be found at dotnet/Scaffolding#3959
CVSS Details
- Version: 3.1
- Severity: High
- Score: 8.1 (base score)
- Vector:
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C - Weakness: CWE-640
Affected Platforms
- Platforms: Any supported OS
- Architectures: All
Affected Packages
Updating scaffolding packages/tools does not repair previously generated application code.
Microsoft.VisualStudio.Web.CodeGenerators.Mvc contains the affected templates. Microsoft.VisualStudio.Web.CodeGeneration.Design is a parent package that brings in the MVC generator through a minimum-version dependency. For Design, applicability depends on the resolved MVC generator: a project that independently resolves a fixed MVC version does not become vulnerable merely because it retains an older Design reference.
8.0 - standalone packages
| Package | Affected version | Patched version |
|---|---|---|
| Microsoft.VisualStudio.Web.CodeGenerators.Mvc | >= 8.0.0, <= 8.0.23 | 8.0.24 |
| Microsoft.VisualStudio.Web.CodeGeneration.Design | >= 8.0.0, <= 8.0.23 | 8.0.24 |
9.0 - standalone packages
| Package | Affected version | Patched version |
|---|---|---|
| Microsoft.VisualStudio.Web.CodeGenerators.Mvc | >= 9.0.0, <= 9.0.12 | 9.0.13 |
| Microsoft.VisualStudio.Web.CodeGeneration.Design | >= 9.0.0, <= 9.0.12 | 9.0.13 |
10.0 - standalone packages
| Package | Affected version | Patched version |
|---|---|---|
| Microsoft.VisualStudio.Web.CodeGenerators.Mvc | >= 10.0.0, <= 10.0.2 | 10.0.3 |
| Microsoft.VisualStudio.Web.CodeGeneration.Design | >= 10.0.0, <= 10.0.2 | 10.0.3 |
Additional known affected scaffolding prereleases
These are exact known affected versions, not continuous prerelease intervals.
| Package | Affected version | Patched version |
|---|---|---|
| Microsoft.VisualStudio.Web.CodeGenerators.Mvc | = 8.0.0-preview.1.23117.2 | 8.0.24 |
| Microsoft.VisualStudio.Web.CodeGeneration.Design | = 8.0.0-preview.1.23117.2 | 8.0.24 |
| Microsoft.VisualStudio.Web.CodeGenerators.Mvc | = 9.0.0-preview.1.24112.3 | 9.0.13 |
| Microsoft.VisualStudio.Web.CodeGeneration.Design | = 9.0.0-preview.1.24112.3 | 9.0.13 |
| Microsoft.VisualStudio.Web.CodeGenerators.Mvc | = 10.0.0-rc.1.25458.5 | 10.0.3 |
| Microsoft.VisualStudio.Web.CodeGeneration.Design | = 10.0.0-rc.1.25458.5 | 10.0.3 |
Standalone ProjectTemplates packages
| Package | Affected version | Patched version |
|---|---|---|
| Microsoft.DotNet.Web.ProjectTemplates.8.0 | >= 8.0.0, <= 8.0.33 | 8.0.34 |
| Microsoft.DotNet.Web.ProjectTemplates.9.0 | >= 9.0.0, <= 9.0.22 | 9.0.23 |
| Microsoft.DotNet.Web.ProjectTemplates.10.0 | >= 10.0.0, <= 10.0.14 | 10.0.15 |
Additional exact known affected ProjectTemplates prereleases:
| Package | Affected version | Patched version |
|---|---|---|
| Microsoft.DotNet.Web.ProjectTemplates.8.0 | = 8.0.0-rc.2.23480.2 | 8.0.34 |
| Microsoft.DotNet.Web.ProjectTemplates.9.0 | = 9.0.0-preview.1.24081.5 | 9.0.23 |
| Microsoft.DotNet.Web.ProjectTemplates.10.0 | = 10.0.0-preview.1.25120.3 | 10.0.15 |
| Microsoft.DotNet.Web.ProjectTemplates.11.0 | = 11.0.0-preview.1.26104.118 | 11.0.0 |
| Microsoft.DotNet.Web.ProjectTemplates.11.0 | = 11.0.0-rc.3.26522.148 | 11.0.0 |
Additional scaffolding tools
| Tool | Affected version | Remediation |
|---|---|---|
| Microsoft.dotnet-scaffold-aspnet | >= 9.0.0, <= 9.0.12 | Migrate to Microsoft.dotnet-scaffold 20.3.0 |
| Microsoft.dotnet-scaffold | >= 10.0.0, <= 10.0.2 | Update to 20.3.0 |
Additional exact known affected tool prereleases:
| Tool | Affected version | Remediation |
|---|---|---|
| Microsoft.dotnet-scaffold-aspnet | = 9.0.0-preview.8.24467.5 | Migrate to Microsoft.dotnet-scaffold 20.3.0 |
| Microsoft.dotnet-scaffold-aspnet | = 9.0.0-preview.9.24509.5 | Migrate to Microsoft.dotnet-scaffold 20.3.0 |
Microsoft.dotnet-scaffold-aspnet has been incorporated into Microsoft.dotnet-scaffold. Version 20.3.0 supports .NET 8, 9, 10 and 11. Install it as a .NET tool, not as a project package reference. The MVC and Design project packages use the separate fixed versions listed above; 20.3.0 is not a version of those packages.
Microsoft.dotnet-scaffold 20.x
| Package | Affected version | Patched version |
|---|---|---|
| Microsoft.dotnet-scaffold | >= 20.0.0-preview.1.26156.3, <= 20.1.0 | 20.3.0 |
The 20.x tool contains the vulnerable Identity and Blazor templates for .NET 8.0 through 11.0.
Affected legacy prereleases
The following exact versions also contain affected templates:
- Microsoft.VisualStudio.Web.CodeGenerators.Mvc and Microsoft.VisualStudio.Web.CodeGeneration.Design:
11.0.0-preview.1.26156.3and11.0.0-preview.1.26230.3. - Microsoft.dotnet-scaffold-aspnet:
10.0.0-rc.1.25458.5and10.0.0-rc.1.25468.1.
Apply the generated-code repair below to applications created with these versions. For new scaffolding, use the Microsoft.dotnet-scaffold 20.3.0 tool, which supports .NET 8 through 11. Migrating to that tool is not an update to an MVC or Design project package reference and does not repair previously generated code.
Advisory FAQ
How do I know if I am affected?
Check both the installed scaffolding package/tool version and the code it generated. Applications generated with an affected template remain affected after the tool is updated unless their handlers are corrected.
The dotnet-aspnet-codegenerator command loads generators from the application's dependencies. Check the project's Microsoft.VisualStudio.Web.CodeGeneration.Design and Microsoft.VisualStudio.Web.CodeGenerators.Mvc references against the versions above; updating only the command-line tool does not replace those project dependencies.
For applications created with dotnet new, check the selected SDK with dotnet --version in the working directory. Use dotnet new list to identify available templates and dotnet new uninstall without arguments to list separately installed template packages. Web ProjectTemplates can be bundled with an SDK or installed separately; a project package reference alone does not identify which template generated the application.
How do I fix the issue?
Update affected scaffolding packages/tools and project dependencies to the patched versions above before generating additional code. Updating scaffolding packages/tools does not repair previously generated applications. Change generated ForgotPassword and ResendEmailConfirmation handlers, including Blazor equivalents, to send only to the stored email returned for the located user; reject missing stored addresses, rebuild and redeploy affected apps.
For an existing global Microsoft.dotnet-scaffold installation, update the tool:
dotnet tool update --global Microsoft.dotnet-scaffold --version 20.3.0For Microsoft.dotnet-scaffold-aspnet installations, uninstall the old tool and install its replacement:
dotnet tool uninstall --global Microsoft.dotnet-scaffold-aspnet
dotnet tool install --global Microsoft.dotnet-scaffold --version 20.3.0For a new installation, use the install command alone. For local tools, use --local instead of --global and run the commands from the directory containing the tool manifest. Visual Studio installs and uses the updated scaffolding tool automatically; command-line installations must be updated separately. Visual Studio 17.14 uses the legacy CodeGeneration packages listed above; keep Visual Studio updated and check independently maintained project dependencies.
For SDK-bundled templates, install and select an updated SDK that includes the corrected ProjectTemplates version; check global.json if an older SDK remains selected. Update separately installed template packs independently. Updating the SDK does not necessarily replace a separately installed template pack. For the affected legacy prereleases, correct the generated handlers before using or deploying the generated application.
Manual repair for generated Identity handlers
This repair also applies to applications generated with the affected 11.0 scaffolding packages and Microsoft.dotnet-scaffold-aspnet 10.0 RC versions above; it does not require migrating to a different scaffolding tool.
In the generated ForgotPassword and ResendEmailConfirmation handlers, retain the existing user lookup, missing-user responses, password-reset confirmation checks, token generation and callback-URL encoding. After those user checks, retrieve the email from the located account before sending:
var storedEmail = await UserManager.GetEmailAsync(user);
if (string.IsNullOrEmpty(storedEmail))
{
throw new InvalidOperationException("Users must have an email.");
}In Razor Pages handlers, use _userManager instead of UserManager. Replace only the recipient argument Input.Email with storedEmail in _emailSender.SendEmailAsync, EmailSender.SendPasswordResetLinkAsync and EmailSender.SendConfirmationLinkAsync, as applicable. Keep Input.Email for the account lookup; do not use it as the message recipient. Apply the change to both handlers, including their Blazor equivalents, then rebuild and redeploy. Reapply the repair if affected templates generate the handlers again.
Other Information
Reporting Security Issues
If you have found a potential security issue in a supported version of .NET, please report it to the Microsoft Security Response Center (MSRC) via the MSRC Researcher Portal. Further information can be found in the MSRC Report an Issue FAQ.
Security reports made through MSRC may qualify for the Microsoft .NET Bounty. Details of the Microsoft .NET Bounty Program including terms and conditions are at https://aka.ms/corebounty.
Support
You can ask questions about this issue on GitHub in the .NET GitHub organization. The main repos are located at https://github.com/dotnet/Scaffolding. The Announcements repo (https://github.com/dotnet/Announcements) will contain this bulletin as an issue and will include a link to a discussion issue. You can ask questions in the linked discussion issue.
Disclaimer
The information provided in this advisory is provided "as is" without warranty of any kind. Microsoft disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Microsoft Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Microsoft Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.
External Links
Acknowledgements
- Leonardo Souza with Delfia
- Attila.Cs(zerodaybugs.com) with https://zerodaybugs.com/
Revisions
V1.0 (November 10, 2026): Advisory published.
Activity