Every few days, a security flaw in some library gets a CVE number. If your code uses that library, the number now applies to you. This post explains what a CVE is, how to read one, and what to do about the ones in your .NET repositories.
What a CVE is
CVE stands for Common Vulnerabilities and Exposures. It is a public ID for one known security flaw in a piece of software.
The ID looks like CVE-2021-44228: the year it was assigned, then a number. The ID does not describe the flaw. It gives everyone one name for it, so a vendor, a scanner and your team all talk about the same thing.
A CVE record is short: which product and versions are affected, a one-line description, and links to the advisory. Databases such as the National Vulnerability Database and the GitHub Advisory Database add detail, like a severity score and the version that fixes the flaw.
How to read the severity
Most CVEs carry a CVSS score from 0 to 10. Higher means more severe. NuGet shows it as four labels: low, moderate, high and critical.
The score is a starting point, not the answer. It rates the flaw in general, not in your application. A critical flaw in a function your code never calls can matter less than a moderate one on a path every request takes. The advisory often names the conditions: a framework, an operating system, a feature that must be switched on. Read them.
Why it matters for .NET repositories
Most of the code you ship is not code you wrote. Your project references a few packages. Those packages reference others. These are transitive dependencies. A CVE in a package you never chose can still be in your build.
Once a CVE is public, the flaw is public. Often the fix is too. The open question is how long your repositories keep running the old version.
With one repository, that is a small job. With many similar repositories, it is the same upgrade again in each one, and the repository nobody remembers is the one that stays old.
How to find CVEs in a .NET project
Since the .NET 8 SDK, NuGet Audit checks your packages on every dotnet restore. It compares them with the GitHub Advisory Database and prints a warning per package:
NU1901: low severityNU1902: moderate severityNU1903: high severityNU1904: critical severity
By default, it checks only the packages you reference directly. A project that targets net10.0 or higher checks transitive packages too. You can set NuGetAuditMode to all yourself.
To list the affected packages, run:
dotnet list package --vulnerable --include-transitive
To see why a transitive package is in your project, run:
dotnet nuget why <project> <package>
How to fix one
If you reference the package directly, update it to a version that has the fix. With the .NET 10 SDK, this command updates every vulnerable package to the first version without a known vulnerability:
dotnet package update --vulnerable
If the flaw is in a transitive package, Microsoft's advice is to update the package closest to your direct reference first. If that does not clear the warning, update the next one down, or reference the fixed version directly. Central Package Management can also pin a transitive version for the whole repository.
If no fixed version exists yet, read the advisory for mitigating factors, look for a maintained alternative, or open an issue with the package owner.
What to fix first
A simple order that works:
- High and critical flaws in packages that handle input from outside your system.
- Any flaw that already has a fixed version.
- The rest, in your normal upgrade rhythm.
Then check again. The advisory databases change every day, so a clean result today says nothing about next week. Run the check in your build pipeline, not only on your own machine.
One repository is easy. Many are not.
The commands above work on one project or solution at a time. If your team owns many similar repositories, you run them in each one, and the fix has to be tried and applied in each one.
Smell That Code is built for that part. It sees your repositories as one repository group. An approved version is tried on canary repositories first, and it spreads only after build and tests pass. Security fixes go first.