CVE-2024-39907: Github.com/1Panel dev/1Panel SQL Injection Vulnerability

CRITICAL
Advisory Identifier: GHSA-5grx-v727-qmq6
CVSS 9.8
CWE-89
Published
Advisory Summary

CVE-2024-39907 is a CRITICAL (CVSS 9.8) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Github.com/1Panel dev/1Panel libraries in the Go ecosystem. The issue involves 1panel has an sql injection issue related to the orderby clause. Remediation is available by upgrading affected packages to version 1.10.12-tls.

CVE-2024-39907 at a Glance

CVE Identifier CVE-2024-39907
GHSA Identifier GHSA-5grx-v727-qmq6
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Github.com/1Panel dev/1Panel
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

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

How to Fix CVE-2024-39907

To remediate this vulnerability, upgrade all affected Github.com/1Panel dev/1Panel 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/1Panel-dev/1Panel fixed: 1.10.12-tls
Upgrade github.com/1Panel-dev/1Panel to 1.10.12-tls
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/1Panel-dev/1Panel

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-39907, inspect your project dependencies for Github.com/1Panel dev/1Panel:

inspect dependencies for github.com/1Panel-dev/1Panel

Analyze the terminal output to locate any version of Github.com/1Panel dev/1Panel in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.12-tls), 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/1Panel dev/1Panel, 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 There are many sql injections in the project, and some of them are not well filtered, leading to arbitrary file writes, and ultimately leading to RCEs. The proof is as follows ### Details (one of them ) <img width="697" alt="image" src="https://github.com/1Panel-dev/1Panel/assets/129351704/895b7b43-9bc0-44b3-9c84-24c2dcc962da"> <img width="936" alt="image" src="https://github.com/1Panel-dev/1Panel/assets/129351704/1b8eb866-9865-4bef-a359-53335d709157"> <img width="684" alt="image" src="https://github.com/1Panel-dev/1Panel/assets/129351704/e865d6d0-7ecb-49f7-b4a2-f1b0bc407986"> ### PoC curl 'http://api:30455/api/v1/hosts/command/search' {"page":1,"pageSize":10,"groupID":0,"orderBy":"**3**","order":"ascending","name":"a"} <img width="664" alt="image" src="https://github.com/1Panel-dev/1Panel/assets/129351704/250d5a2a-cb32-44dc-9831-86dbc2f2b43f"> for example as picture . just change orderby‘s num we can know How many columns does the data table have.Parameters require strict whitelist filtering ### Impact RCE、data leak.

CVE-2024-39907 Affected Github.com/1Panel dev/1Panel Versions

1 component(s)
Fixed Versions:
1.10.12-tls
Product / Package Ecosystem Affected Versions Fixed Version
github.com/1Panel-dev/1Panel
Go
< 1.10.12-tls
1.10.12-tls

References

Frequently Asked Questions

What is CVE-2024-39907?
CVE-2024-39907 is a security vulnerability in Github.com/1Panel dev/1Panel involving 1Panel has an SQL injection issue related to the orderBy clause under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Github.com/1Panel dev/1Panel versions are affected?
Affected versions include releases prior to 1.10.12-tls across affected packages: github.com/1Panel-dev/1Panel.
What version fixes CVE-2024-39907?
Upgrading to 1.10.12-tls (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/1Panel-dev/1Panel affected?
Yes, github.com/1Panel-dev/1Panel is affected in releases prior to 1.10.12-tls. Upgrade your dependency to 1.10.12-tls or later.
What is the CVSS score of CVE-2024-39907?
CVE-2024-39907 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-39907?
CVE-2024-39907 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-39907?
Run the dependency tree command: 'inspect dependencies for github.com/1Panel-dev/1Panel'. 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-5grx-v727-qmq6",
  "modified" : "2024-07-24T13:49:36Z",
  "published" : "2024-07-18T14:25:00Z",
  "aliases" : [ "CVE-2024-39907" ],
  "summary" : "1Panel has an SQL injection issue related to the orderBy clause",
  "details" : "### Summary\nThere are many sql injections in the project, and some of them are not well filtered, leading to arbitrary file writes, and ultimately leading to RCEs.\nThe proof is as follows\n\n### Details (one of them )\n<img width=\"697\" alt=\"image\" src=\"https://github.com/1Panel-dev/1Panel/assets/129351704/895b7b43-9bc0-44b3-9c84-24c2dcc962da\">\n<img width=\"936\" alt=\"image\" src=\"https://github.com/1Panel-dev/1Panel/assets/129351704/1b8eb866-9865-4bef-a359-53335d709157\">\n<img width=\"684\" alt=\"image\" src=\"https://github.com/1Panel-dev/1Panel/assets/129351704/e865d6d0-7ecb-49f7-b4a2-f1b0bc407986\">\n\n\n### PoC\ncurl 'http://api:30455/api/v1/hosts/command/search' {\"page\":1,\"pageSize\":10,\"groupID\":0,\"orderBy\":\"**3**\",\"order\":\"ascending\",\"name\":\"a\"}\n<img width=\"664\" alt=\"image\" src=\"https://github.com/1Panel-dev/1Panel/assets/129351704/250d5a2a-cb32-44dc-9831-86dbc2f2b43f\">\nfor example as picture . just change orderby‘s num we can know How many columns does the data table have.Parameters require strict whitelist filtering\n\n### Impact\nRCE、data leak.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/1Panel-dev/1Panel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.10.12-tls"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/1Panel-dev/1Panel/security/advisories/GHSA-5grx-v727-qmq6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39907"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/1Panel-dev/1Panel/commit/ff549a47937c1314e6ee08453a1d2128242440cd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/1Panel-dev/1Panel"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-18T14:25:00Z",
    "nvd_published_at" : "2024-07-18T16:15:07Z"
  }
}