A .NET app that carries its own runtime, and lists a hundred packages it never ships
.NET 6 console app published self-contained: the runtime ships inside the artefact as a NuGet package
The application and how it is built
A .NET 6 console app with three old NuGet libraries: Newtonsoft.Json, log4net and SharpZipLib. The project file also references three System.* packages and a Roslyn analyzer. It's published self-contained, so the output folder holds the app, its libraries and the whole .NET 6 runtime, and the image adds nothing but the native libraries the runtime needs.
What gets hidden, and how
Two things are hidden, in opposite directions. Publishing self-contained copies the .NET runtime into the output from a NuGet runtime pack, Microsoft.NETCore.App.Runtime for the build machine's platform. No file in the source tree names it; only the publish output's deps.json does. Meanwhile restore resolves about 110 packages, mostly System.* and runtime.* packages pulled in by the old libraries, and publish drops nearly all of them because .NET 6 already contains newer copies. The analyzer runs inside the compiler and ships nothing.
| Component | Mechanism | In the artefact? | What happens to it |
|---|---|---|---|
| Microsoft.NETCore.App.Runtime.linux-x64@6.0.36 | runtime-pack | ships | the .NET 6 runtime itself, copied into the output by --self-contained. It comes from NuGet as a runtime pack named for the build machine (linux-x64 or linux-arm64 in the tool image), and LegacyApp.deps.json lists it with type runtimepack. No file in the source tree names it; 6.0.36 is the last public .NET 6 release |
| System.Text.Encodings.Web@4.5.0 | framework-provided | does not ship | a direct reference in the project file, but .NET 6 contains a newer copy, so publish leaves the package out. An old version with a published advisory (CVE-2021-26701), so a tool that reports it raises a finding for code that never ships |
What a true SBOM would say
5 components ship, 1 of them transformed on the way in. 4 are known not to ship (1 build-tooling, 3 framework-provided). Those influence the build or run during it; a tool may list them, as long as it marks them.
The list was written by hand from the build files, the lockfiles and the listing of the built archive, and the project's own proof-check.sh asserts what ends up in the artefact. It is in expected.json, and the full list of what ships is at the foot of this page.
What the tools reported
- Microsoft.NETCore.App.Runtime.linux-x64@6.0.36: named by 0 of 5 tools at the source stage, 1 of 3 tools at the artefact stage, 1 of 4 tools at the image stage.
- System.Text.Encodings.Web@4.5.0: named by 3 of 5 tools at the source stage, 0 of 3 tools at the artefact stage, 0 of 4 tools at the image stage.
Shipped components found, by stage
Out of 5 that ship. Only the tools that scan all three stages are drawn; the table below has every tool.
Component by component
Ships: Y exact version, v wrong version, p wrong group or namespace, n not named. Does not ship: L listed and marked, X listed unmarked, · not listed. A tool appears under a stage only if it was run there, so an empty column never stands for a miss. Select a cell to see what is behind it.
Select a cell.
| source | artefact | image | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Component | cdxgen | cyclonedx-dotnet | sbom-tool | syft | trivy | cdxgen | syft | trivy | cdxgen | docker-scout | syft | trivy |
| Ships. In the artefact, including components that were shaded or bundled on the way in. | ||||||||||||
| LegacyApp@* | ||||||||||||
| Newtonsoft.Json@12.0.1 | ||||||||||||
| log4net@2.0.8 | ||||||||||||
| SharpZipLib@1.2.0 | ||||||||||||
| Microsoft.NETCore.App.Runtime.linux-x64@6.0.36 runtime-pack | ||||||||||||
| Present in the build, absent from the artefact. Plugins and their payloads, imported BOMs, and dependencies the build file requires but the artefact never contains. Listing one is right when it is marked as not shipping. | ||||||||||||
| System.Text.Encodings.Web@4.5.0 framework-provided | ||||||||||||
Every document
| Content accuracy | Baseline conformance | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Tool | Format | Comps | In scope | Shipped found | Wrong ver | Wrong purl | Leaked | Labelled | Hashes ok | NTIA 2021 | NTIA/CISA 2026 | BSI v2.1 |
| source | ||||||||||||
| cdxgen 11.3.2 | cyclonedx | 88 | 88 | 4/5 | 0 | 0 | 83 | 0 | 0/0 | 8.3 | 7.1 | 3.7 |
| cyclonedx-dotnet | cyclonedx | 87 | 87 | 3/5 | 0 | 0 | 82 | 1 | 0/0 | 8.3 | 9.9 | 3.4 |
| sbom-tool 4.1.13 | spdx | 89 | 89 | 3/5 | 0 | 0 | 83 | 0 | 0/0 | 10.0 | 4.3 | 3.4 |
| syft 1.51.0 | cyclonedx | 0 | 0 | 0/5 | 0 | 0 | 0 | 0 | 0/0 | 3.1 | 4.4 | 4.1 |
| trivy 0.74.0 | cyclonedx | 1 | 1 | 0/5 | 0 | 0 | 0 | 0 | 0/0 | 3.1 | 4.4 | 4.1 |
| artefact | ||||||||||||
| cdxgen 11.3.2 | cyclonedx | 0 | 0 | 0/5 | 0 | 0 | 0 | 0 | 0/0 | 6.7 | 8.0 | 5.7 |
| syft 1.51.0 | cyclonedx | 5 | 5 | 4/5 | 0 | 0 | 0 | 0 | 0/0 | 1.9 | 4.3 | 2.1 |
| trivy 0.74.0 | cyclonedx | 7 | 6 | 5/5 | 0 | 0 | 0 | 0 | 0/0 | 6.8 | 4.1 | 3.6 |
| image | ||||||||||||
| cdxgen 11.3.2 | cyclonedx | 151 | 0 | 0/5 | 0 | 0 | 0 | 0 | 0/0 | 7.6 | 6.0 | 3.0 |
| docker-scout 1.24.0 | spdx | 148 | 5 | 4/5 | 0 | 0 | 0 | 0 | 0/0 | 10.0 | 6.8 | 3.7 |
| syft 1.51.0 | cyclonedx | 104 | 5 | 4/5 | 0 | 0 | 0 | 0 | 0/0 | 1.8 | 4.3 | 2.1 |
| trivy 0.74.0 | cyclonedx | 105 | 5 | 5/5 | 0 | 0 | 0 | 0 | 0/0 | 9.8 | 5.4 | 3.8 |
- In scope: package components whose purl type is one of the test case's ecosystems (OS packages in images are ignored).
- Shipped found: recall against what is really in the artefact, at the exact version.
- Wrong ver: named, but at a version that does not ship. Wrong purl: right name and version under the wrong group, so no advisory database will match it.
- Leaked: things that do not ship (test, dev, build tooling,
provided, BOM imports) listed with nothing a consumer could filter on. - Labelled: the same things listed with a scope or property that marks them, which is correct.
+Ncounts further labelled components outside the known list. - Hashes ok: hashes that match the real digest of the jar inside the built artefact, over hashes the tool emitted for those jars.
- NTIA 2021, NTIA/CISA 2026, BSI v2.1:
sbomqs compliancetotals out of 10. They measure whether the fields are present, not whether the inventory is right.
Details
- source / cdxgen leaked unlabelled: StyleCop.Analyzers@1.1.118, System.Net.Http@4.3.0, System.Text.Encodings.Web@4.5.0, System.Text.RegularExpressions@4.3.0, microsoft.netcore.platforms@1.1.0, microsoft.netcore.targets@1.1.0, microsoft.win32.primitives@4.0.1, microsoft.win32.registry@4.0.0 …
- source / cyclonedx-dotnet leaked unlabelled: System.Net.Http@4.3.0, System.Text.Encodings.Web@4.5.0, System.Text.RegularExpressions@4.3.0, microsoft.netcore.platforms@1.1.0, microsoft.netcore.targets@1.1.0, microsoft.win32.primitives@4.0.1, microsoft.win32.registry@4.0.0, runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl@4.3.0 …
- source / sbom-tool leaked unlabelled: StyleCop.Analyzers@1.1.118, System.Net.Http@4.3.0, System.Text.Encodings.Web@4.5.0, System.Text.RegularExpressions@4.3.0, microsoft.netcore.platforms@1.1.0, microsoft.netcore.targets@1.1.0, microsoft.win32.primitives@4.0.1, microsoft.win32.registry@4.0.0 …
Reading the result
Source-stage tools that read the restore graph report dozens of packages that never ship, including three with published advisories, and none of them can see the runtime. Artefact-stage tools that read deps.json see what ships, including the runtime, if they name it the way NuGet does. .NET 6 left support in November 2024, so the runtime in this artefact will never get another public fix; whether a scanner can say so depends on that one component being found and named.
This is our interpretation. The counts above are what the run recorded; why a tool found or missed something is inferred from how the tool works, not established by the data. Limits of the benchmark.
Evidence
- The project.
- Ground truth (
expected.json). - Every SBOM generated for this test case at the source and artefact stages.
- The scores for every document, machine-readable.
Ground truth: what ships
| Component | Note |
|---|---|
pkg:nuget/LegacyApp@* | primary component |
pkg:nuget/Newtonsoft.Json@12.0.1 | direct reference; Newtonsoft.Json.dll is in the output. An old version with a published advisory (CVE-2024-21907) |
pkg:nuget/log4net@2.0.8 | direct reference; log4net.dll is in the output. Old, with a published advisory (CVE-2018-1285) |
pkg:nuget/SharpZipLib@1.2.0 | direct reference; ships as ICSharpCode.SharpZipLib.dll, so the file name doesn't match the package name. Old, with published advisories |
pkg:nuget/Microsoft.NETCore.App.Runtime.linux-x64@6.0.36 | the .NET 6 runtime itself, copied into the output by --self-contained. It comes from NuGet as a runtime pack named for the build machine (linux-x64 or linux-arm64 in the tool image), and LegacyApp.deps.json lists it with type runtimepack. No file in the source tree names it; 6.0.36 is the last public .NET 6 release |