Safeguard
Developer Tools•

How do I fix a vulnerable transitive NuGet package?

Upgrade the closest package first, then add a direct reference or use transitive pinning with central package management. Steps, trade-offs and cautions.

Safeguard Security Team
3 min read

To fix a vulnerable transitive NuGet package, first find which package pulls it in, then upgrade the closest package to your direct references. If that does not clear the warning, add the fixed version as a direct reference or turn on transitive pinning with central package management.

Step 1: find the path

Use the .NET CLI to see why a package is in the graph:

dotnet nuget why MyProject.csproj Vulnerable.Package

The Microsoft documentation also lists the Visual Studio Solution Explorer dependency node and the package manager tooltips as ways to find the path.

Step 2: try the options in order

The documentation's advice is to upgrade the package closest to your direct references first. In its example, project references A, A depends on B, B depends on C, and C 1.0.0 has a known flaw. Try upgrading A. If the warning stays, try B. If it still stays, upgrade C directly.

OptionGood forWatch out for
Upgrade the top-level packageCleanest fixThe new version may change behavior
Add the fixed version as a direct referenceQuick, explicitRemove it when a parent update makes it unnecessary
Transitive pinning with central package managementMany projects, one placePack behavior, see below
Suppress the advisoryOnly after analysisHides it for every project that shares it
Ask the parent package to updateNo fix available yetTakes time

How transitive pinning works

Create a Directory.Packages.props at the repository root, turn on central management, and enable pinning:

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Vulnerable.Package" Version="2.0.0" />
  </ItemGroup>
</Project>

Per the documentation, this implicitly promotes a transitive dependency to a top-level one when needed. Downgrades are not allowed: pinning below the version a dependency requests raises error NU1109.

The pack caveat for library authors

If you pack a project that uses pinning, NuGet promotes the pinned packages to explicit dependencies in the nuspec. That can add dependencies your consumers did not expect, so the documentation says to evaluate pinning carefully when authoring a library.

Verify

Restore again and confirm the audit warning is gone. Then review the change in a pull request like any other dependency edit.

Try it yourself

Click through it at your own pace, or open it full screen.

Find the fixed version listed for a vulnerable component, and ask which package would need to change to reach it.

Quick check

Can I pin a transitive package to an older version?

No. Restore raises NU1109 if the pin is lower than what a dependency requests.

Is a direct reference a permanent fix?

No. The docs say to remove it once a parent update makes it unnecessary, and to keep the attributes the original reference needed.

Safeguard's autonomous remediation can propose fix pull requests. It is off by default and every category is on Manual, so a reviewer approves the change. The free scan shows what is fixable in your project today.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.