You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pom.xml parser (cve_bin_tool/parsers/java.py) never reads <groupId>. It builds the purl as pkg:maven/<artifactId> and, when purl2cpe has nothing for that, falls back to find_vendor(), which returns every NVD vendor that has a product of that name.
For a private module whose artifactId happens to be core, that means the component is reported three times over, as drupal:core, mobileiron:core and onlyoffice:core, and inherits all of their CVEs.
This came out of a real scan of a vendor's Java delivery. Its modules are named <product>-core, <product>-broker and so on, with artifactIdcore under a private groupId. cve-bin-tool attributed 492 of its 534 findings to core 3.29.3-SNAPSHOT, among them every one of the 62 CRITICAL findings in the report -- for example CVE-2016-9450, a cache-poisoning bug in the Drupal 8 password-reset form, pinned on an in-house Java module. The report's verdict ("must not be deployed") rested entirely on this.
Why it is not caught today
run_checker calls self.generate_purl(product) without a namespace, so the purl carries no groupId and purl2cpe is queried with pkg:maven/core and pkg:maven/%/core -- the wildcard would even borrow another group's core.
find_vendor fans out to every vendor for the bare product name. That was a deliberate interim upgrade in Improve handling of multiple vendors in package parsers #2798 ("multiple vendors is an upgrade over the first one"), and @anthonyharrison anticipated there that a hint from the metadata would be needed to cut the false positives back. Improve handling of multiple vendors in package parsers #2798 was later closed as solved by the PURL integration -- but for Java the purl was being built without its namespace, so the fallback was still reached with no hint at all.
Maven already gives us that hint: the groupIdis the vendor namespace.
Also
While at it: when a pom has a <parent>, the parser reports the parent'sartifactId as the product and never reads the module's own. Every module of a multi-module build is recorded under the parent's name. artifactId is required and never inherited in Maven; only groupId and version are.
I have a fix with hermetic tests for both and will link the PR.
Description
The
pom.xmlparser (cve_bin_tool/parsers/java.py) never reads<groupId>. It builds the purl aspkg:maven/<artifactId>and, whenpurl2cpehas nothing for that, falls back tofind_vendor(), which returns every NVD vendor that has a product of that name.For a private module whose
artifactIdhappens to becore, that means the component is reported three times over, asdrupal:core,mobileiron:coreandonlyoffice:core, and inherits all of their CVEs.To reproduce
pom.xml:Hermetic probe (a stand-in
cve_dbthat answers the way NVD does for the product namecore):Output on
main(b1d0905):What it did in practice
This came out of a real scan of a vendor's Java delivery. Its modules are named
<product>-core,<product>-brokerand so on, withartifactIdcoreunder a privategroupId. cve-bin-tool attributed 492 of its 534 findings tocore 3.29.3-SNAPSHOT, among them every one of the 62 CRITICAL findings in the report -- for example CVE-2016-9450, a cache-poisoning bug in the Drupal 8 password-reset form, pinned on an in-house Java module. The report's verdict ("must not be deployed") rested entirely on this.Why it is not caught today
run_checkercallsself.generate_purl(product)without a namespace, so the purl carries no groupId andpurl2cpeis queried withpkg:maven/coreandpkg:maven/%/core-- the wildcard would even borrow another group'score.find_vendorfans out to every vendor for the bare product name. That was a deliberate interim upgrade in Improve handling of multiple vendors in package parsers #2798 ("multiple vendors is an upgrade over the first one"), and @anthonyharrison anticipated there that a hint from the metadata would be needed to cut the false positives back. Improve handling of multiple vendors in package parsers #2798 was later closed as solved by the PURL integration -- but for Java the purl was being built without its namespace, so the fallback was still reached with no hint at all.Maven already gives us that hint: the
groupIdis the vendor namespace.Also
While at it: when a pom has a
<parent>, the parser reports the parent'sartifactIdas the product and never reads the module's own. Every module of a multi-module build is recorded under the parent's name. artifactId is required and never inherited in Maven; only groupId and version are.I have a fix with hermetic tests for both and will link the PR.