SBOM generated are missing packages #6457
-
DescriptionWe are using trivy to generate SBOMs for our images. Unrelated to the issue itself, but for added context, I found this while working on implementing end of life scans using the SBOMs generated by trivy. When testing the end of life scans, I found that obvious outdated packages are not part of the SBOM. For demonstration purposes, I'll use xeol. When scanning an outdated docker image of
This is expected result, but when I first generate the SBOM using trivy, then scanning with the tool I get a different result:
You can see that there are no EOL software packages detected during this scan... You may notice the warnings, which I suspected that the xeol scanner could be the culprit, so I manually checked the SBOM, and no matter how I tried, but there is no version information detected for any python packages, which is obviously causing the xeol tool to miss the python 3.7.17 EOL finding. There are references to python, but version information is missing. An excerpt from
I searched/looked in the SBOM lots of ways, but there's no version information regarding python 3.7.17, leading me to believe that trivy fails to generate the SBOMs properly, and is missing out on some packages... Another reasoning I can give is that when generating SBOMs for the same image using syft, I get a much larger SBOM file compared to trivy. Scanning the same image as before:
When checking the size, it's evident that the SBOM generated by
When manually checking the SBOM of syft, I see that there's a python package with the correct version, this is completely missing from
Desired BehaviorThat Actual Behavior
Reproduction Steps1. trivy image --format spdx-json --output result-trivy.json python:3.7.17-slim-bullseye
2. Try searching for python 3.7.17 version
3. python 3.7.17 version package is not part of the generated SBOM TargetContainer Image ScannerNone Output FormatSPDX ModeStandalone Debug Output$ trivy image --format spdx-json --output result-trivy.json --debug python:3.7.17-slim-bullseye
2024-04-04T14:18:24.876+0200 DEBUG ["cyclonedx" "spdx" "spdx-json" "github"] automatically enables '--list-all-pkgs'.
2024-04-04T14:18:24.876+0200 DEBUG Severities: ["UNKNOWN" "LOW" "MEDIUM" "HIGH" "CRITICAL"]
2024-04-04T14:18:24.876+0200 DEBUG Ignore statuses {"statuses": null}
2024-04-04T14:18:24.876+0200 INFO "--format spdx" and "--format spdx-json" disable security scanning
2024-04-04T14:18:24.882+0200 DEBUG cache dir: /home/wisefrog/.cache/trivy
2024-04-04T14:18:24.882+0200 DEBUG Enabling misconfiguration scanners: [azure-arm cloudformation dockerfile helm kubernetes terraform terraformplan-json terraformplan-snapshot]
2024-04-04T14:18:24.885+0200 DEBUG The nuget packages directory couldn't be found. License search disabled
2024-04-04T14:18:24.885+0200 DEBUG Image ID: sha256:b5b0a67a91504c733095fdc8785063e5732d19237524be91c600d1608f1c7c99
2024-04-04T14:18:24.885+0200 DEBUG Diff IDs: [sha256:10764c37bcbc8dff79bd134e34e5e8d9c6a3e0d482ca2e6e0ff978485ada5c3c sha256:aa065d85cfdcb9a4b9d3352d119bf1fbe1d8e4d99bfec50b82eb88e5d4ca1576 sha256:ebf2bf60c0964e5bb3750de74d890d41ca38137c1d25b0e9001811afccbb51ab sha256:59c986a304a71121d1264fda1734710390333389e11eba96228f93b71db4eead sha256:85d9ae13b6488cc276ec1ddd60ac5f8e88988caf574fa9a4765588876dc00d10]
2024-04-04T14:18:24.885+0200 DEBUG Base Layers: [sha256:10764c37bcbc8dff79bd134e34e5e8d9c6a3e0d482ca2e6e0ff978485ada5c3c] Operating SystemUbuntu 22.04.4 LTS Version$ trivy --version
Version: 0.50.1
Vulnerability DB:
Version: 2
UpdatedAt: 2024-04-04 06:10:58.040841783 +0000 UTC
NextUpdate: 2024-04-04 12:10:58.040841502 +0000 UTC
DownloadedAt: 2024-04-04 11:38:41.799925414 +0000 UTC
Java DB:
Version: 1
UpdatedAt: 2024-04-04 00:51:06.207904281 +0000 UTC
NextUpdate: 2024-04-07 00:51:06.207904121 +0000 UTC
DownloadedAt: 2024-04-04 10:24:26.047578215 +0000 UTC Checklist
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
I can confirm this issue and this goes beyond SBOM generation, python version was not identified at all, not even when going directly to vuln scan instead of first SBOM. |
Beta Was this translation helpful? Give feedback.
-
Most likely the root cause of this issue is part of the docs https://aquasecurity.github.io/trivy/v0.50/docs/scanner/vulnerability/: We are thinking of abandoning trivy because of this. Seems that trivy is useless for scanning distroless images, since it won't even detect the main binary which runs on the distroless image... |
Beta Was this translation helpful? Give feedback.
-
Hello @kovacs-levent Unfortunately Trivy supports only Go binaries and Rust Binaries built with cargo-auditable - https://aquasecurity.github.io/trivy/v0.50/docs/coverage/language/
That is why Trivy can't detect this package. Regards, Dmitriy |
Beta Was this translation helpful? Give feedback.
-
If anyone is interested in such feature, aquasec explicitly denied my PR since it's supposed to be a "paid feature". If anyone is actually interested in such feature, feel free to use my fork: |
Beta Was this translation helpful? Give feedback.
If anyone is interested in such feature, aquasec explicitly denied my PR since it's supposed to be a "paid feature".
If anyone is actually interested in such feature, feel free to use my fork:
https://github.com/kovacs-levent/trivy/tree/parse-binary-versions