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

empty report on java Spring4 project #4101

Open
pcouas opened this issue May 4, 2024 · 10 comments
Open

empty report on java Spring4 project #4101

pcouas opened this issue May 4, 2024 · 10 comments
Labels
bug Something isn't working
Milestone

Comments

@pcouas
Copy link

pcouas commented May 4, 2024

Hi

I have launched cve-bin-tool 3.3 on an old JAVA Spring 4 project, there is no exécution error, but report is empty ??
Severity │ Count │
├──────────┼───────┤
│ CRITICAL │ 0 │
│ HIGH │ 0 │
│ MEDIUM │ 0 │
│ LOW │ 0 │
│ UNKNOWN │ 0

I know there is Critical CVE on Spring4 project ? https://mvnrepository.com/artifact/org.springframework/spring-core/4.3.30.RELEASE
Direct vulnerabilities:
CVE-2023-20863
CVE-2023-20861
CVE-2022-22971
CVE-2022-22970
CVE-2022-22968

Why you don't report CVE ?
I have an mistake in my configuration ?

Regards

@pcouas pcouas added the bug Something isn't working label May 4, 2024
@terriko
Copy link
Contributor

terriko commented May 6, 2024

What exactly are you trying to scan? The source code? A packaged jar file?

We don't have a binary checker that detects spring4 (although someone could potentially add one if you want to make a feature request), but we do have code that reads a maven pom.xml file and should be able to scan based on that. Does whatever you're trying to scan have a pom.xml file and we're not scanning it correctly, or are you missing that file?

@pcouas
Copy link
Author

pcouas commented May 6, 2024 via email

@terriko
Copy link
Contributor

terriko commented May 6, 2024

Can you provide the pom.xml you're scanning, or the part with spring4 in it?

Looking at the CVEs you linked, it looks like the vendor is vmware and the product name is spring_framework so if the pom.xml file calls it anything other than exactly spring_framework, it's probably a lookup error and we're not finding the right thing in the database. For example, if it's called "spring" or "spring4" in pom.xml then we won't find the right component.

We're working on some stuff with PURLs over the next few months that'll help us start building a database of mappings for cases like this one where the product name in the vuln database doesn't precisely match what's in pom.xml, so if that's what this is it won't be an easy fix but it will be fixed in a few months after our google summer of code contributors get started on their projects. If that's not the issue, it might be something else messed up in our lookup code? Not sure. It's definitely a bug.

In the meantime, I'm not sure what the best workaround for you would be. If you're just trying to scan this one project, maybe generate and SBOM and add the exact vendor/product name as a CPE so you can scan that and get results as expected?

@terriko terriko modified the milestones: future, 3.3.1 May 6, 2024
@pcouas
Copy link
Author

pcouas commented May 8, 2024 via email

@pcouas
Copy link
Author

pcouas commented May 11, 2024 via email

@pcouas
Copy link
Author

pcouas commented May 11, 2024 via email

@terriko
Copy link
Contributor

terriko commented May 14, 2024

So, it looks like the problem may be that we aren't able to parse the version numbers correctly because of the way the file is constructed

https://github.com/waichee/spring4-rest-client-example/blob/master/pom.xml

It's all stuff like this:

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>

The ${spring.version} is defined above in <properties>, but I'm pretty sure cve-bin-tool is just reading ${spring.version} and not knowing what to do next.

Two potential options

  • if this is a common construction we're going to encounter in other projects, you'll want to fix cve_bin_tool/parsers/java.py to expand things like ${spring.version} (patches welcome!)
  • if this is unique to this file and not commonly used elsewhere, you may need to run a script or something to expand things so that what's in <version> is the correct version before scanning

That said, I think even if the version is fixed we'll run into the problem I described earlier: the component is listed as org.springframework and the CPE ID associated with those CVES is vmware:spring_framework -- we'll likely need to add some kind of mapping so it knows to connect the two, since a bare text search of springframework isn't smart enough to find spring_framework. Unfortunately, we don't have the infrastructure for that type of mapping yet (though it's coming in a few months as part of GSoC!) so this likely won't be fixed for some time.

@pcouas
Copy link
Author

pcouas commented May 20, 2024 via email

@pcouas
Copy link
Author

pcouas commented May 20, 2024 via email

@terriko
Copy link
Contributor

terriko commented May 21, 2024

Yeah, as I said before, we don't have a lookup table that tells us that springframework is vmware, springframework in NVD right now. But it's coming! Our GSoC contributors are starting next week and one of them will be working on the framework needed to store and use this kind of mapping. So... the fix is on the way, but it's probably going to take at least another month or two.

The best workaround I can think of is still to put your components in an SBOM and add the CPE metadata yourself (SBOM supports that where pom.xml does not), but I can understand if that's not super appealing. But the fix is coming eventually! Just going to take a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants