GHSA-hfxh-rjv7-2369: Uptime kuma Remote Code Execution Vulnerability

MODERATE
Published
Advisory Summary

GHSA-hfxh-rjv7-2369 is a MODERATE remote code execution vulnerability (General Security Weakness) affecting Uptime kuma libraries in the npm ecosystem. The issue involves uptime kuma authenticated remote code execution via tailscaleping. Remediation is available by upgrading affected packages to version 1.23.7.

GHSA-hfxh-rjv7-2369 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-hfxh-rjv7-2369
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Uptime kuma
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-hfxh-rjv7-2369

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

uptime-kuma fixed: 1.23.7
npm install uptime-kuma@1.23.7
Verify Direct and Transitive Dependencies

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

npm ls uptime-kuma

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-hfxh-rjv7-2369, inspect your project dependencies using npm:

npm ls uptime-kuma

Analyze the terminal output to locate any version of Uptime kuma in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.23.7), your application is affected.

Note: The npm ls uptime-kuma command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Uptime kuma, 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 The `runTailscalePing` method of the `TailscalePing` class injects the `hostname` parameter inside a shell command, leading to a command injection and the possibility to run arbitrary commands on the server. ### Details When adding a new monitor on Uptime Kuma, we can select the "Tailscale Ping" type. Then we can add a hostname and insert a command injection payload into it. The front-end application requires that the field follow a specific pattern, this validation only happens on the front-end and can be removed by removing the attribute `pattern` on the `input` element. https://github.com/louislam/uptime-kuma/blob/dc4242019331e65a79ac16deef97510144e01b12/server/monitor-types/tailscale-ping.js#L40-L46 We can finally add the new monitor and observe that our command is being executed. **NOTE:** When using Uptime Kuma inside a container, the "TailScale Ping" type is not visible. We can fake this information by intercepting WebSocket messages and set the `isContainer` option to `false`. ### PoC * Authenticate. * Create a new monitor. * Select the TailScale Ping type (if not visible, see the note in the details section). * Insert the command injection payload inside the `hostname` field. (for example `$(id >&2)`) * Remove the `pattern` requirement on the field. * Save and start the monitor. ### Impact An authenticated user can execute arbitrary command on the server running Uptime Kuma. ### Remediation There are other command execution in the codebase, they use a method `spawn` from the `child_process` module which does not interpret the command as a shell command, the same thing should be done here. **NOTE:** The Tailscale CLI seems to support the `--` sequence. It should be used between the `ping` subcommand and the `hostname` argument to avoid argument injection.

GHSA-hfxh-rjv7-2369 Affected Uptime kuma Versions

1 component(s)
Fixed Versions:
1.23.7
Product / Package Ecosystem Affected Versions Fixed Version
uptime-kuma
npm
≥ 1.23.0
< 1.23.7
1.23.7

References

Frequently Asked Questions

What is GHSA-hfxh-rjv7-2369?
GHSA-hfxh-rjv7-2369 is a security vulnerability in Uptime kuma involving Uptime Kuma Authenticated remote code execution via TailscalePing under General Security Weakness.
Which Uptime kuma versions are affected?
Affected versions include releases prior to 1.23.7 across affected packages: uptime-kuma.
What version fixes GHSA-hfxh-rjv7-2369?
Upgrading to 1.23.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is uptime-kuma affected?
Yes, uptime-kuma is affected in releases prior to 1.23.7. Upgrade your dependency to 1.23.7 or later.
What CWE is associated with GHSA-hfxh-rjv7-2369?
GHSA-hfxh-rjv7-2369 is classified under General Security Weakness.
How can I check npm dependencies for GHSA-hfxh-rjv7-2369?
Run the dependency tree command: 'npm ls uptime-kuma'. 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-hfxh-rjv7-2369",
  "modified" : "2023-11-27T17:25:11Z",
  "published" : "2023-11-27T17:25:11Z",
  "aliases" : [ ],
  "summary" : "Uptime Kuma Authenticated remote code execution via TailscalePing",
  "details" : "### Summary\n\nThe `runTailscalePing` method of the `TailscalePing` class injects the `hostname` parameter inside a shell command, leading to a command injection and the possibility to run arbitrary commands on the server.\n\n### Details\n\nWhen adding a new monitor on Uptime Kuma, we can select the \"Tailscale Ping\" type. Then we can add a hostname and insert a command injection payload into it. The front-end application requires that the field follow a specific pattern, this validation only happens on the front-end and can be removed by removing the attribute `pattern` on the `input` element.\n\nhttps://github.com/louislam/uptime-kuma/blob/dc4242019331e65a79ac16deef97510144e01b12/server/monitor-types/tailscale-ping.js#L40-L46\n\nWe can finally add the new monitor and observe that our command is being executed.\n\n**NOTE:** When using Uptime Kuma inside a container, the \"TailScale Ping\" type is not visible. We can fake this information by intercepting WebSocket messages and set the `isContainer` option to `false`.\n\n### PoC\n\n* Authenticate.\n* Create a new monitor.\n* Select the TailScale Ping type (if not visible, see the note in the details section).\n* Insert the command injection payload inside the `hostname` field. (for example `$(id >&2)`)\n* Remove the `pattern` requirement on the field.\n* Save and start the monitor.\n\n### Impact\n\nAn authenticated user can execute arbitrary command on the server running Uptime Kuma.\n\n### Remediation\n\nThere are other command execution in the codebase, they use a method `spawn` from the `child_process` module which does not interpret the command as a shell command, the same thing should be done here.\n\n**NOTE:** The Tailscale CLI seems to support the `--` sequence. It should be used between the `ping` subcommand and the `hostname` argument to avoid argument injection.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "uptime-kuma"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.23.0"
      }, {
        "fixed" : "1.23.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.23.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/louislam/uptime-kuma/security/advisories/GHSA-hfxh-rjv7-2369"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/louislam/uptime-kuma"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-27T17:25:11Z",
    "nvd_published_at" : null
  }
}