anchore / grype

A vulnerability scanner for container images and filesystems
Apache License 2.0
8.84k stars 574 forks source link

False negatives in finding CVEs in jar files #209

Closed wagde-orca closed 3 years ago

wagde-orca commented 4 years ago

What happened: I ran grype on a directory with jar files and it miss several CVEs for example nexus-main.jar version 3.0.0-03

What you expected to happen: I expected to see: "CVE-2019-7238", "CVE-2020-10199", "CVE-2020-10203", "CVE-2020-10204", "CVE-2020-11444" in nexus-main-3.0.0-03.jar. But grype did not catch any of them

How to reproduce it (as minimally and precisely as possible):

wget http://download.sonatype.com/nexus/3/nexus-3.0.0-03-unix.tar.gz -P nexus
cd nexus
tar -zxvf nexus-3.0.0-03-unix.tar.gz
grype "dir:nexus-3.0.0-03/lib/boot"

Anything else we need to know?: I saw other FPs/FNs in java... i can supply more examples

Environment:

wagoodman commented 4 years ago

This is great info --thanks for reporting. From what I can tell so far from an initial look it seems that the groupID and artifactID aren't quite enough to directly match against the upstream sources (e.g. org.sonatype.nexus:nexus-components vs org.sonatype.nexus:nexus-core for GHSA... for NVD a CPE match of cpe:2.3:a:sonatype:nexus:*:*:*:*:*:*:*:* would be needed, but the vendor wasn't pulled out to be exactly sonatype but instead org.sonatype.nexus).

I think we can do more processing on the groupID to try out multiple vendor values (say, take the field just after org wichi splitting on .).

This is also starting to feel like the same conclusion reached in #192 , where fuzzy matching combined some confidence value would be ideal (see comment).

wagoodman commented 3 years ago

@wagde-orca the package and vendor sourcing from the POM groupID enhancement has been released under https://github.com/anchore/grype/releases/tag/v0.6.0

wagde-orca commented 3 years ago

cool Thanx I will check it in few days