Vulnerabilities in pkg:golang/github.com/openclarity/kubeclarity/backend

PACKAGE
Advisory Identifier: GHSA-5248-h45p-9pgw
Advisory Summary

CVE-2024-39909 is a HIGH (CVSS 6.5) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Github.com/openclarity/kubeclarity/backend libraries in the Go ecosystem. The issue involves sql injection in the kubeclarity rest api. Remediation is available by upgrading affected packages to version 0.0.0-20240711173334-1d1178840703.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/openclarity/kubeclarity/backend

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/openclarity/kubeclarity/backend. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-5248-h45p-9pgw CVE-2024-39909 HIGH SQL Injection in the KubeClarity REST API

CVE-2024-39909 at a Glance

CVE Identifier CVE-2024-39909
GHSA Identifier GHSA-5248-h45p-9pgw
Severity HIGH
CVSS v3.1 Base Score 6.5
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Github.com/openclarity/kubeclarity/backend
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-39909

To remediate this vulnerability, upgrade all affected Github.com/openclarity/kubeclarity/backend dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/openclarity/kubeclarity/backend fixed: 0.0.0-20240711173334-1d1178840703
Upgrade github.com/openclarity/kubeclarity/backend to 0.0.0-20240711173334-1d1178840703
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/openclarity/kubeclarity/backend

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-39909, inspect your project dependencies for Github.com/openclarity/kubeclarity/backend:

inspect dependencies for github.com/openclarity/kubeclarity/backend

Analyze the terminal output to locate any version of Github.com/openclarity/kubeclarity/backend in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20240711173334-1d1178840703), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Github.com/openclarity/kubeclarity/backend, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A time/boolean SQL Injection is present in the following resource `/api/applicationResources` via the following parameter `packageID` ### Details As it can be seen [here](https://github.com/openclarity/kubeclarity/blob/main/backend/pkg/database/id_view.go#L79), while building the SQL Query the `fmt.Sprintf` function is used to build the query string without the input having first been subjected to any validation. ### PoC The following command should be able to trigger a basic version of the behavior: `curl -i -s -k -X $'GET' \ -H $'Host: kubeclarity.test' \ $'https://kubeclarity.test/api/applicationResources?page=1&pageSize=50&sortKey=vulnerabilities&sortDir=DESC&packageID=c89973a6-4e7f-50b5-afe2-6bf6f4d3da0a\'HTTP/2'` ### Impact While using the Helm chart, the impact of this vulnerability is limited since it allows read access only to the kuberclarity database, to which access is already given as far as I understand to regular users anyway. On the other hand, if Kuberclarity is deployed in a less secure way, this might allow access to more data then allowed or expected (beyond the limits of the KuberClarity database). The vulnerable line was introduced as part of the initial commit of Kubeclarity, so all versions up until the latest (2.23.1) are assumed vulnerable.

CVE-2024-39909 Affected Github.com/openclarity/kubeclarity/backend Versions

1 component(s)
Fixed Versions:
0.0.0-20240711173334-1d1178840703
Product / Package Ecosystem Affected Versions Fixed Version
github.com/openclarity/kubeclarity/backend
Go
< 0.0.0-20240711173334-1d1178840703
0.0.0-20240711173334-1d1178840703

References

Frequently Asked Questions

What is CVE-2024-39909?
CVE-2024-39909 is a security vulnerability in Github.com/openclarity/kubeclarity/backend involving SQL Injection in the KubeClarity REST API under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Github.com/openclarity/kubeclarity/backend versions are affected?
Affected versions include releases prior to 0.0.0-20240711173334-1d1178840703 across affected packages: github.com/openclarity/kubeclarity/backend.
What version fixes CVE-2024-39909?
Upgrading to 0.0.0-20240711173334-1d1178840703 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/openclarity/kubeclarity/backend affected?
Yes, github.com/openclarity/kubeclarity/backend is affected in releases prior to 0.0.0-20240711173334-1d1178840703. Upgrade your dependency to 0.0.0-20240711173334-1d1178840703 or later.
What is the CVSS score of CVE-2024-39909?
CVE-2024-39909 has a CVSS v3.1 base score of 6.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2024-39909?
CVE-2024-39909 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Go dependencies for CVE-2024-39909?
Run the dependency tree command: 'inspect dependencies for github.com/openclarity/kubeclarity/backend'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5248-h45p-9pgw",
  "modified" : "2024-11-18T16:26:51Z",
  "published" : "2024-07-12T13:56:42Z",
  "aliases" : [ "CVE-2024-39909" ],
  "summary" : "SQL Injection in the KubeClarity REST API",
  "details" : "### Summary\nA time/boolean SQL Injection is present in the following resource `/api/applicationResources` via the following parameter `packageID`\n\n### Details\nAs it can be seen [here](https://github.com/openclarity/kubeclarity/blob/main/backend/pkg/database/id_view.go#L79), while building the SQL Query the `fmt.Sprintf` function is used to build the query string without the input having first been subjected to any validation.\n\n### PoC\nThe following command should be able to trigger a basic version of the behavior:\n`curl -i -s -k -X $'GET' \\\n    -H $'Host: kubeclarity.test' \\\n    $'https://kubeclarity.test/api/applicationResources?page=1&pageSize=50&sortKey=vulnerabilities&sortDir=DESC&packageID=c89973a6-4e7f-50b5-afe2-6bf6f4d3da0a\\'HTTP/2'`\n\n### Impact\nWhile using the Helm chart, the impact of this vulnerability is limited since it allows read access only to the kuberclarity database, to which access is already given as far as I understand to regular users anyway.\nOn the other hand, if Kuberclarity is deployed in a less secure way, this might allow access to more data then allowed or expected (beyond the limits of the KuberClarity database). The vulnerable line was introduced as part of the initial commit of Kubeclarity, so all versions up until the latest (2.23.1) are assumed vulnerable.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/openclarity/kubeclarity/backend"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20240711173334-1d1178840703"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/openclarity/kubeclarity/security/advisories/GHSA-5248-h45p-9pgw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39909"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openclarity/kubeclarity/commit/1d1178840703a72d9082b7fc4aea0a3326c5d294"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/openclarity/kubeclarity"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openclarity/kubeclarity/blob/main/backend/pkg/database/id_view.go#L79"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-12T13:56:42Z",
    "nvd_published_at" : "2024-07-12T15:15:11Z"
  }
}