Repository navigation
Description
Current Behavior
PURLs in SBOMs contain often the information to which distribution they belonging to e.g. pkg:deb/debian/[email protected]+deb12u1?arch=amd64&distro=debian-12 means expat in version 2.5.0-1+deb12u1 from distribution debian-12 (which is bookworm).
For expat is a CVE called CVE-2024-4591 with following information which versions are affected:
- debian-11: versions < 2.2.10-2+deb11u6
- debian-12: versions < 2.5.0-1+deb12u1
- debian-13: versions < 2.6.2-2
Without knowing the distribution we can not decide if expat version 2.5.0-1+deb12u1 is affected or not since the vulnerability is not fixed in debian-11, but its fixed in debian-12 and debian-13. So we would need to fallback to the save decision that is vulnerable since it is older than the latest affected version (2.6.2-2, debian-13), meaning that we will create false positives debian-11 and debian-12.
This refers to @mjaix on Jan 22 2025 on Bug #4445:
We recently stumbled over a bunch of false positives with Debian/purls/OSV, using DT 4.12.2.
N.B. I am by no means a Debian (versioning) expert.
My $0.02 on the problem:
A solid version comparison functionality is fundamental. However, be aware that ecosystems like Debian or Ubuntu with multiple delivery branches provide semantics (from my limited/simplistic point-of-view, Alpine has a similar but simpler system set up).
The problem is to a great extent mitigated by the fact that vulnerability sources like OSV usually provide one or more matching rules for each "delivery branch" (that is, a given base version with or without patches or backports). As a consequence, the matching algorithm must look for matching "branches" in the set of matching rules for a vulnerability, and if a match exist, simply the final numbers need to be compared. In case no "branch" matches, simply compare the base numbers. With equal base numbers and no branch specified in the rule, any "branch" or build on top should suffice.
For the test of your solution, to provide some kind of long-term stability, and to avoid creating some "golden code",
I would recommend to create test data and a simple test suite to run against your implementation.
One of the actual false positives we have (and some derived edge cases) could be verified with the YAML test data below.
I am pretty sure that test experts will provide better solutions :-).
test_cases:
- vulnerability: CVE-2024-45491
osv_rules:- pkg:deb/debian/expat?arch=source (<2.5.0-1+deb12u1)
- pkg:deb/debian/expat?arch=source (<2.6.2-2)
- pkg:deb/debian/expat?arch=source (<2.2.10-2+deb11u6)
test_versions: - purl: pkg:deb/debian/[email protected]%2Bdeb12u1?arch=amd64&distro=debian-12
rationale: matching rule 1 / equal # our actual problem
expected_result: false # with DT 4.12.2 we get true - purl: pkg:deb/debian/[email protected]%2Bdeb12u1?arch=source&distro=debian-12
rationale: matching rule 1 / equal # our actual problem, as it perhaps should look like
expected_result: false - purl: pkg:deb/debian/[email protected]%2Bdeb12u2?arch=source&distro=debian-12
rationale: matching rule 1 / higher patch
expected_result: false - purl: pkg:deb/debian/[email protected]?arch=source&distro=debian-12
rationale: matching rule 1 / lower, no patch
expected_result: true
some additional test cases
- purl: pkg:deb/debian/[email protected]?arch=source
rationale: matching rule 2 / equal
expected_result: false - purl: pkg:deb/debian/[email protected]%2Bdeb13u1?arch=source
rationale: matching rule 2 / higher patch
expected_result: false - purl: pkg:deb/debian/[email protected]?arch=source
rationale: matching rule 2 / lower build
expected_result: true - purl: pkg:deb/debian/[email protected]%2Bdeb11u6?arch=source
rationale: matching rule 3 / equal
expected_result: false - purl: pkg:deb/debian/[email protected]%2Bdeb11u7?arch=source
rationale: matching rule 3 / higher patch
expected_result: false - purl: pkg:deb/debian/[email protected]%2Bdeb11u5?arch=source
rationale: matching rule 3 / lower patch
expected_result: true - purl: pkg:deb/debian/[email protected]?arch=source
rationale: matching rule 2 / highest version
expected_result: false - purl: pkg:deb/debian/[email protected]?arch=source
rationale: matching rule 3 / lowest version
expected_result: true
some additional test cases, hypothetical stuff
- purl: pkg:deb/debian/[email protected]?arch=source&distro=debian-12
rationale: matching rule 1 / higher build
expected_result: false
Steps to Reproduce
Expected Behavior
The distribution name given by purls show be used to lookup the correct affected version range of CVEs
Dependency-Track Version
4.13.0-SNAPSHOT
Dependency-Track Distribution
Container Image
Database Server
PostgreSQL
Database Server Version
No response
Browser
Google Chrome
Checklist
- I have read and understand the contributing guidelines
- I have checked the existing issues for whether this defect was already reported
Activity
nickrmc83 commentedon May 7, 2025
We have hit this issue as described here specifically the 2 CVEs, GHSA-7cfh-j5pv-fw3c and GHSA-3w7r-v4fr-r43w which do not impact Ubuntu 22.04 but are detected as such
nscuro commentedon May 9, 2025
FWIW, I had to deal with this as again while building a PoC for a revised vulnerability database:
The concept of "additional matching criteria" can probably be transferred to the current database model, as it is a non-intrusive change.
Andre-85 commentedon May 14, 2025
@nscuro:
While looking howto fix #4948 i saw that in the table VULNERABLESOFTWARE is a field named PURL_QUALIFIERS and following the scheme of filling the other PURL_* it should be filled with the distro information (and other attributes from the purl qualifiers) of the purl since its in the qualifier part of the purl.
What i don't know right now, howto encode multiple qualifiers (since there is not only "distro", but at least also "arch") in a single field. I thought about json, but i don't know how this is supported in the databases we claim support with.
Do you got an idea howto encode this and which type of structured data is best supported by databases? Or perhaps doing a complete custom encode/decode for not requiring extra database features?
koberbe commentedon Jun 24, 2025
I'm facing the same issues. When I upload the following SBOM to DT, it reports ~200 vulnerability. For
Ubuntu:Pro:20.04:LTSandUbuntu:20.04:LTSthere are only 7 open vulnerabilities fortar,opensslandvim. It looks like the absence of a ecosystem filter is causing these false positives.{ "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", "bomFormat": "CycloneDX", "specVersion": "1.6", "serialNumber": "urn:uuid:1b9940bc-c831-4099-83aa-3929b5b8a77e", "version": 1, "metadata": { "timestamp": "2025-06-24T13:13:45Z", "lifecycles": [ { "phase": "operations" } ], "tools": { "components": [ { "name": "distro2sbom", "version": "0.6.0", "type": "application" } ] }, "component": { "type": "operating-system", "bom-ref": "CDXRef-DOCUMENT", "name": "Distro-ubuntu" } }, "components": [ { "type": "operating-system", "bom-ref": "1-ubuntu", "name": "ubuntu", "version": "focal", "supplier": { "name": "ubuntu" }, "cpe": "cpe:/o:ubuntu:ubuntu:focal", "externalReferences": [ { "url": "https://www.ubuntu.com/", "type": "website", "comment": "Home page for project" } ] }, { "type": "library", "bom-ref": "44-tar", "name": "tar", "version": "1.30+dfsg-7ubuntu0.20.04.4", "supplier": { "name": "Ubuntu Developers", "contact": [ { "email": "[email protected]" } ] }, "cpe": "cpe:2.3:a:ubuntu_developers:tar:1.30\\+dfsg-7ubuntu0.20.04.4:*:*:*:*:*:*:*", "description": "GNU version of the tar archiving utility", "externalReferences": [ { "url": "https://www.gnu.org/software/tar/", "type": "website", "comment": "Home page for project" } ], "purl": "pkg:deb/ubuntu/[email protected]+dfsg-7ubuntu0.20.04.4?arch=amd64" }, { "type": "library", "bom-ref": "284-openssl", "name": "openssl", "version": "1.1.1f-1ubuntu2.24", "supplier": { "name": "Ubuntu Developers", "contact": [ { "email": "[email protected]" } ] }, "cpe": "cpe:2.3:a:ubuntu_developers:openssl:1.1.1f-1ubuntu2.24:*:*:*:*:*:*:*", "description": "Secure Sockets Layer toolkit - cryptographic utility", "externalReferences": [ { "url": "https://www.openssl.org/", "type": "website", "comment": "Home page for project" } ], "purl": "pkg:deb/ubuntu/[email protected]?arch=amd64" }, { "type": "library", "bom-ref": "1705-vim", "name": "vim", "version": "2:8.1.2269-1ubuntu5.32", "supplier": { "name": "Ubuntu Developers", "contact": [ { "email": "[email protected]" } ] }, "cpe": "cpe:2.3:a:ubuntu_developers:vim:2\\:8.1.2269-1ubuntu5.32:*:*:*:*:*:*:*", "description": "Vi IMproved - enhanced vi editor", "licenses": [ { "license": { "id": "Vim", "url": "http://vimdoc.sourceforge.net/htmldoc/uganda.html", "acknowledgement": "concluded" } } ], "copyright": "Copyright: 2001-2017 Bram Moolenaar <[email protected]>", "externalReferences": [ { "url": "https://www.vim.org/", "type": "website", "comment": "Home page for project" } ], "purl": "pkg:deb/ubuntu/vim@2:8.1.2269-1ubuntu5.32?arch=amd64", "properties": [ { "name": "License Comments", "value": "This information was automatically extracted from the package." } ] } ] }koberbe commentedon Jun 24, 2025
I'm wondering if reading the ecosystem from the version is the best approach, because it only solves the problem for some of the packages. Not all packages include information about the ecosystem in their version.
The information should somehow be included in the SBOM. As you can see in the SBOM from
distro2sbomthe tool is creating a separate componentoperating-systemwhich receives aversionfield. I could set the value when creating the SBOM. Could this be an idea?I also like the idea of putting it into the pURL, because like this you can put multiple ecosystems into a single SBOM.
Andre-85 commentedon Jul 3, 2025
Hi @koberbe,
I also thought first it would be a good idea to capture the version of the ecosystem in an extra component and use this than for all packages. Problem is here is that all packages need to come from the same distribution. But i my case i got two different distributions: One is the Ubuntu/Debian distribution and the other one is my private distribution containing my packages for customizing Ubuntu/Debian. So i decided to do the ecosystem version per package in the PURL. Debian-PURLs (https://github.com/package-url/purl-spec/blob/main/PURL-TYPES.rst) support the extra qualifier "distro", where the distribution the package is coming from can be noted. I guess for other ecosystems: Either some similar qualifier exists, or the ecosystem version is not needed since the package with this version can be only in one version of the ecosystem.
koberbe commentedon Jul 10, 2025
I agree that this would be a great place to put the ecosystem information. But we would need to map the distro value to the name used in OSV database, e.g.
focal == Ubuntu:20.04:LTS | Ubuntu:Pro:20.04:LTSConsider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
5 remaining items
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
Consider OS distro during vulnerability matching
github-actions commentedon Apr 2, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Consider OS distro during vulnerability matching