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 4021279: Vulnerabilities in .NET Core, ASP.NET Core Could Allow Elevation of Privilege
Executive Summary
Microsoft is releasing this security advisory to provide information about vulnerabilities in public .NET Core and ASP.NET Core. This advisory also provides guidance on what developers can do to update their applications correctly.
.NET Core & ASP.NET Core are the next generation of .NET that provide a familiar and modern framework for web and cloud scenarios. These products are actively developed by the .NET and ASP.NET team in collaboration with a community of open source developers, running on Windows, Mac OS X and Linux. When .NET Core was released, the version number was reset to 1.0.0 to reflect the fact that it is a separate product from its predecessor -.NET.
The vulnerabilities affect any Microsoft .NET Core project if it uses the following affected package versions.
Package name
Package versions
Fixed package versions
System.Text.Encodings.Web
4.0.0 4.3.0
4.0.1 4.3.1
System.Net.Http
4.1.1 4.3.1
4.1.2 4.3.2
System.Net.Http.WinHttpHandler
4.0.1 4.3.0
4.0.2 4.5.4
System.Net.Security
4.0.0 4.3.0
4.0.1 4.3.1
System.Net.WebSockets.Client
4.0.0 4.3.0
4.0.1 4.3.1
Microsoft.AspNetCore.Mvc
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Core
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Abstractions
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.ApiExplorer
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Cors
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.DataAnnotations
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Formatters.Json
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Formatters.Xml
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Localization
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Razor.Host
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.Razor
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.TagHelpers
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.ViewFeatures
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Microsoft.AspNetCore.Mvc.WebApiCompatShim
1.0.0, 1.0.1, 1.0.2, 1.0.3 1.1.0, 1.1.1, 1.1.2
1.0.4 1.1.3
Advisory FAQ
How do I know if I am affected?
.NET Core and ASP.NET Core have two types of dependencies: direct and transitive. If your project has a direct or transitive dependency on any of the packages and versions listed above, you are affected.
Note: As part of patching ASP.NET Core MVC we update every Microsoft.AspNetCore.Mvc.* package. If, for example, you have a dependency on Microsoft.AspNetCore.Mvc you should update to the appropriate version first (1.0.x should be updated to 1.0.4, 1.1.x should be updated to 1.1.3), and it will also update any other vulnerable Microsoft.AspNetCore.Mvc dependency.
NET Core Project formats
.NET Core has two different project file formats, depending on what software created the project.
project.json is the format used in .NET Core 1.0 and Microsoft Visual Studio 2015.
csproj is the format used in .NET Core 1.1 and Microsoft Visual Studio 2017.
You must ensure you follow the correct update instructions for your project type.
Direct Dependencies
Direct dependencies are dependencies where you specifically add a package to your project. For example, if you add the Microsoft.AspNetCore.Mvc package to your project then you have taken a direct dependency on Microsoft.AspNetCore.Mvc.
Direct dependencies are discoverable by reviewing your project.json or csproj file.
Transitive Dependencies
Transitive dependencies occur when you add a package to your project that in turn relies on another package. For example, if you add the Microsoft.AspNetCore.Mvc package to your project it depends on the Microsoft.AspNetCore.Mvc.Core package (among others). Your project has a direct dependency on Microsoft.AspNetCore.Mvc and a transitive dependency on the Microsoft.AspNetCore.Mvc.Core package.
Transitive dependencies are reviewable in the Visual Studio Solution Explorer window, which supports searching, or by reviewing the project.lock.json file contained in the root directory of your project for project.json projects or the project.assets.json file contained in the obj directory of your project for csproj projects. These files are the authoritative list of all packages used by your project, containing both direct and transitive dependencies.
How do I fix my affected application?
You will need to fix both direct dependencies and review and fix any transitive dependencies. The affected packages and versions in the previous “Affected Software” section include each vulnerable package, the vulnerable versions, and the patched versions
Note: If you are using ASP.NET Core MVC in your projects you should first update the Microsoft.AspNetCore.Mvc version according to the affected versions table above. If you are currently using version 1.0.0, 1.0.1, 1.0.2 or 1.0.3 you should update your package version to 1.0.4. If you are using version 1.1.0, 1.1.1 or 1.1.2 you should update your package version to 1.1.3. This will update every MVC package to the fixed versions.
Fixing Direct Dependencies – project.json/VS2015
Open your project.json file in your editor. Look for the dependencies section. Below is an example dependencies section:
This example has three direct dependencies: Microsoft.NETCore.App, Microsoft.AspNetCore.Server.Kestrel and Microsoft.AspNetCore.Mvc.
Microsoft.NetCore.App is the platform the application targets, you should ignore this. The other packages expose their version to the right of the package name. In our example, our non-platform packages are version 1.0.1.
Review your direct dependencies for any instance of the packages and versions listed above. In the example above, there is a direct dependency on one of the vulnerable packages, Microsoft.AspNetCore.Mvc version 1.0.1.
To update to the fixed package, change the version number to be the appropriate package for your release. In the example, this would be updating Microsoft.AspNetCore.Mvc to 1.0.4.
After updating the vulnerable package versions, save your project.json file.
The dependencies section in our example project.json would now look as follows:
If you are using Visual Studio and save your updated project.json 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 are not using Visual Studio, open a command line and change to your project directory. Execute the dotnet restore command to restore your new dependency.
After you have addressed all of your direct dependencies, you must also review your transitive dependencies.
Fixing Direct Dependencies – csproj/VS2017
Open your projectname.csproj file in your editor, or right click the project in Visual Studio 2017 and choose Edit projectname.csproj from the content menu, where projectname is the name of your project. Look for PackageReference nodes. The following shows an example project file:
The example has two direct package dependencies, as seen by the two PackageReference elements. The name of the package is in the Include attribute, and the package version number is in the Version attribute that is exposed to the right of the package name. The example shows two packages Microsoft.AspNetCore version 1.1.1, and Microsoft.AspNetCore.Mvc.Core version 1.1.2.
Review your PackageReference elements for any instance of the packages and versions listed above. In the example above, there is a direct dependency on one of the vulnerable packages, Microsoft.AspNetCore.Mvc version 1.1.2.
To update to the fixed package, change the version number to the appropriate package for your release. In the example, this would be updating Microsoft.AspNetCore.Mvc to 1.1.3.
After updating the vulnerable package version, save your csproj file. The example csproj would now look as follows:
If you are using Visual Studio and 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 are not using Visual Studio open a command line and change to your project directory. Execute the dotnet restore command to restore your new dependency.
After updating your direct dependencies
Recompile your application.
If after recompilation you see a Dependency conflict warning, you must update your other direct dependencies to the appropriate version.
For example if your project refers to Microsoft.AspNetCore.Routing with a version number of 1.0.1 when you update your Microsoft.AspNetCore.Mvc package to 1.0.4, compilation will throw:
NU1012 Dependency conflict. Microsoft.AspNetCore.Mvc.Core 1.0.4 expected Microsoft.AspNetCore.Routing >= 1.0.4 but received 1.0.1
To fix this, edit the version for the expected package to be the version expected by updating your csproj or project.json in the same way that you used to update the vulnerable package versions.
After you have addressed all of your direct dependencies, you must also review your transitive dependencies.
Reviewing Transitive Dependencies
There are two ways to view transitive dependencies. You can either use Visual Studio’s Solution Explorer, or you can review your project.lock.json (project.json/VS2015) or project.assets.json (csproj/VS2017) file.
Using Visual Studio Solution Explorer (VS2015)
If you want to use Visual Studio 2015, open your project in Visual Studio 2015 and then press Ctrl+; to activate the search in Solution Explorer. Search for each of the vulnerable package names 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 reference to Microsoft.AspNetCore.Mvc shows the following results in Visual Studio 2015.
The search results appear as a tree. In these results, you can see we have found references to Microsoft.AspNetCore.Mvc, version 1.0.1, ` vulnerable version.
The first entry under the References heading refers to the target framework your application is using. This will be .NETCoreApp, .NETStandard or .NET-Framework-vX.Y.Z (where X.Y.Z is an actual version number) depending on how you configured your application. Under your target framework will be the list of packages you have directly taken a dependency on. In this example, the application takes a dependency on Microsoft.AspNetCore.Mvc. Microsoft.AspNetCore.Mvc in turn has leaf nodes that list its dependencies and their versions. In this case the Microsoft.AspNetCore.Mvc package takes a dependency on a vulnerable version of Microsoft.AspNetCore.Mvc.Core and numerous other packages.
Open the project.lock.json file in your editor. We suggest you use an editor that understands json and allows you to collapse and expand nodes to review this file; both Visual Studio and Visual Studio Code provide this functionality.
If you are using Visual Studio the project.lock.json file is “under” the project.json file. Click the right pointing triangle, ▷, to the left of the project.json file to expand the solution tree to expose the project.lock.json file. The following image shows a project with the project.json file expanded to show the project.lock.json file.
Search the project.lock.json file for each of the vulnerable packages, using the format AssemblyName/. If you find any vulnerable assembly name in your search examine the line on which they are found, the version number is after the / and compare to the vulnerable versions table above. For example a search result that shows Microsoft.AspNetCore.Mvc.Core/1.0.1 is a reference to v1.0.1 of Microsoft.AspNetCore.Mvc.Core. If your project.lock.json file includes references to any of the vulnerable packages shown above then you will need to fix the transitive dependencies.
If you have not found any reference to any vulnerable packages this means none of your direct dependencies depend on any vulnerable packages or you have already fixed the problem by updating the direct dependencies.
If your transitive dependency review found references to any of the vulnerable packages you must add a direct dependency to the updated package to your project.json file to override the transitive dependency. Open your project.json and find the dependencies section. For example:
For each of the vulnerable packages your search returned you must add a direct dependency to the updated version by adding it to the project.json file. You do this by adding a new line to the dependencies section, referring the fixed version. For example, if your search showed a transitive reference to the vulnerable System.Net.Security version 4.0.0 you would add a reference to the appropriate fixed version, 4.0.1. Edit the project.json file as follows:
After you have added direct dependencies to the fixed packages, save your project.json file.
If you are using Visual Studio save your updated project.json 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 are not using Visual Studio open a command line and change to your project directory. Execute the dotnet restore command to restore your new dependencies.
Using Visual Studio Solution Explorer (VS2017)
If you want to use Solution Explorer, open your project in Visual Studio 2017, and then press Ctrl+; to activate the search in Solution Explorer. Search for each of the vulnerable package names 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 these results, you can see we have found references to Microsoft.AspNetCore.Mvc.Core version 1.1.2.
Under the Dependencies node will be a NuGet node. Under the NuGet node will be the list of packages you have directly taken a dependency on and their versions. In this example, 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. In the example the Microsoft.AspNetCore.Mvc package takes a dependency on a version of Microsoft.AspNetCore.Mvc.ApiExplorer which in turn takes a dependency on a vulnerable version of Microsoft.AspNetCore.Mvc.Core.
Manually reviewing project.assets.json (VS2017)
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; both Visual Studio and Visual Studio Code provide this functionality.
Search the project.assets.json file for each of the vulnerable packages, using the format AssemblyName/. If you find any vulnerable assembly name in your search examine the line on which they are found, the version number is after the / and compare to the vulnerable versions table above. For example a search result that shows Microsoft.AspNetCore.Mvc.Core/1.1.0 is a reference to v1.1.0 of Microsoft.AspNetCore.Mvc.Core. If your project.assets.json file includes references to any of the vulnerable packages shown above then you will need to fix the transitive dependencies.
If you have not found any reference to any vulnerable packages this means none of your direct dependencies depend on any vulnerable packages or you have already fixed the problem by updating the direct dependencies.
If your transitive dependency review found references to any of the vulnerable packages you must add a direct dependency to the updated package to your csproj file to override the transitive dependency. Open your projectname.csproj file in your editor, or right click on the project in Visual Studio 2017 and choose Edit projectname.csproj from the content menu, where projectname is the name of your project. Look for PackageReference nodes, for example:
For each of the vulnerable packages your search returned you must add a direct dependency to the updated version by adding it to the csproj file. You do this by adding a new line to the dependencies section, referring the fixed version. For example, if your search showed a transitive reference to the vulnerable System.Net.Security version 4.3.0 you would add a reference to the appropriate fixed version, 4.3.1.
After you have added the direct dependency reference, save your csproj file.
If you are 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 are not using Visual Studio, open a command line and change to your project directory. Execute the dotnet restore command to restore your new dependencies.
Rebuilding your application
Finally rebuild your application, test as you would do normally and redeploy using your favored deployment mechanism.
Other Information
Reporting Security Issues
If you have found a potential security issue in .NET Core, please email details to secure@microsoft.com. 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.
Acknowledgments
Microsoft thanks the following for working with us to help protect customers:
Microsoft Security Advisory 4021279: Vulnerabilities in .NET Core, ASP.NET Core Could Allow Elevation of Privilege
Executive Summary
Microsoft is releasing this security advisory to provide information about vulnerabilities in public .NET Core and ASP.NET Core. This advisory also provides guidance on what developers can do to update their applications correctly.
.NET Core & ASP.NET Core are the next generation of .NET that provide a familiar and modern framework for web and cloud scenarios. These products are actively developed by the .NET and ASP.NET team in collaboration with a community of open source developers, running on Windows, Mac OS X and Linux. When .NET Core was released, the version number was reset to 1.0.0 to reflect the fact that it is a separate product from its predecessor -.NET.
Discussion
To discuss the ASP.NET Core issues please see https://github.com/aspnet/Mvc/issues/6246
To discuss the CoreFX Core issues please see https://github.com/dotnet/corefx/issues/19535
Issue CVEs and Description
Affected Software
The vulnerabilities affect any Microsoft .NET Core project if it uses the following affected package versions.
4.3.0
4.3.1
4.3.1
4.3.2
4.3.0
4.5.4
4.3.0
4.3.1
4.3.0
4.3.1
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
1.1.0, 1.1.1, 1.1.2
1.1.3
Advisory FAQ
How do I know if I am affected?
.NET Core and ASP.NET Core have two types of dependencies: direct and transitive. If your project has a direct or transitive dependency on any of the packages and versions listed above, you are affected.
Note: As part of patching ASP.NET Core MVC we update every Microsoft.AspNetCore.Mvc.* package. If, for example, you have a dependency on
Microsoft.AspNetCore.Mvc
you should update to the appropriate version first (1.0.x should be updated to 1.0.4, 1.1.x should be updated to 1.1.3), and it will also update any other vulnerableMicrosoft.AspNetCore.Mvc
dependency.NET Core Project formats
.NET Core has two different project file formats, depending on what software created the project.
project.json
is the format used in .NET Core 1.0 and Microsoft Visual Studio 2015.csproj
is the format used in .NET Core 1.1 and Microsoft Visual Studio 2017.You must ensure you follow the correct update instructions for your project type.
Direct Dependencies
Direct dependencies are dependencies where you specifically add a package to your project. For example, if you add the
Microsoft.AspNetCore.Mvc
package to your project then you have taken a direct dependency onMicrosoft.AspNetCore.Mvc
.Direct dependencies are discoverable by reviewing your
project.json
orcsproj
file.Transitive Dependencies
Transitive dependencies occur when you add a package to your project that in turn relies on another package. For example, if you add the
Microsoft.AspNetCore.Mvc
package to your project it depends on theMicrosoft.AspNetCore.Mvc.Core
package (among others). Your project has a direct dependency onMicrosoft.AspNetCore.Mvc
and a transitive dependency on theMicrosoft.AspNetCore.Mvc.Core
package.Transitive dependencies are reviewable in the Visual Studio Solution Explorer window, which supports searching, or by reviewing the
project.lock.json
file contained in the root directory of your project forproject.json
projects or theproject.assets.json
file contained in the obj directory of your project forcsproj
projects. These files are the authoritative list of all packages used by your project, containing both direct and transitive dependencies.How do I fix my affected application?
You will need to fix both direct dependencies and review and fix any transitive dependencies. The affected packages and versions in the previous “Affected Software” section include each vulnerable package, the vulnerable versions, and the patched versions
Note: If you are using ASP.NET Core MVC in your projects you should first update the
Microsoft.AspNetCore.Mvc
version according to the affected versions table above. If you are currently using version 1.0.0, 1.0.1, 1.0.2 or 1.0.3 you should update your package version to 1.0.4. If you are using version 1.1.0, 1.1.1 or 1.1.2 you should update your package version to 1.1.3. This will update every MVC package to the fixed versions.Fixing Direct Dependencies – project.json/VS2015
Open your
project.json
file in your editor. Look for the dependencies section. Below is an example dependencies section:This example has three direct dependencies:
Microsoft.NETCore.App
,Microsoft.AspNetCore.Server.Kestrel
andMicrosoft.AspNetCore.Mvc
.Microsoft.NetCore.App
is the platform the application targets, you should ignore this. The other packages expose their version to the right of the package name. In our example, our non-platform packages are version 1.0.1.Review your direct dependencies for any instance of the packages and versions listed above. In the example above, there is a direct dependency on one of the vulnerable packages,
Microsoft.AspNetCore.Mvc
version 1.0.1.To update to the fixed package, change the version number to be the appropriate package for your release. In the example, this would be updating
Microsoft.AspNetCore.Mvc
to 1.0.4.After updating the vulnerable package versions, save your
project.json
file.The dependencies section in our example
project.json
would now look as follows:If you are using Visual Studio and save your updated
project.json
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 are not using Visual Studio, open a command line and change to your project directory. Execute the
dotnet restore
command to restore your new dependency.After you have addressed all of your direct dependencies, you must also review your transitive dependencies.
Fixing Direct Dependencies – csproj/VS2017
Open your
projectname.csproj
file in your editor, or right click the project in Visual Studio 2017 and chooseEdit projectname.csproj
from the content menu, where projectname is the name of your project. Look forPackageReference
nodes. The following shows an example project file:The example has two direct package dependencies, as seen by the two
PackageReference
elements. The name of the package is in the Include attribute, and the package version number is in the Version attribute that is exposed to the right of the package name. The example shows two packagesMicrosoft.AspNetCore
version 1.1.1, andMicrosoft.AspNetCore.Mvc.Core
version 1.1.2.Review your
PackageReference
elements for any instance of the packages and versions listed above. In the example above, there is a direct dependency on one of the vulnerable packages,Microsoft.AspNetCore.Mvc
version 1.1.2.To update to the fixed package, change the version number to the appropriate package for your release. In the example, this would be updating
Microsoft.AspNetCore.Mvc
to 1.1.3.After updating the vulnerable package version, save your
csproj
file. The examplecsproj
would now look as follows:If you are using Visual Studio and 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 are not using Visual Studio open a command line and change to your project directory. Execute the
dotnet restore
command to restore your new dependency.After updating your direct dependencies
Recompile your application.
If after recompilation you see a Dependency conflict warning, you must update your other direct dependencies to the appropriate version.
For example if your project refers to
Microsoft.AspNetCore.Routing
with a version number of 1.0.1 when you update yourMicrosoft.AspNetCore.Mvc
package to 1.0.4, compilation will throw:NU1012 Dependency conflict. Microsoft.AspNetCore.Mvc.Core 1.0.4 expected Microsoft.AspNetCore.Routing >= 1.0.4 but received 1.0.1
To fix this, edit the version for the expected package to be the version expected by updating your
csproj
orproject.json
in the same way that you used to update the vulnerable package versions.After you have addressed all of your direct dependencies, you must also review your transitive dependencies.
Reviewing Transitive Dependencies
There are two ways to view transitive dependencies. You can either use Visual Studio’s Solution Explorer, or you can review your
project.lock.json
(project.json/VS2015) orproject.assets.json
(csproj/VS2017) file.Using Visual Studio Solution Explorer (VS2015)
If you want to use Visual Studio 2015, open your project in Visual Studio 2015 and then press Ctrl+; to activate the search in Solution Explorer. Search for each of the vulnerable package names 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 reference toMicrosoft.AspNetCore.Mvc
shows the following results in Visual Studio 2015.The search results appear as a tree. In these results, you can see we have found references to
Microsoft.AspNetCore.Mvc
, version 1.0.1, ` vulnerable version.The first entry under the References heading refers to the target framework your application is using. This will be
.NETCoreApp
,.NETStandard
or.NET-Framework-vX.Y.Z
(where X.Y.Z is an actual version number) depending on how you configured your application. Under your target framework will be the list of packages you have directly taken a dependency on. In this example, the application takes a dependency onMicrosoft.AspNetCore.Mvc
.Microsoft.AspNetCore.Mvc
in turn has leaf nodes that list its dependencies and their versions. In this case theMicrosoft.AspNetCore.Mvc
package takes a dependency on a vulnerable version ofMicrosoft.AspNetCore.Mvc.Core
and numerous other packages.Manually reviewing project.lock.json (project.json/VS2015)
Open the
project.lock.json
file in your editor. We suggest you use an editor that understands json and allows you to collapse and expand nodes to review this file; both Visual Studio and Visual Studio Code provide this functionality.If you are using Visual Studio the
project.lock.json
file is “under” theproject.json
file. Click the right pointing triangle, ▷, to the left of theproject.json
file to expand the solution tree to expose theproject.lock.json
file. The following image shows a project with theproject.json
file expanded to show theproject.lock.json
file.Search the
project.lock.json
file for each of the vulnerable packages, using the formatAssemblyName/
. If you find any vulnerable assembly name in your search examine the line on which they are found, the version number is after the/
and compare to the vulnerable versions table above. For example a search result that showsMicrosoft.AspNetCore.Mvc.Core/1.0.1
is a reference to v1.0.1 ofMicrosoft.AspNetCore.Mvc.Core
. If yourproject.lock.json
file includes references to any of the vulnerable packages shown above then you will need to fix the transitive dependencies.Fixing transitive dependencies (project.json/VS2015)
If you have not found any reference to any vulnerable packages this means none of your direct dependencies depend on any vulnerable packages or you have already fixed the problem by updating the direct dependencies.
If your transitive dependency review found references to any of the vulnerable packages you must add a direct dependency to the updated package to your
project.json
file to override the transitive dependency. Open yourproject.json
and find the dependencies section. For example:For each of the vulnerable packages your search returned you must add a direct dependency to the updated version by adding it to the
project.json
file. You do this by adding a new line to the dependencies section, referring the fixed version. For example, if your search showed a transitive reference to the vulnerableSystem.Net.Security
version 4.0.0 you would add a reference to the appropriate fixed version, 4.0.1. Edit theproject.json
file as follows:After you have added direct dependencies to the fixed packages, save your
project.json
file.If you are using Visual Studio save your updated
project.json
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 are not using Visual Studio open a command line and change to your project directory. Execute the
dotnet restore
command to restore your new dependencies.Using Visual Studio Solution Explorer (VS2017)
If you want to use Solution Explorer, open your project in Visual Studio 2017, and then press Ctrl+; to activate the search in Solution Explorer. Search for each of the vulnerable package names 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 these results, you can see we have found references to
Microsoft.AspNetCore.Mvc.Core
version 1.1.2.Under the Dependencies node will be a NuGet node. Under the NuGet node will be the list of packages you have directly taken a dependency on and their versions. In this example, 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. In the example theMicrosoft.AspNetCore.Mvc
package takes a dependency on a version ofMicrosoft.AspNetCore.Mvc.ApiExplorer
which in turn takes a dependency on a vulnerable version ofMicrosoft.AspNetCore.Mvc.Core
.Manually reviewing project.assets.json (VS2017)
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; both Visual Studio and Visual Studio Code provide this functionality.Search the
project.assets.json
file for each of the vulnerable packages, using the formatAssemblyName/
. If you find any vulnerable assembly name in your search examine the line on which they are found, the version number is after the/
and compare to the vulnerable versions table above. For example a search result that showsMicrosoft.AspNetCore.Mvc.Core/1.1.0
is a reference to v1.1.0 ofMicrosoft.AspNetCore.Mvc.Core
. If yourproject.assets.json
file includes references to any of the vulnerable packages shown above then you will need to fix the transitive dependencies.If you have not found any reference to any vulnerable packages this means none of your direct dependencies depend on any vulnerable packages or you have already fixed the problem by updating the direct dependencies.
If your transitive dependency review found references to any of the vulnerable packages you must add a direct dependency to the updated package to your
csproj
file to override the transitive dependency. Open yourprojectname.csproj
file in your editor, or right click on the project in Visual Studio 2017 and choose Editprojectname.csproj
from the content menu, whereprojectname
is the name of your project. Look forPackageReference
nodes, for example:For each of the vulnerable packages your search returned you must add a direct dependency to the updated version by adding it to the
csproj
file. You do this by adding a new line to the dependencies section, referring the fixed version. For example, if your search showed a transitive reference to the vulnerableSystem.Net.Security
version 4.3.0 you would add a reference to the appropriate fixed version, 4.3.1.After you have added the direct dependency reference, save your
csproj
file.If you are 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 are not using Visual Studio, open a command line and change to your project directory. Execute the
dotnet restore
command to restore your new dependencies.Rebuilding your application
Finally rebuild your application, test as you would do normally and redeploy using your favored deployment mechanism.
Other Information
Reporting Security Issues
If you have found a potential security issue in .NET Core, please email details to secure@microsoft.com. 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/. 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 where you can ask questions.
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
Microsoft thanks the following for working with us to help protect customers:
Revisions
The text was updated successfully, but these errors were encountered: