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

Wrong vulnerabilities reports when logical value NA used in CPE Version #1832

Closed
florentulve opened this issue Jul 26, 2022 · 2 comments · Fixed by #3070
Closed

Wrong vulnerabilities reports when logical value NA used in CPE Version #1832

florentulve opened this issue Jul 26, 2022 · 2 comments · Fixed by #3070
Labels
defect Something isn't working
Milestone

Comments

@florentulve
Copy link
Contributor

florentulve commented Jul 26, 2022

Hi,

I'm facing a issue with the version matching of component and vulnerabilites when CPE and Logical value NA ('-') are involed.

Current Behavior:

A project with a httpd server component identified by the CPE cpe:2.3:a:apache:http_server:2.4.53:*:*:*:*:*:*:* leads to be
vulnerable to the CVE 2007-6420.

The CVE 2007-6420 has the following cpe_match :

    "configurations" : {
      "CVE_data_version" : "4.0",
      "nodes" : [ {
        "operator" : "OR",
        "children" : [ ],
        "cpe_match" : [ {
          "vulnerable" : true,
          "cpe23Uri" : "cpe:2.3:a:apache:http_server:2.2.0:*:*:*:*:*:*:*",
          "cpe_name" : [ ]
        }, {
          "vulnerable" : true,
          "cpe23Uri" : "cpe:2.3:a:apache:http_server:2.2.2:*:*:*:*:*:*:*",
          "cpe_name" : [ ]
        }, {
          "vulnerable" : true,
          "cpe23Uri" : "cpe:2.3:a:apache:http_server:2.2.4:*:*:*:*:*:*:*",
          "cpe_name" : [ ]
        }, {
          "vulnerable" : true,
          "cpe23Uri" : "cpe:2.3:a:apache:http_server:2.2.6:*:*:*:*:*:*:*",
          "cpe_name" : [ ]
        }, {
          "vulnerable" : true,
          "cpe23Uri" : "cpe:2.3:a:apache:http_server:2.2.3:*:*:*:*:*:*:*",
          "cpe_name" : [ ]
        }, {
          "vulnerable" : true,
          "cpe23Uri" : "cpe:2.3:a:apache:http_server:-:*:*:*:*:*:*:*",
          "cpe_name" : [ ]
        } ]
      } ]
    },

Expected Behavior:

I think the vuln should'nt be reported.

The NVD search doesn't report the vuln: NVD Search

Moreover, according to the "Name Matching Specification Version 2.3" I dont't think the actual implementation in AbstractVulnerableSoftwareAnalysisTask.compareVersions is correct as I understand the table 6-2 fron chap "6.1 from Attribute Comparison Relations" at https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7696.pdf

Steps to Reproduce:

I reproduce the issue with a the test case below:

        var project = new Project();
        project.setName("acme-app");
        project = qm.createProject(project, List.of(), false);
        var component = new Component();
        component.setProject(project);
        component.setName("Apache httpd");
        component.setVersion("2.4.53");
        component.setCpe("cpe:2.3:a:apache:http_server:2.4.53:*:*:*:*:*:*:*");
        component = qm.createComponent(component, false);

        var vs1 = new VulnerableSoftware();
        vs1.setCpe23("cpe:2.3:a:apache:http_server:-:*:*:*:*:*:*:*");
        vs1.setPart("a");
        vs1.setVendor("apache");
        vs1.setProduct("http_server");
        vs1.setVersion("-");
        vs1.setVulnerable(true);
        var vs = qm.persist(vs1);

        var vulnerability = new Vulnerability();
        vulnerability.setVulnId("CVE-2007-6420");
        vulnerability.setSource(Vulnerability.Source.NVD);
        vulnerability.setVulnerableSoftware(List.of(vs));
        qm.createVulnerability(vulnerability, false);

        new InternalAnalysisTask().analyze(List.of(component));

        final PaginatedResult vulnerabilities = qm.getVulnerabilities(component);
        assertThat(vulnerabilities.getTotal()).isEqualTo(1);
        assertThat(vulnerabilities.getList(Vulnerability.class).get(0).getVulnId()).isEqualTo("CVE-2007-6420");

Expected

        final PaginatedResult vulnerabilities = qm.getVulnerabilities(component);
        assertThat(vulnerabilities.getTotal()).isEqualTo(0);
@florentulve florentulve changed the title Wrong vulnerabilities reports when logical value NA used Wrong vulnerabilities reports when logical value NA used in CPE Version Sep 2, 2022
florentulve added a commit to florentulve/dependency-track that referenced this issue Sep 11, 2022
…ersions because it's handled by compareAttributes

Signed-off-by: Florent Ulvé <florent.ulve@protonmail.com>
@Serraniel
Copy link

We have the same issue with the Appache HTTP server and also older OpenSSL entires.

Additionally, after suppressing those false postivies and Uploading a new SBOM file, with an updated version number (e.g changing 2.4.54 to 2.4.55) the old entries, which have been suppressed before, appear again.

@nscuro nscuro added defect Something isn't working and removed in triage labels Oct 2, 2023
@nscuro nscuro added this to the 4.9 milestone Oct 13, 2023
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
defect Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants