Skip to content

GHSA-c6mw-8xh8-gpq6 CVE-2026-75912

CodeWhale: Argument Injection in `git_blame` Tool Allows Arbitrary File Read Without Approval

High crates.ionpm
Severity
0.0 / 10
High · CVSS 4.0
Exploit chance (EPSS)
0.45%
Chance of exploitation in the next 30 days. Higher than 38.83% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-200 Exposure of Sensitive Information to an Unauthorized Actor
CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
Fix
Available
3 packages have a fixed version

Description

Maintainer resolution

The CodeWhale maintainers validated this report. The affected package ranges are recorded in the advisory metadata. Version 0.8.64 contains the fix in commit 9a34b5034d29f05d1f28fa61b04719ca6a741020. Users should upgrade to 0.8.64 or later. The original reporter analysis is preserved below.

Argument Injection in git_blame Tool Allows Arbitrary File Read Without Approval

Overview

The git_blame tool in DeepSeek-TUI passes the model-supplied rev parameter unvalidated into the argv of git blame. git blame accepts --contents=<file>, which causes it to use the file's contents in place of the working tree and echo each line verbatim in the blame output. A rev value of --contents=/path/to/secret therefore exfiltrates the targeted file's contents into the tool result, which is returned to the model and displayed in the chat transcript.

The tool is registered with ApprovalRequirement::Auto and declares ToolCapability::ReadOnly. The read is in-scope for the capability label, but the target of the read is not the user expects git_blame to read files inside the workspace, not arbitrary paths on the host.

This is a sibling of the git_show argument-injection vulnerability filed separately, sharing the same root cause (missing --end-of-options sentinel and unvalidated rev).

Impact

Arbitrary file read at the privilege of the user running DeepSeek-TUI, via malicious repository content combined with prompt injection (the threat model already documented in CVE-2026-45311).

Reachable as the invoking user:

  • ~/.ssh/id_rsa, ~/.ssh/id_ed25519, and other private keys
  • ~/.aws/credentials, ~/.config/gh/hosts.yml, ~/.netrc
  • .env files anywhere in the filesystem
  • Any project file outside the workspace the tool would normally restrict to

The leaked contents land in the model's context. The same model that obeyed the prompt-injection in step one can be instructed to forward the leak via fetch_url (network-policy permitting), summarize it in chat, or write it into a tool output the attacker can later retrieve.

Technical Details

Root Cause

crates/tui/src/tools/git_history.rs:

// L314-316
fn approval_requirement(&self) -> ApprovalRequirement {
    ApprovalRequirement::Auto
}

// L322-358 (excerpt)
async fn execute(&self, input: Value, context: &ToolContext) -> Result<ToolResult, ToolError> {
    let path_str = required_str(&input, "path")?;
    let resolved_path = context.resolve_path(path_str)?;   // path is bounded to workspace
    ...
    let rev = optional_str(&input, "rev").unwrap_or("HEAD");   // rev is NOT bounded
    ...
    let mut args = vec![
        "blame".to_string(),
        "--date=iso".to_string(),
        format!("-L{start_line},{end_line}"),
    ];
    if porcelain { args.push("--line-porcelain".to_string()); }
    args.push(rev.to_string());            // unvalidated, no sentinel
    args.push("--".to_string());
    args.push(pathspec.display().to_string());
    ...
}

path correctly flows through context.resolve_path, which enforces workspace containment (spec.rs:342). rev does not and the -- separator after rev only ends pathspec parsing, it does not stop option parsing of rev itself.

The JSON schema for rev (L283-285) is {"type": "string"} with no constraints.

Why --contents Works

git blame --contents=<file> -- <pathspec> blames the working tree path as if its contents were the supplied file. Each line of the supplied file appears verbatim in the porcelain or human-readable output, prefixed with the attribution marker 00000000 (External file (--contents) <date> N). The full line content is preserved.

Two secondary primitives in the same parser also leak data, with smaller yield:

  • --ignore-revs-file=<file> : surfaces parse errors that disclose partial content when the file is not a valid revs list.
  • -S <file>, --reverse <rev1>..<rev2> : not directly exploitable for read but expand the option surface that argv injection can reach.

Proof of Concept

Argv assembled by the tool with input {"path": "a.txt", "rev": "--contents=/home/a/.ssh/id_rsa"}:

git blame --date=iso -L1,200 --contents=/home/a/.ssh/id_rsa -- a.txt

Reproduced against system git as a non-root user:

$ id
uid=1001(a) gid=1001(a) groups=1001(a)

$ echo "PRIVATEKEYDATA" > /home/a/.ssh/id_rsa
$ chmod 600 /home/a/.ssh/id_rsa

$ git blame --date=iso -L1,5 "--contents=/home/a/.ssh/id_rsa" -- a.txt
00000000 (External file (--contents) 2026-05-19 07:05:51 -0400 1) PRIVATEKEYDATA

A non-readable target (/etc/shadow, owned by root with mode 0640) returns Permission denied, confirming the read is bounded by uid as expected; this is not a privilege boundary bypass, it is the desktop user's own filesystem view being exposed past the workspace boundary the tool's path argument otherwise enforces.

End-to-end exploitation is identical to the git_show companion: malicious repo → AGENTS.md injection → model calls git_blame with the crafted rev → auto-approval → leaked content returned in tool output and consumed by the model.

Remediation

Same shape as the git_show fix:

args.push("--end-of-options".to_string());
args.push(rev.to_string());
args.push("--".to_string());
args.push(pathspec.display().to_string());

Plus a leading-hyphen rejection on rev. A regression test should pin both rev = "--contents=/etc/passwd" and rev = "--ignore-revs-file=/etc/passwd" as rejected inputs.

Affected versions

crates.io

PackageVulnerableFixed in
codewhale-tui
>= 0.8.41, < 0.8.64
0.8.64
deepseek-tui
>= 0.3.27, <= 0.8.41
No fix yet

npm

PackageVulnerableFixed in
codewhale
>= 0.8.41, < 0.8.64
0.8.64
deepseek-tui
>= 0.3.27, < 0.8.41
0.8.41

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

codewhale-tui crates.io → 0.8.64

cargo
cargo update -p codewhale-tui --precise 0.8.64

codewhale npm → 0.8.64

npm
npm install codewhale@0.8.64
yarn
yarn add codewhale@0.8.64
pnpm
pnpm add codewhale@0.8.64

deepseek-tui npm → 0.8.41

npm
npm install deepseek-tui@0.8.41
yarn
yarn add deepseek-tui@0.8.41
pnpm
pnpm add deepseek-tui@0.8.41

Severity breakdown

CVSS 4.0 0.0

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N

Attack vector
Network
Attack complexity
Low
Attack requirements
None
Privileges required
None
User interaction
Passive
Confidentiality (vulnerable system)
High
Integrity (vulnerable system)
None
Availability (vulnerable system)
None
Confidentiality (subsequent systems)
High
Integrity (subsequent systems)
None
Availability (subsequent systems)
None

CVSS 3.1 7.4

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

Weakness

CWE-200: Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.

How to prevent it
  • Architecture and Design: Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.

CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

The product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.

How to prevent it
  • Implementation: Where possible, avoid building a single string that contains the command and its arguments. Some languages or frameworks have functions that support specifying independent arguments, e.g. as an array, which is used to automatically perform the appropriate quoting or escaping while building the command. For example, in PHP, escapeshellarg() can be used to escape a single argument to system(), or exec() can be called with an array of arguments. In C, code can often be refactored from using system() - which accepts a single string - to using exec(), which requires separate function arguments for each parameter.
  • Architecture and Design: Understand all the potential areas where untrusted inputs can enter your product: parameters or arguments, cookies, anything read from the network, environment variables, request headers as well as content, URL components, e-mail, files, databases, and any external systems that provide data to the application. Perform input validation at well-defined interfaces.
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
  • Implementation: Directly convert your input type into the expected data type, such as using a conversion function that translates a string into a number. After converting to the expected data type, ensure that the input's values fall within the expected range of allowable values and that multi-field consistencies are maintained.
  • Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180, CWE-181). Make sure that your application does not inadvertently decode the same input twice (CWE-174). Such errors could be used to bypass allowlist schemes by introducing dangerous inputs after they have been checked. Use libraries such as the OWASP ESAPI Canonicalization control. Consider performing repeated canonicalization until your input does not change any more. This will avoid double-decoding and similar scenarios, but it might inadvertently modify inputs that are allowed to contain properly-encoded dangerous content.
  • Implementation: When exchanging data between components, ensure that both components are using the same character encoding. Ensure that the proper encoding is applied at each interface. Explicitly set the encoding you are using whenever the protocol allows you to do so.
  • Implementation: When your application combines data from multiple sources, perform the validation after the sources have been combined. The individual data elements may pass the validation step but violate the intended restrictions after they have been combined.
  • Testing: Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-h539-c7r8-3xq4
CodeWhale: js_execution leaks parent environment to model context via missing env scrub
High Also affects codewhale
GHSA-w7wx-5q49-r59w
CodeWhale: image_analyze follows workspace symlinks, leaking external file bytes
High Also affects codewhale
GHSA-7j5w-7r7x-9v27
CodeWhale: Argument Injection in `git_show` Tool Allows Arbitrary File Write Without Approval
Critical Also affects codewhale
GHSA-gx45-xrj5-g6c4
CodeWhale: Project config `allow_shell` override enables arbitrary shell command execution via cloned repository
High Also affects codewhale
GHSA-62f5-cp2p-vq95
CodeWhale: Project config `instructions` override enables arbitrary file read into AI system prompt via cloned repository
High Also affects codewhale
GHSA-wrj3-vj8c-784f
CodeWhale: rlm_eval auto-approves arbitrary Python execution, bypassing the user's approval policy (RCE)
High Also affects codewhale
GHSA-g29h-pfmp-qp9r
CodeWhale: exec_shell_interact sends LLM-controlled input to a running shell without an approval prompt (privilege escalation)
High Also affects codewhale
GHSA-6v2g-fpxh-pmmh
CodeWhale: SSRF‌ bypass - TOCTOU on DNS failure for DNS pinning
High Also affects codewhale
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor