-
Notifications
You must be signed in to change notification settings - Fork 632
Potential regression in CVE detection from 0.87.0 (v5 schema) to 0.88.0 (v6 schema) for go-module detection #2642
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
Comments
A cursory look (thanks @westonsteimel!) shows that there's a version constraint which fails to parse, perhaps due to a recent change to the golang version parsing using semver: https://github.com/anchore/grype/blob/main/grype/version/golang_version.go#L35:
|
TL;DRThe version constraint on the GHSA doesn't point to a valid Go package version, but does point to a real git tag. The path forward is to make Grype fall back to fuzzier version matching logic in this edge case, and possibly open an issue with GHSA to see whether that version constraint is correct. Long versionI've gathered a little bit more information here:
Because of item 5, it might be worth opening an issue with GHSA and seeing whether we can put To see whether there are other GHSAs in a similar boat, I instrumented grype-db so that it would try to parse constraints when writing them into the database, and note any time it was emitting an invalid constraint. This only happens a handful of times. Of those, two are for Go issues:
To defend against this in the future, we'll put logic in grype to fall back to the "fuzzy" version comparator in cases where we can't parse the version constraint (or package version) in line with its advertised type. Additionally, this research led me to find a handful of Ruby GHSAs in a similar boat, tracked separately at #2646 |
Thank you for the detailed analysis. I am glad you have identified this as an edge case. |
This is fixed in today's grype db due to anchore/grype-db#574 taking effect and telling grype to use the "fuzzy" version matcher in the case that upstream data can't be parsed as an ecosystem specific version constraint. Client side changes that should make grype more resilient to this kind of data weirdness have landed in #2651 as well, which should be released soon. |
Thank you @willmurphyscode |
What happened:
Using grype 0.87.0 and the attached syft SBOM for a wolfi container image I see CVE GHSA-92cp-5422-2mw7 detected.
I can also see the github.com/redis/go-redis/v9 go-module artifact present in the syft SBOM
BUT if I scan the same SBOM using grype 0.88.0 I do not see this CVE detected.
The output does reference an ignored CVE but this is a different CVE - GHSA-3wqc-mwfx-672p
I see the same behaviour in later versions of grype but we were able to narrow the change down to the 0.88.0 release.
What you expected to happen:
I expect to see the same CVEs detected in the different versions of grype
How to reproduce it (as minimally and precisely as possible):
I have attached the grype scan results and verbose logs for both scans.
Anything else we need to know?:
This is concerning as we could be missing valid detections. The syft SBOM does find the vulnerable component version present yet grype does not detect it as a CVE.
Environment:
grype version
: Multiple versions installed from git tag.cat /etc/os-release
or similar):traefik-3.2-pretty.json
grype-0.87.0-scan-traefik-3.2-pretty.json
grype-0.88.0-scan-traefik-3.2-pretty.json
grype-0.87.0-scan-traefik-3.2.log
grype-0.88.0-scan-traefik-3.2.log
The text was updated successfully, but these errors were encountered: