Skip to content

ROX-12350: Detect CVE-2022-22978 #930

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

Merged
merged 15 commits into from
Oct 17, 2022
Merged

ROX-12350: Detect CVE-2022-22978 #930

merged 15 commits into from
Oct 17, 2022

Conversation

RTann
Copy link
Collaborator

@RTann RTann commented Sep 13, 2022

This PR ensures we can detect CVE-2022-22978. When inspecting an example Spring application, I found the spring-security JARs were named more than simply spring-security. For example, there is spring-security-web. In NVD, the CPE only matches spring-security, so I add a manual entry to ensure we can detect it. I followed Snyk's lead https://security.snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORKSECURITY-2833359 and attributed the vuln to spring-security-web.

In this PR, I also try to future-proof and try to associate known Spring components to known vendors to ensure we can capture more Spring-related vulns.

@RTann RTann added the generate-dumps-on-pr Generates the image based on dumps from the PR label Sep 13, 2022
@ghost
Copy link

ghost commented Sep 13, 2022

Images are ready for the commit at d97d7e0.

To use the images, use the tag 2.26-43-gd97d7e05f7.

@openshift-ci
Copy link

openshift-ci bot commented Oct 6, 2022

@RTann: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-tests d97d7e0 link false /test e2e-tests
ci/prow/slim-e2e-tests d97d7e0 link false /test slim-e2e-tests

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@RTann RTann requested a review from misberner October 13, 2022 20:04
Copy link
Contributor

@misberner misberner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, from reading the problem description in the PR description, the solution seems non-obvious to me.

If I understand the mechanics correctly, we now detect a vulnerability that is attributed to spring_security in an image that uses the spring_security_web package by essentially duplicating the vuln in a manual entry. Isn't this very prone to not ageing well? What if the severity or some other metadata of the vuln is updated upstream?

Rather than having manual vuln entries, wouldn't a targeted "CPE override" be the feature we want? Another possible alternative: should we have a notion of "virtual packages"? I.e., if a vuln is reported to affect spring_security, shouldn't we treat it as affecting spring_security_*? From the referenced Snyk entry, it seems quite obvious that it indeed only affects spring_security_web, so a CPE with that seems the more precise option. However, in the general case, this seems to be the right thing to do, because there isn't even a spring_security package per se, just a lot of spring-security-* packages.

Comment on lines +125 to +130
for name := range names {
if knownSpringComponents.Contains(name) {
vendorSet.AddAll(knownSpringVendors...)
break
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If performance is not a strong concern (it might be, though), you could also do

Suggested change
for name := range names {
if knownSpringComponents.Contains(name) {
vendorSet.AddAll(knownSpringVendors...)
break
}
}
if !names.Intersect(knownSpringComponents).IsEmpty() {
vendorSet.AddAll(knownSpringVendors...)
}

Or, to address the performance issue, maybe it would also be nice to add a Intersects(other Set) bool method to pkg/set (not in this PR, just as an idea).

@@ -90,6 +120,15 @@ func getPossibleVendors(origins []string) set.StringSet {
if vendorSet.Cardinality() == 0 {
vendorSet.Add("apache")
}

// Add Spring-specific vendors.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to do this only after adding "apache" based on nothing but hope? Isn't the knownSpringComponents check more precise than the "apache" default and therefore should suppress the latter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess another question would be, is it adequate to do this here even when vendorSet is non-empty (and wasn't populated via the apache fallback)?

@misberner
Copy link
Contributor

Note: if this is time-sensitive and you share my view but deem those infeasible to implement in the timeframe, that's fine, just curious if you had considered those points.

@RTann RTann merged commit 08cedcb into master Oct 17, 2022
@RTann RTann deleted the ROX-12350 branch October 17, 2022 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generate-dumps-on-pr Generates the image based on dumps from the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants