CVE-2024-52010: Github.com/tobychui/zoraxy Zoraxy Has An Authenticated Command Vulnerability

HIGH
Advisory Identifier: GHSA-7hpf-g48v-hw3j
CVSS 0.0
CWE-78
Published
Advisory Summary

CVE-2024-52010 is a HIGH (CVSS 0.0) zoraxy has an authenticated command vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/tobychui/zoraxy libraries in the Go ecosystem. The issue involves zoraxy has an authenticated command injection in the web ssh feature. Remediation is available by upgrading affected packages to version 3.1.3.

CVE-2024-52010 at a Glance

CVE Identifier CVE-2024-52010
GHSA Identifier GHSA-7hpf-g48v-hw3j
Severity HIGH
CVSS v3.1 Base Score 0.0
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Github.com/tobychui/zoraxy
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 0.0

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

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

How to Fix CVE-2024-52010

To remediate this vulnerability, upgrade all affected Github.com/tobychui/zoraxy 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/tobychui/zoraxy fixed: 3.1.3
Upgrade github.com/tobychui/zoraxy to 3.1.3
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/tobychui/zoraxy

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-52010, inspect your project dependencies for Github.com/tobychui/zoraxy:

inspect dependencies for github.com/tobychui/zoraxy

Analyze the terminal output to locate any version of Github.com/tobychui/zoraxy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.3), 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Github.com/tobychui/zoraxy, 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 command injection vulnerability in the Web SSH feature allows an authenticated attacker to execute arbitrary commands as root on the host. ### Details Zoraxy has a Web SSH terminal feature that allows authenticated users to connect to SSH servers from their browsers. In [`HandleCreateProxySession`](https://github.com/tobychui/zoraxy/blob/9cb315ea6739d1cc201b690322d25166b12dc5db/src/webssh.go#L19) the request to create an SSH session is handled. After checking for the presence of required parameters, ensuring that the target is not the loopback interface and that there is actually an SSH service running on the target, `CreateNewConnection` is called: https://github.com/tobychui/zoraxy/blob/e79a70b7acfa45c2445aff9d60e4e7525c89fec8/src/mod/sshprox/sshprox.go#L165-L178 In line 178, the `gotty` binary is executed running `sshCommand` from the line above. It contains the user-controlled variable `connAddr`, which includes the hostname of the SSH server and - if provided - the username. An attacker can exploit the `username` variable to escape from the `bash` command and inject arbitrary commands into `sshCommand`. This is possible, because, unlike hostname and port, the username is not validated or sanitized. This vulnerability was introduced in https://github.com/tobychui/zoraxy/commit/c07d5f85dfc37bd32819358ed7d4bc32c604e8f0. If Zoraxy is run without authentication of the management interface (started with`-noauth`), this vulnerability can be exploited without authentication. Additionally, if Zoraxy is run in Docker with the Docker socket mounted (as described in https://github.com/tobychui/zoraxy/blob/9cb315ea6739d1cc201b690322d25166b12dc5db/docker/README.md), this vulnerability can be exploited to escape the Zoraxy container and gain access to the Docker host. ### PoC 1. Download and run Zoraxy as described in the [README](https://github.com/tobychui/zoraxy/blob/9a371f5bcbccce0918c61621f3b26ee549e01b90/README.md#standalone-mode) 2. Setup a user 3. Login as user 4. Navigate to Other -> Network Tools -> Connection 5. Enter hostname / IP of any server with SSH running, e.g. `github.com` 6. Enter `; bash ;` as user 7. Click `Connect using SSH` 8. A window will open with `bash` running on the Zoraxy host Demo: https://github.com/user-attachments/assets/5a3d8771-167f-4a79-8665-ed0dfb490181 ### Impact This vulnerability allows an authenticated attacker to gain remote code execution with the privileges of the Zoraxy process (root by default). This affects Zoraxy versions 2.6.1 through 3.1.2.

CVE-2024-52010 Affected Github.com/tobychui/zoraxy Versions

1 component(s)
Fixed Versions:
3.1.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/tobychui/zoraxy
Go
≥ 2.6.1
< 3.1.3
3.1.3

References

Frequently Asked Questions

What is CVE-2024-52010?
CVE-2024-52010 is a security vulnerability in Github.com/tobychui/zoraxy involving Zoraxy has an authenticated command injection in the Web SSH feature under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Github.com/tobychui/zoraxy versions are affected?
Affected versions include releases prior to 3.1.3 across affected packages: github.com/tobychui/zoraxy.
What version fixes CVE-2024-52010?
Upgrading to 3.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/tobychui/zoraxy affected?
Yes, github.com/tobychui/zoraxy is affected in releases prior to 3.1.3. Upgrade your dependency to 3.1.3 or later.
What is the CVSS score of CVE-2024-52010?
CVE-2024-52010 has a CVSS v3.1 base score of 0.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:N.
What CWE is associated with CVE-2024-52010?
CVE-2024-52010 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2024-52010?
Run the dependency tree command: 'inspect dependencies for github.com/tobychui/zoraxy'. 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-7hpf-g48v-hw3j",
  "modified" : "2024-11-19T19:38:19Z",
  "published" : "2024-11-12T21:28:25Z",
  "aliases" : [ "CVE-2024-52010" ],
  "summary" : "Zoraxy has an authenticated command injection in the Web SSH feature",
  "details" : "### Summary\nA command injection vulnerability in the Web SSH feature allows an authenticated attacker to execute arbitrary commands as root on the host.\n\n### Details\nZoraxy has a Web SSH terminal feature that allows authenticated users to connect to SSH servers from their browsers.\nIn [`HandleCreateProxySession`](https://github.com/tobychui/zoraxy/blob/9cb315ea6739d1cc201b690322d25166b12dc5db/src/webssh.go#L19) the request to create an SSH session is handled. After checking for the presence of required parameters, ensuring that the target is not the loopback interface and that there is actually an SSH service running on the target, `CreateNewConnection` is called:\n\nhttps://github.com/tobychui/zoraxy/blob/e79a70b7acfa45c2445aff9d60e4e7525c89fec8/src/mod/sshprox/sshprox.go#L165-L178\n\nIn line 178, the `gotty` binary is executed running `sshCommand` from the line above. It contains the user-controlled variable `connAddr`, which includes the hostname of the SSH server and - if provided - the username.\nAn attacker can exploit the `username` variable to escape from the `bash` command and inject arbitrary commands into `sshCommand`. This is possible, because, unlike hostname and port, the username is not validated or sanitized.\n\nThis vulnerability was introduced in https://github.com/tobychui/zoraxy/commit/c07d5f85dfc37bd32819358ed7d4bc32c604e8f0.\nIf Zoraxy is run without authentication of the management interface (started with`-noauth`), this vulnerability can be exploited without authentication.\nAdditionally, if Zoraxy is run in Docker with the Docker socket mounted (as described in https://github.com/tobychui/zoraxy/blob/9cb315ea6739d1cc201b690322d25166b12dc5db/docker/README.md), this vulnerability can be exploited to escape the Zoraxy container and gain access to the Docker host.\n\n### PoC\n1. Download and run Zoraxy as described in the [README](https://github.com/tobychui/zoraxy/blob/9a371f5bcbccce0918c61621f3b26ee549e01b90/README.md#standalone-mode)\n2. Setup a user\n3. Login as user\n4. Navigate to Other -> Network Tools -> Connection\n5. Enter hostname / IP of any server with SSH running, e.g. `github.com`\n6. Enter `; bash ;` as user\n7. Click `Connect using SSH`\n8. A window will open with `bash` running on the Zoraxy host\n\nDemo:\n\nhttps://github.com/user-attachments/assets/5a3d8771-167f-4a79-8665-ed0dfb490181\n\n### Impact\nThis vulnerability allows an authenticated attacker to gain remote code execution with the privileges of the Zoraxy process (root by default). This affects Zoraxy versions 2.6.1 through 3.1.2.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tobychui/zoraxy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.6.1"
      }, {
        "fixed" : "3.1.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tobychui/zoraxy/security/advisories/GHSA-7hpf-g48v-hw3j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-52010"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tobychui/zoraxy/commit/2e9bc77a5d832bff1093058d42ce7a61382e4bc6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tobychui/zoraxy/commit/c07d5f85dfc37bd32819358ed7d4bc32c604e8f0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tobychui/zoraxy"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-3267"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-12T21:28:25Z",
    "nvd_published_at" : "2024-11-12T17:15:10Z"
  }
}