Generating an SBOM that is actually true — build-time versus binary
An SBOM from your lockfiles describes what you asked for. One from the artefact describes what you shipped. The two disagree, the disagreement is the interesting part, and for firmware it is most of the inventory.
Michael Parkadze · Software Engineer

On this page
There are two places to generate an SBOM and they answer different questions.
Build-time generation reads your manifests, lockfiles and build system. It is accurate about versions and dependency relationships, and blind to anything that did not come through the package manager. Binary or artefact analysis examines the thing you ship. It sees everything that is actually there, and is much weaker on versions, particularly for statically linked native code.
Neither is sufficient. The practical answer is to generate both, merge them, and treat the difference as a finding rather than noise — because the gap between them is exactly the set of components your dependency tooling does not know about, which is where unmanaged risk lives.
What build-time generation misses
Everything that enters the artefact without passing through a manifest:
- Vendored source. A copy of a library committed into your tree. Extremely common in embedded C, and invisible to every manifest-based tool.
- Statically linked native libraries. Your build links
libjpeg; nothing records whichlibjpeg. - Base image contents. A container's manifest lists your application's dependencies. The base image brings an operating system.
- Build toolchain artefacts that end up in the output — runtime libraries, language runtimes, embedded interpreters.
- Downloaded binaries. A
curl | tarin a Dockerfile or a prebuilt blob fetched by a build script. - Firmware blobs. Radio stacks, bootloaders, vendor BSP binaries you never built.
For a web service in a managed language, build-time generation might cover 95% of what matters. For embedded firmware, it can easily be under half. The proportion is worth measuring for your own product rather than assuming, because it determines how much of your inventory is guesswork.
What binary analysis misses
The symmetric problem:
- Precise versions of statically linked code. A scanner can often identify that OpenSSL is present from string and symbol signatures; pinning it to 3.0.11 rather than 3.0.x is frequently not possible.
- Dependency relationships. The artefact is flat. The graph — which matters for reachability and VEX justifications — comes from the build.
- Dead code. A library linked but unreachable appears present. That is arguably correct for an inventory and misleading for risk.
- Anything compressed, encrypted or packed that the tool cannot unpack.
So binary analysis gives you presence with uncertain identity, and build-time gives you identity with incomplete presence.
Merging the two
The merge is where the value is, and the useful output has three buckets:
| Bucket | Meaning | Action |
|---|---|---|
| In both | Known, versioned, confirmed present | Normal vulnerability tracking |
| Build only | Declared but not detected in the artefact | Check whether it is genuinely absent — a build-time-only dependency, or a pruned module. Good VEX material |
| Artefact only | Present but undeclared | Investigate. This is unmanaged code in your product |
The third bucket is the point of the exercise. A component in your shipped firmware that no manifest mentions is not tracked by your dependency updater, not covered by your advisory monitoring, and not something anyone owns. Every one of those is a finding, and the first time you run this merge on a mature product you will find some.
Keep the merged document as the SBOM of record, with the per-source documents as inputs. Note the provenance per component — which source saw it, and how confident the version is — because a consumer treating a signature-guessed version as authoritative will draw wrong conclusions, and a resolvable identifier with a wrong version is worse than no identifier.
For containers
The easiest case, and still commonly got wrong.
Scan the image, not the repository. syft packages <image> sees the base image's packages, the application's dependencies and anything a RUN step fetched. A repository scan sees only the last of those.
Two specifics:
- Multi-stage builds are your friend — scan the final stage. A scan of the builder stage inventories a toolchain you do not ship.
- Distroless and scratch images reduce the base-image component set to near zero, which makes the inventory honest and short. This is a security argument for distroless that is rarely made and is quite strong under the CRA: fewer components means fewer advisories to triage for the whole support period.
For firmware
The hard case, and where most CRA SBOM effort will actually go.
If you build with Yocto or Buildroot, use the build system's own output. Yocto can emit SPDX directly as part of the build, with far better version fidelity than any post-hoc analysis, because the build system knows exactly which recipe and revision produced each binary. This is the single biggest quality win available to an embedded team and it is a configuration change rather than a project.
For images you did not build, unpack and inventory:
# Identify and extract filesystems from a firmware image
binwalk -e firmware.bin
# Inventory the extracted root filesystem
syft packages dir:_firmware.bin.extracted/squashfs-root -o cyclonedx-json
Expect this to be partially successful and treat partial success honestly. A vendor BSP blob with no package metadata will appear as an unidentified binary. The right response is to record it as a component with unknown version and an explicit note, not to omit it. An inventory that silently drops what it could not parse overstates its own coverage, which is the one defect that makes an SBOM actively misleading.
Ask your silicon and module vendors for their SBOM. Under the CRA they have their own Annex I Part II point 1 obligation for the products they place on the market, and increasingly they will have one to give you. A supplied SBOM for a radio stack is better than any analysis you can perform on it. This is also the clearest example of how the CRA propagates up a supply chain: your obligation creates a question you ask your suppliers, and theirs creates the answer.
Putting it in CI
What I would build, in order, with the cheap high-value steps first:
- Artefact-based generation on every build, output to
releases/<version>/sbom.cdx.json. Even an imperfect SBOM per release beats a perfect one per year. - Build-time generation from the manifests, as a second document.
- A merge step producing the SBOM of record, with provenance per component.
- A gate on the artefact-only bucket — not a hard failure, but a report that a human reads. Growth in that bucket is the signal that something entered the product outside the managed path.
- A package URL coverage check that fails the build if the proportion of components without a resolvable identifier exceeds a threshold you set. Without resolvable identifiers the document cannot be queried against vulnerability data, which is the only reason you built it.
Step 5 is the one I would not ship without. It is cheap, it fails fast, and it prevents the specific outcome where a team runs an SBOM programme for a year and then discovers the archive cannot answer the one question an Article 14 clock requires: which releases contain this component.
The honest summary
Perfect SBOMs for firmware do not currently exist, and a programme designed to wait for them will produce nothing. The CRA's own floor is top-level dependencies in a machine-readable format, which is far below what is useful and far below what is achievable.
Aim for complete coverage of the managed dependency set, best-effort coverage of the unmanaged set, explicit recording of what you could not identify, and one document per release kept forever. That is achievable this quarter, and it is enough to answer the questions that matter when something is being exploited.
Tools referenced are syft, osv-scanner and binwalk, all open source; Yocto's SPDX support is in the build system itself. The CRA requirement referenced is Annex I Part II point 1 of Regulation (EU) 2024/2847.