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-2019-1302: ASP.NET Core Elevation Of Privilege Vulnerability
Executive summary
Microsoft is releasing this security advisory to provide information about a vulnerability in ASP.NET Core. This advisory also provides guidance on what developers can do to update their applications to remove this vulnerability.
Microsoft is aware of an elevation of privilege vulnerability exists when a ASP.NET Core web application, created using vulnerable project templates, fails to properly sanitize web requests. An attacker who successfully exploited this vulnerability could perform content injection attacks and run script in the security context of the logged-on user.
To exploit the vulnerability, an attacker could send a specially crafted email, containing a malicious link, to a user. Alternatively, an attacker could use a chat client to social engineer a user into clicking the malicious link. However, in all cases to exploit this vulnerability a user must click a maliciously crafted link from an attacker.
The update addresses the vulnerability by correcting how the .NET Core web application handles content encoding and updates the application templates to depend on the corrected code libraries.
If your application does not ASP.NET SPA services your application is not vulnerable.
Affected software
Any .NET Core based application running on ASP.NET Core 2.1.0-2.1.1, or ASP.NET Core 2.2.0 or any preview of ASP.NET Core 3.0.
Affected software
Any ASP.NET Core based application that uses Microsoft.AspNetCore.SpaServices with a vulnerable version listed below.
Package name
Vulnerable versions
Secure versions
Microsoft.AspNetCore.SpaServices
2.1.0-2.1.1 2.2.0
2.1.13 2.2.7
ASP.NET Core v3 will be updated with its RTM release.
How do I know if I am affected?
.NET Core has two types of dependencies: direct and transitive. Direct dependencies are dependencies where you specifically add a package to your project, transitive dependencies occur when you add a package to your project that in turn relies on another package.
For example, the Microsoft.AspNetCore.Mvc package depends on the Microsoft.AspNetCore.Mvc.Core package. When you add a dependency on Microsoft.AspNetCore.Mvc in your project, you're taking a transitive dependency on Microsoft.AspNetCore.Mvc.Core.
Any application that has a direct or transitive dependency on the affected package can be exposed to the vulnerability if it does not meet any of the mitigation factors.
How do I fix the issue?
To fix the issue please install the latest version of .NET Core. If you have multiple versions of .NET Core installed you will need to install multiple runtimes, or SDKs depending on what you have installed.
If you have .NET Core 2.0 or greater installed, you can list the versions you have installed by running the dotnet --info command. You will see output like the following;
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview3-010431
Commit: d72abce213
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\
Host (useful for support):
Version: 3.0.0-preview3-27503-5
Commit: 3844df9537
.NET Core SDKs installed:
2.1.604 [C:\Program Files\dotnet\sdk]
2.2.202 [C:\Program Files\dotnet\sdk]
3.0.100-preview3-010431 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]\
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview3-27503-5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview3-27504-2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
For machines running .NET Core 2.1, you should download Runtime 2.1.13 or SDK 2.1.509 for Visual Studio 2017 or SDK 2.1.606 for Visual Studio 2019 (v16.0) or SDK 2.1.802 for Visual Studio 2019 (v16.2) from https://dotnet.microsoft.com/download/dotnet-core/2.1.
For machines running .NET Core 2.2, you should download Runtime 2.2.7 or SDK 2.2.109 for Visual Studio 2017 or SDK 2.2.206 for Visual Studio 2019 (v16.0) or SDK 2.2.402 for Visual Studio 2019 (v16.2) from https://dotnet.microsoft.com/download/dotnet-core/2.2.
If you have both 2.1 and 2.2, you need to install updates for both versions.
Once you have installed the updated runtime or SDK, restart your apps for the update to take effect.
If you have pinned your application to a specific version of the runtime, you must update your app, recompile and redeploy it for the update to take effect.
You must now update your existing SPA services projects to use the newer version of the vulnerable packages.
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, searching for Microsoft.AspNetCore.Mvc.Core in an example project that contains a package that takes a dependency on Microsoft.AspNetCore.Mvc shows the following results in Visual Studio 2017:
The search results appear as a tree. In the previous results, you can see that a reference to Microsoft.AspNetCore.Mvc.Core version 1.1.2 is discovered.
Under the Dependencies node is a NuGet node. Under the NuGet node is the list of packages you have directly taken a dependency on and their versions.
In screenshot, the application takes a direct dependency on Microsoft.AspNetCore.Mvc. Microsoft.AspNetCore.Mvc in turn has leaf nodes that list its dependencies and their versions.
The Microsoft.AspNetCore.Mvc package takes a dependency on a version of Microsoft.AspNetCore.Mvc.ApiExplorer, that in turn takes a dependency on a version of Microsoft.AspNetCore.Mvc.Core.
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.SpaServices/2.1.0 is a reference to version 2.1.1 of Microsoft.AspNetCore.SpaServices.
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.DataProtection.AzureStorage.dll 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.SpaServices 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.
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, please email details to [email protected]. Reports may qualify for the .NET Core Bug Bounty. Details of the .NET Core Bug Bounty 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-2019-1302: ASP.NET Core Elevation Of Privilege Vulnerability
Executive summary
Microsoft is releasing this security advisory to provide information about a vulnerability in ASP.NET Core. This advisory also provides guidance on what developers can do to update their applications to remove this vulnerability.
Microsoft is aware of an elevation of privilege vulnerability exists when a ASP.NET Core web application, created using vulnerable project templates, fails to properly sanitize web requests. An attacker who successfully exploited this vulnerability could perform content injection attacks and run script in the security context of the logged-on user.
To exploit the vulnerability, an attacker could send a specially crafted email, containing a malicious link, to a user. Alternatively, an attacker could use a chat client to social engineer a user into clicking the malicious link. However, in all cases to exploit this vulnerability a user must click a maliciously crafted link from an attacker.
The update addresses the vulnerability by correcting how the .NET Core web application handles content encoding and updates the application templates to depend on the corrected code libraries.
Discussion
Discussion for this issue can be found at dotnet/aspnetcore#13859
Mitigation factors
If your application does not ASP.NET SPA services your application is not vulnerable.
Affected software
Any .NET Core based application running on ASP.NET Core 2.1.0-2.1.1, or ASP.NET Core 2.2.0 or any preview of ASP.NET Core 3.0.
Affected software
Any ASP.NET Core based application that uses
Microsoft.AspNetCore.SpaServices
with a vulnerable version listed below.2.2.0
2.2.7
ASP.NET Core v3 will be updated with its RTM release.
How do I know if I am affected?
.NET Core has two types of dependencies: direct and transitive. Direct dependencies are dependencies where you specifically add a package to your project, transitive dependencies occur when you add a package to your project that in turn relies on another package.
For example, the
Microsoft.AspNetCore.Mvc
package depends on theMicrosoft.AspNetCore.Mvc.Core
package. When you add a dependency onMicrosoft.AspNetCore.Mvc
in your project, you're taking a transitive dependency onMicrosoft.AspNetCore.Mvc.Core
.Any application that has a direct or transitive dependency on the affected package can be exposed to the vulnerability if it does not meet any of the mitigation factors.
How do I fix the issue?
To fix the issue please install the latest version of .NET Core. If you have multiple versions of .NET Core installed you will need to install multiple runtimes, or SDKs depending on what you have installed.
If you have .NET Core 2.0 or greater installed, you can list the versions you have installed by running the
dotnet --info
command. You will see output like the following;If you have both 2.1 and 2.2, you need to install updates for both versions.
Once you have installed the updated runtime or SDK, restart your apps for the update to take effect.
If you have pinned your application to a specific version of the runtime, you must update your app, recompile and redeploy it for the update to take effect.
You must now update your existing SPA services projects to use the newer version of the vulnerable packages.
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, searching for
Microsoft.AspNetCore.Mvc.Core
in an example project that contains a package that takes a dependency onMicrosoft.AspNetCore.Mvc
shows the following results in Visual Studio 2017:The search results appear as a tree. In the previous results, you can see that a reference to
Microsoft.AspNetCore.Mvc.Core
version 1.1.2 is discovered.Under the Dependencies node is a NuGet node. Under the NuGet node is the list of packages you have directly taken a dependency on and their versions.
In screenshot, the application takes a direct dependency on
Microsoft.AspNetCore.Mvc
.Microsoft.AspNetCore.Mvc
in turn has leaf nodes that list its dependencies and their versions.The
Microsoft.AspNetCore.Mvc
package takes a dependency on a version ofMicrosoft.AspNetCore.Mvc.ApiExplorer
, that in turn takes a dependency on a version ofMicrosoft.AspNetCore.Mvc.Core
.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:/
.For example, a search result that shows
Microsoft.AspNetCore.SpaServices/2.1.0
is a reference to version 2.1.1 ofMicrosoft.AspNetCore.SpaServices
.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.DataProtection.AzureStorage.dll
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.SpaServices
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.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, please email details to [email protected]. Reports may qualify for the .NET Core Bug Bounty. Details of the .NET Core Bug Bounty including terms and conditions are at https://aka.ms/corebounty.
Support
You can ask questions about this issue on GitHub in the .NET Core or ASP.NET Core organizations. These are located at https://github.com/dotnet/ and https://github.com/aspnet/, respectively. The Announcements repo for each product (https://github.com/dotnet/Announcements and https://github.com/aspnet/Announcements) will contain this bulletin as an issue and will include a link to a discussion issue. You can ask questions in the 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.
Acknowledgments
Ian Routledge (@ediblecode)
External Links
CVE-2019-1302
Revisions
V1.0 (September 10, 2019): Advisory published.
Version 1.1
Last Updated 2022-09-02
The text was updated successfully, but these errors were encountered: