Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive for ruby gem webrick #1405

Open
sparrowt opened this issue Jul 27, 2023 · 7 comments
Open

False positive for ruby gem webrick #1405

sparrowt opened this issue Jul 27, 2023 · 7 comments
Labels
bug Something isn't working false-positive:cpe This issue is a report of a false positive cause by CPE matching false-positive

Comments

@sparrowt
Copy link
Contributor

sparrowt commented Jul 27, 2023

What happened:
Grype is reporting a (very old) vulnerability in the webrick ruby gem despite running a version with the fix:

> docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /var/tmp/grype_cache:/var/tmp/ -e GRYPE_DB_CACHE_DIR=/var/tmp/ anchore/grype:v0.64.2 fluent/fluentd:v1.16.0-1.0
 ✔ Vulnerability DB                [no update available]
 ✔ Pulled image
 ✔ Loaded image                                                                                                                                                              fluent/fluentd:v1.16.0-1.0
 ✔ Parsed image                                                                                                                 sha256:caf29af93836d148c852bc4c7db0aa9dcf7b01269bdeca1e0bee721e8ccea31a
 ✔ Cataloged packages              [129 packages]
 ✔ Scanned for vulnerabilities     [46 vulnerabilities]
   ├── 2 critical, 21 high, 19 medium, 0 low, 0 negligible (4 unknown)
   └── 18 fixed
NAME                   INSTALLED         FIXED-IN          TYPE  VULNERABILITY        SEVERITY
...
webrick                1.7.0                               gem   CVE-2008-1145        Medium
webrick                1.7.0             2.2.8             gem   GHSA-369m-2gv6-mw28  High

GHSA-369m-2gv6-mw28 says the patched version is 1.4.0 so 1.7.0 should be fine.

However grype says it is 'Fixed in' 2.2.8 which doesn't make sense because there is no version 2.2.8 of the webrick gem https://github.com/ruby/webrick/releases / https://rubygems.org/gems/webrick

This seems like an FP, possibly because the CPEs on https://nvd.nist.gov/vuln/detail/CVE-2017-10784 seem to be referring to ruby versions (where 2.2.8 would be the first patched one AFAICS) which grype has then compared against the version of webrick itself.

What you expected to happen:
No vulnerability to be reported for Ruby Gem webrick at version 1.7.0

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

docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /var/tmp/grype_cache:/var/tmp/ -e GRYPE_DB_CACHE_DIR=/var/tmp/ anchore/grype:v0.64.2 fluent/fluentd:v1.16.0-1.0

Anything else we need to know?:

Environment:

  • Output of grype version: 0.64.2
  • OS (e.g: cat /etc/os-release or similar): Docker Desktop for Windows
@sparrowt sparrowt added the bug Something isn't working label Jul 27, 2023
@shpml
Copy link

shpml commented Jul 27, 2023

False positive upstream.

github/advisory-database#2526
github/advisory-database#2533

@sparrowt
Copy link
Contributor Author

Ah fab, thank you 👍 out of interest how long does it normally take (now that upstream PR was merged) for it to make its way into the grype vuln db?

@shpml
Copy link

shpml commented Jul 31, 2023

No idea, I'm using a different vulnerability scanner that uses the same DB and it seems to be fixed there.

@westonsteimel
Copy link
Contributor

I did also contact NVD regarding https://nvd.nist.gov/vuln/detail/CVE-2008-1145 to try and get the CPE updated to something more like on https://nvd.nist.gov/vuln/detail/CVE-2009-4492, but that may take some time for them to process

@westonsteimel
Copy link
Contributor

westonsteimel commented Aug 1, 2023

grype databases typically get updated and published once per day by the following workflows

We do currently have an issue with the automated publishing pipeline that we're working on, but we manually published an update yesterday so the GHSA record update should already be available

@sparrowt
Copy link
Contributor Author

sparrowt commented Aug 1, 2023

Thanks GHSA-369m-2gv6-mw28 is no longer incorrectly flagged 👍

I guess we'll leave this open for https://nvd.nist.gov/vuln/detail/CVE-2008-1145 while that's still wrongly flagged

NAME                   INSTALLED         FIXED-IN          TYPE  VULNERABILITY        SEVERITY
...
ruby-webrick           1.7.0-r1                            apk   CVE-2008-1145        Medium
...
webrick                1.7.0                               gem   CVE-2008-1145        Medium

@spiffcs spiffcs added false-positive:cpe This issue is a report of a false positive cause by CPE matching and removed false-positive:cpe This issue is a report of a false positive cause by CPE matching labels Aug 17, 2023
@spiffcs
Copy link
Contributor

spiffcs commented Aug 17, 2023

We can tell from the description that this is a FP, but the cpe we're generating compared with what is in NVD is correct

NVD: cpe:2.3:a:ruby-lang:webrick:-:*:*:*:*:ruby:*:*
Grype: cpe:2.3:a:ruby-lang:webrick:1.7.0:*:*:*:*:*:*:*

In the above case - is used in the version selector and weston has contacted NVD about getting better CPE for this.

One more final thought - we are moving away from CPE matching in the near future and this issue should be solved once we move to the PURL/GHSA model.

@willmurphyscode willmurphyscode added the false-positive:cpe This issue is a report of a false positive cause by CPE matching label Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working false-positive:cpe This issue is a report of a false positive cause by CPE matching false-positive
Projects
Status: No status
Development

No branches or pull requests

6 participants