Generating an SBOM for a container image sounds straightforward. In practice, different tools produce different results from the same image, base image components are frequently missed, and the SBOM you generated last month may not reflect the image running in production today.
SBOM accuracy isn’t binary—it’s a continuum, and the decisions made during tool selection, pipeline integration, and maintenance practices determine where on that continuum your SBOM program sits.
Why Different Tools Produce Different Results?
The SBOM generation tools in common use (Syft, Trivy, cdxgen) use different detection strategies to identify packages in a container image:
Layer-by-layer package database scanning: Tools that scan package manager databases (dpkg, rpm, apk) find OS-level packages efficiently but may miss language-specific packages installed outside package managers.
File system analysis: Tools that scan for language-specific files (package.json, requirements.txt, pom.xml) find application-layer packages but may miss packages installed from sources that don’t leave these manifests.
Binary analysis: Some tools analyze compiled binaries to detect embedded dependencies, catching cases where compiled software includes libraries that don’t appear in package databases.
The differences produce measurably different SBOM completeness for the same image. A Syft scan and a cdxgen scan of the same image may produce different package counts and different component lists because they detect packages through different mechanisms.
SBOM completeness is not guaranteed by tool selection. Validating your chosen tool’s detection coverage for your specific image types is necessary, not assumed.
Common SBOM Accuracy Pitfalls
Missing base image components
Application SBOM generators that analyze only the application layer miss OS-level packages in the base image layers. A Python application SBOM generated from requirements.txt analysis will miss libssl, glibc, and all other base image components—which may carry the majority of the container’s CVEs.
Container image security accurate SBOM generation requires scanning all image layers, not just the application layer. Tools that scan the full image filesystem, including base image layers, produce complete component inventories.
Stale SBOMs from infrequent regeneration
An SBOM generated when the application was first containerized is stale the first time a dependency updates. Organizations that generate SBOMs once and file them have compliance artifacts that don’t reflect current software state—which is the failure mode that SBOM requirements were designed to prevent.
Container image tool integration in the CI/CD pipeline addresses this by generating SBOMs on every image build. The SBOM is current by construction—it’s generated from the artifact that was just built.
Pre-hardening SBOMs for post-hardening images
An SBOM generated from the pre-hardening image documents packages that the hardening process will remove. If hardening removes 200 packages, the pre-hardening SBOM lists 200 packages that aren’t in the deployed image. The SBOM overstates the actual component inventory of what runs in production.
Generate SBOMs from hardened images, not pre-hardening images. The SBOM should document what ships, not what was present before security processing.
Practical Steps for Accurate Container SBOM Generation
Test your SBOM tool against images with known component inventories. Choose 3-5 representative images and independently verify their component inventory (through package manager queries, binary inspection, and layer analysis). Compare your SBOM tool’s output against the ground truth. The gap reveals the tool’s detection coverage for your image types.
Run multiple tools in parallel during the evaluation period. Different tools have different strengths. Running Syft and Trivy (or cdxgen) against the same images during evaluation reveals where they agree (high-confidence findings) and where they diverge (potential gaps in one or both tools).
Include base image component enumeration in your SBOM validation criteria. For each SBOM generation setup, verify that the OS-level packages from the base image are present in the output. A Python application SBOM that doesn’t list glibc has a significant completeness gap.
Set up automated SBOM comparison between consecutive builds. Comparing the SBOM for the current build against the previous build reveals what changed—new packages, removed packages, version updates. This delta is useful for change tracking and for alerting on unexpected new packages.
Generate SBOMs in both major formats if your consumer ecosystem requires it. CycloneDX and SPDX have different toolchain support. If your vulnerability management platform requires one and your customers require the other, generate both. The generation overhead is low; format conversion after the fact introduces potential data loss.
Frequently Asked Questions
Why do different SBOM generation tools produce different results for the same container image?
Different tools use different detection strategies: some scan OS package manager databases (dpkg, rpm, apk), others analyze language-specific manifest files, and some perform binary analysis of compiled artifacts. Each approach captures packages the others may miss. A Syft scan and a cdxgen scan of the same image can produce different package counts because they detect packages through different mechanisms—validating your chosen tool against images with known inventories is essential before relying on its output.
What are the most common pitfalls in generating accurate SBOMs for container images?
The three most common pitfalls are missing base image components (generating SBOMs only from application layers and missing OS-level packages like libssl), stale SBOMs from infrequent regeneration (filing a SBOM once rather than generating it on every build), and generating SBOMs from pre-hardening images (documenting packages that the hardening process will remove, overstating the actual component inventory of what runs in production).
How does container hardening improve SBOM accuracy?
Hardening removes unused packages from a container image before SBOM generation, shrinking the gap between what’s present in the image and what actually executes at runtime. A hardened image that carries only packages the application uses produces a SBOM that is both complete and accurate for risk assessment—100 components that are mostly active is a more useful security artifact than 400 components where 300 never load. The combination of hardening and post-hardening SBOM generation produces the most actionable component inventory.
Should SBOMs for container images be generated in CycloneDX or SPDX format?
The choice depends on your downstream consumers. CycloneDX has stronger support in vulnerability management platforms like Dependency Track and native VEX integration for expressing non-exploitability assertions. SPDX has stronger support in legal review workflows and some federal procurement contexts. If your tool chain supports dual output and your consumer base requires both, generating both formats is practical—the generation overhead is low, while post-generation format conversion risks data loss.
The Accuracy Improvement from Hardening
Hardened container images produce more accurate SBOMs for a specific reason: the gap between what’s in the image and what executes is smaller. A hardened image that has had unused packages removed carries only what the application uses. The SBOM for a hardened image is a more accurate representation of the application’s actual runtime dependency surface than the SBOM for an unhardened image.
The accuracy improvement isn’t just about completeness—it’s about relevance. An SBOM with 400 components where 300 never execute is technically complete but practically misleading for risk assessment. An SBOM with 100 components where 90 execute is both complete and accurate for risk assessment purposes.
The combination of hardening (which removes unused packages) and SBOM generation (which documents what remains) produces the smallest, most accurate, most actionable component inventory. That combination is where SBOM accuracy improvements are most practically realized.