You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft Security Advisory CVE-2021-34532 | ASP.NET Core Information Disclosure Vulnerability
Executive summary
Microsoft is releasing this security advisory to provide information about a vulnerability in .NET 5.0, .NET Core 3.1 and .NET Core 2.1. This advisory also provides guidance on what developers can do to update their applications to remove this vulnerability.
An information disclosure vulnerability exists in .NET 5.0, .NET Core 3.1 and .NET Core 2.1 where a JWT token is logged if it cannot be parsed.
Microsoft has not identified any mitigating factors for this vulnerability.
Important Update
The .NET Core 2.1.29 August update did not include the correct fix for CVE-2021-34532. To resolve this, we are re-releasing the August security update for .NET Core 2.1 as 2.1.30. If you have installed .NET Core 2.1.29 previously you need to install the .NET Core 2.1.30 update in order to be fully protected.
Note: .NET Core 3.1 and .NET 5.0 August updates are not affected and therefore not being re-released.
Affected software
Any ASP.NET Core based application that uses Microsoft.AspNetCore.Authentication.JwtBearer with a vulnerable version listed below.
Package name
Vulnerable versions
Secure versions
Microsoft.AspNetCore.Authentication.JwtBearer
2.1.2 or lower
2.1.30
Microsoft.AspNetCore.Authentication.JwtBearer
3.1.17 or lower
3.1.18
Microsoft.AspNetCore.Authentication.JwtBearer
5.0.8 or lower
5.0.9
How do I know if I am affected?
If you have a runtime or SDK with a version listed in affected software, you're exposed to the vulnerability.
How do I fix the issue?
To fix the issue, please install the latest version of .NET 5.0, .NET Core 3.1 or .NET Core 2.1. If you have installed one or more .NET Core SDKs through Visual Studio, Visual Studio will prompt you to update Visual Studio, which will also update your .NET Core SDKs.
You can list the versions you have installed by running the dotnet --info command. You should see an output like the following:
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.100\
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
.NET Core SDKs installed:
3.1.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
If you're using .NET 5.0, you should download and install Runtime 5.0.9 or SDK 5.0.206 (for Visual Studio 2019 v16.8) or SDK 5.0.303 (for Visual Studio 2019 V16.10) from https://dotnet.microsoft.com/download/dotnet-core/5.0.
If you're using .NET Core 3.1, you should download and install Runtime 3.1.18 or SDK 3.1.118 (for Visual Studio 2019 v16.4) or 3.1.412 (for Visual Studio 2019 v16.7 or later) from https://dotnet.microsoft.com/download/dotnet-core/3.1.
.NET 5.0, .NET Core 3.1 and .NET Core 2.1 updates are also available from Microsoft Update. To access this either type "Check for updates" in your Windows search, or open Settings, choose Update & Security and then click Check for Updates.
Once you have installed the updated runtime or SDK, restart your apps for the update to take effect.
Additionally, if you've deployed self-contained applications targeting any of the impacted versions, these applications are also vulnerable and must be recompiled and redeployed.
Updating .NET Core 2.1 on .NET Framework
If you are running .NET Core 2.1 on .NET Framework you need to check your projects for dependencies and update them accordingly.
Direct dependencies
Direct dependencies are discoverable by examining your csproj file. They can be fixed by editing the project file or using NuGet to update the dependency.
Transitive dependencies
Transitive dependencies occur when you add a package to your project that in turn relies on another package. For example, if Contoso publishes a package Contoso.Utility which, in turn, depends on Contoso.Internals and you add the Contoso.Utility package to your project now your project has a direct dependency on Contoso.Utility and, because Contoso.Utility depends 'Contoso.Internals', your application gains a transitive dependency on the Contoso.Internals package.
Transitive dependencies are reviewable in two ways:
In the Visual Studio Solution Explorer window, which supports searching.
By examining the project.assets.json file contained in the obj directory of your project for csproj based projects
The project.assets.json files are the authoritative list of all packages used by your project, containing both direct and transitive dependencies.
To use Solution Explorer, open the project in Visual Studio, and then press Ctrl+; to activate the search in Solution Explorer. Search for the vulnerable package and make a note of the version numbers of any results you find.
For example, search for Microsoft.AspNetCore.Authentication.JwtBearer and update the package to the latest version
Manually reviewing project.assets.json
Open the project.assets.json file from your project’s obj directory in your editor. We suggest you use an editor that understands JSON and allows you to collapse and expand nodes to review this file.
Visual Studio and Visual Studio Code provide JSON friendly editing.
Search the project.assets.json file for the vulnerable package, using the format packagename/ for each of the package names from the preceding table. If you find the assembly name in your search:
Examine the line on which they are found, the version number is after the /.
For example, a search result that shows Microsoft.AspNetCore.Authentication.JwtBearer/2.1.0 is a reference to version 2.1.1 of Microsoft.AspNetCore.Authentication.JwtBearer.
If your project.assets.json file includes references to the vulnerable package, then you need to fix the transitive dependencies.
If you have not found any reference to any vulnerable packages, this means either
None of your direct dependencies depend on any vulnerable packages, or
You have already fixed the problem by updating the direct dependencies.
How do I fix the issue?
Fixing direct dependencies
Open projectname.csproj in your editor. If you're using Visual Studio, right-click the project and choose Edit projectname.csproj from the context menu, where projectname is the name of your project. Look for PackageReference elements. The following shows an example project file:
The preceding example has a reference to the vulnerable package, as seen by the single PackageReference element. The name of the package is in the Include attribute.
The package version number is in the Version attribute. The previous example shows a single direct dependency on Microsoft.AspNetCore.App version 2.1.1
To update the version to the secure package, change the version number to the updated package version as listed on the table previously.
In this example, update Microsoft.AspNetCore.App to the appropriate fixed package number for your major version. Save the csproj file. The example csproj now looks as follows:
If you're using Visual Studio and you save your updated csproj file, Visual Studio will restore the new package version.
You can see the restore results by opening the Output window (Ctrl+Alt+O) and changing the Show output from drop-down list to Package Manager.
If you're not using Visual Studio, open a command line and change to your project directory. Execute the dotnet restore command to restore the updated dependencies.
Now recompile your application. If after recompilation you see a Dependency conflict warning, you must update your other direct dependencies to versions that take a dependency on the updated package.
Fixing transitive dependencies
If your transitive dependency review found references to the vulnerable package, you must add a direct dependency to the updated package to your csproj file to override the transitive dependency.
Open projectname.csproj in your editor. If you're using Visual Studio, right-click the project and choose Edit projectname.csproj from the context menu, where projectname is the name of your project.
Look for PackageReference nodes, for example:
You must add a direct dependency to the updated version of the vulnerable package by adding it to the csproj file.
You do this by adding a new line to the dependencies section, referencing the fixed version.
For example, if your search showed a transitive reference to a vulnerable Microsoft.AspNetCore.SpaServices version, you'd add a reference to the fixed package number.
We service .NET Core 2.1 incrementally. This means that users who reference the Microsoft.AspNetCore.Authentication.AzureAD.UI or Microsoft.AspNetCore.Authentication.AzureADB2C.UI package must add a reference to Microsoft.AspNetCore.Authentication.JwtBearer.
The shared framework for .NET Core 3.1 and later does not include Microsoft.AspNetCore.Authentication.JwtBearer.dll. Users targeting netcoreapp3.1 or later must also update their Microsoft.AspNetCore.Authentication.JwtBearer package version.
We service .NET Core 3.1 and later completely. This means users who reference Microsoft.AspNetCore.Authentication.AzureAD.UI or Microsoft.AspNetCore.Authentication.AzureADB2C.UI can bump that version to 2.1.30. They don't need a new Microsoft.AspNetCore.Authentication.JwtBearer reference.
After you've added the direct dependency reference, save your csproj file.
If you're using Visual Studio, save your updated csproj file and Visual Studio will restore the new package versions.
You can see the restore results by opening the Output window (Ctrl+Alt+O) and changing the Show output from drop-down list to Package Manager.
If you're not using Visual Studio, open a command line and change to your project directory. Execute the dotnet restore command to restore the new dependencies.
Rebuilding your application
Finally, you must rebuild your application, test, and redeploy.
Other Information
Reporting Security Issues
If you have found a potential security issue in .NET Core or .NET 5, please email details to secure@microsoft.com. Reports may qualify for the Microsoft .NET Core & .NET 5 Bounty. Details of the Microsoft .NET Bounty Program including terms and conditions are at https://aka.ms/corebounty.
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.
Microsoft Security Advisory CVE-2021-34532 | ASP.NET Core Information Disclosure Vulnerability
Executive summary
Microsoft is releasing this security advisory to provide information about a vulnerability in .NET 5.0, .NET Core 3.1 and .NET Core 2.1. This advisory also provides guidance on what developers can do to update their applications to remove this vulnerability.
An information disclosure vulnerability exists in .NET 5.0, .NET Core 3.1 and .NET Core 2.1 where a JWT token is logged if it cannot be parsed.
Discussion
Discussion for this issue can be found at dotnet/aspnetcore#35246
Mitigation factors
Microsoft has not identified any mitigating factors for this vulnerability.
Important Update
The .NET Core 2.1.29 August update did not include the correct fix for CVE-2021-34532. To resolve this, we are re-releasing the August security update for .NET Core 2.1 as 2.1.30. If you have installed .NET Core 2.1.29 previously you need to install the .NET Core 2.1.30 update in order to be fully protected.
Note: .NET Core 3.1 and .NET 5.0 August updates are not affected and therefore not being re-released.
Affected software
Any ASP.NET Core based application that uses
Microsoft.AspNetCore.Authentication.JwtBearer
with a vulnerable version listed below.How do I know if I am affected?
If you have a runtime or SDK with a version listed in affected software, you're exposed to the vulnerability.
How do I fix the issue?
To fix the issue, please install the latest version of .NET 5.0, .NET Core 3.1 or .NET Core 2.1. If you have installed one or more .NET Core SDKs through Visual Studio, Visual Studio will prompt you to update Visual Studio, which will also update your .NET Core SDKs.
You can list the versions you have installed by running the
dotnet --info
command. You should see an output like the following:If you're using .NET 5.0, you should download and install Runtime 5.0.9 or SDK 5.0.206 (for Visual Studio 2019 v16.8) or SDK 5.0.303 (for Visual Studio 2019 V16.10) from https://dotnet.microsoft.com/download/dotnet-core/5.0.
If you're using .NET Core 3.1, you should download and install Runtime 3.1.18 or SDK 3.1.118 (for Visual Studio 2019 v16.4) or 3.1.412 (for Visual Studio 2019 v16.7 or later) from https://dotnet.microsoft.com/download/dotnet-core/3.1.
If you're using .NET Core 2.1, you should download and install Runtime 2.1.30 or SDK 2.1.526 (for Visual Studio 2019 v15.9) or 2.1.818 from https://dotnet.microsoft.com/download/dotnet-core/2.1.
If your application is using .NET Core 2.1 running on .NET Framework see the Updating .NET Core 2.1 on .NET Framework section below.
.NET 5.0, .NET Core 3.1 and .NET Core 2.1 updates are also available from Microsoft Update. To access this either type "Check for updates" in your Windows search, or open Settings, choose Update & Security and then click Check for Updates.
Once you have installed the updated runtime or SDK, restart your apps for the update to take effect.
Additionally, if you've deployed self-contained applications targeting any of the impacted versions, these applications are also vulnerable and must be recompiled and redeployed.
Updating .NET Core 2.1 on .NET Framework
If you are running .NET Core 2.1 on .NET Framework you need to check your projects for dependencies and update them accordingly.
Direct dependencies
Direct dependencies are discoverable by examining your
csproj
file. They can be fixed by editing the project file or using NuGet to update the dependency.Transitive dependencies
Transitive dependencies occur when you add a package to your project that in turn relies on another package. For example, if Contoso publishes a package
Contoso.Utility
which, in turn, depends onContoso.Internals
and you add theContoso.Utility
package to your project now your project has a direct dependency onContoso.Utility
and, becauseContoso.Utility
depends 'Contoso.Internals', your application gains a transitive dependency on theContoso.Internals
package.Transitive dependencies are reviewable in two ways:
project.assets.json
file contained in the obj directory of your project forcsproj
based projectsThe
project.assets.json
files are the authoritative list of all packages used by your project, containing both direct and transitive dependencies.There are two ways to view transitive dependencies. You can either use Visual Studio’s Solution Explorer, or you can review the
project.assets.json
file).Using Visual Studio Solution Explorer
To use Solution Explorer, open the project in Visual Studio, and then press Ctrl+; to activate the search in Solution Explorer. Search for the vulnerable package and make a note of the version numbers of any results you find.
For example, search for
Microsoft.AspNetCore.Authentication.JwtBearer
and update the package to the latest versionManually reviewing project.assets.json
Open the project.assets.json file from your project’s obj directory in your editor. We suggest you use an editor that understands JSON and allows you to collapse and expand nodes to review this file.
Visual Studio and Visual Studio Code provide JSON friendly editing.
Search the project.assets.json file for the vulnerable package, using the format
packagename/
for each of the package names from the preceding table. If you find the assembly name in your search:/
.For example, a search result that shows
Microsoft.AspNetCore.Authentication.JwtBearer/2.1.0
is a reference to version 2.1.1 ofMicrosoft.AspNetCore.Authentication.JwtBearer
.If your project.assets.json file includes references to the vulnerable package, then you need to fix the transitive dependencies.
If you have not found any reference to any vulnerable packages, this means either
How do I fix the issue?
Fixing direct dependencies
Open projectname.csproj in your editor. If you're using Visual Studio, right-click the project and choose Edit projectname.csproj from the context menu, where projectname is the name of your project. Look for
PackageReference
elements. The following shows an example project file:The preceding example has a reference to the vulnerable package, as seen by the single
PackageReference
element. The name of the package is in theInclude
attribute.The package version number is in the
Version
attribute. The previous example shows a single direct dependency onMicrosoft.AspNetCore.App
version 2.1.1To update the version to the secure package, change the version number to the updated package version as listed on the table previously.
In this example, update
Microsoft.AspNetCore.App
to the appropriate fixed package number for your major version. Save the csproj file. The example csproj now looks as follows:If you're using Visual Studio and you save your updated csproj file, Visual Studio will restore the new package version.
You can see the restore results by opening the Output window (Ctrl+Alt+O) and changing the Show output from drop-down list to Package Manager.
If you're not using Visual Studio, open a command line and change to your project directory. Execute the
dotnet restore
command to restore the updated dependencies.Now recompile your application. If after recompilation you see a Dependency conflict warning, you must update your other direct dependencies to versions that take a dependency on the updated package.
Fixing transitive dependencies
Open projectname.csproj in your editor. If you're using Visual Studio, right-click the project and choose Edit projectname.csproj from the context menu, where projectname is the name of your project.
Look for
PackageReference
nodes, for example:You must add a direct dependency to the updated version of the vulnerable package by adding it to the csproj file.
You do this by adding a new line to the dependencies section, referencing the fixed version.
For example, if your search showed a transitive reference to a vulnerable
Microsoft.AspNetCore.SpaServices
version, you'd add a reference to the fixed package number.We service .NET Core 2.1 incrementally. This means that users who reference the
Microsoft.AspNetCore.Authentication.AzureAD.UI
orMicrosoft.AspNetCore.Authentication.AzureADB2C.UI
package must add a reference toMicrosoft.AspNetCore.Authentication.JwtBearer
.The shared framework for .NET Core 3.1 and later does not include
Microsoft.AspNetCore.Authentication.JwtBearer.dll
. Users targeting netcoreapp3.1 or later must also update theirMicrosoft.AspNetCore.Authentication.JwtBearer
package version.We service .NET Core 3.1 and later completely. This means users who reference
Microsoft.AspNetCore.Authentication.AzureAD.UI
orMicrosoft.AspNetCore.Authentication.AzureADB2C.UI
can bump that version to 2.1.30. They don't need a newMicrosoft.AspNetCore.Authentication.JwtBearer
reference.After you've added the direct dependency reference, save your csproj file.
If you're using Visual Studio, save your updated csproj file and Visual Studio will restore the new package versions.
You can see the restore results by opening the Output window (Ctrl+Alt+O) and changing the Show output from drop-down list to Package Manager.
If you're not using Visual Studio, open a command line and change to your project directory. Execute the
dotnet restore
command to restore the new dependencies.Rebuilding your application
Finally, you must rebuild your application, test, and redeploy.
Other Information
Reporting Security Issues
If you have found a potential security issue in .NET Core or .NET 5, please email details to secure@microsoft.com. Reports may qualify for the Microsoft .NET Core & .NET 5 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/runtime and https://github.com/dotnet/aspnet/. 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
CVE-2021-34532
Revisions
V1.1 (August 19, 2021): Advisory Updated.
Version 1.1
V1.0 (August 10, 2021): Advisory published.
Version 1.0
Last Updated 2021-08-19
The text was updated successfully, but these errors were encountered: