Executive brief
DeepSeek-TUI's git_show tool fails to validate user input when constructing git commands, allowing an attacker to inject command-line arguments like `--output=` to write arbitrary files to a victim's home directory without user approval. When a malicious repository instructs the AI model to call this tool with crafted input, sensitive files like SSH keys, shell configuration, or AWS credentials can be overwritten, enabling account compromise or code tampering.
Technical details
The vulnerability is an argument injection (CWE-73, CWE-88) in `crates/tui/src/tools/git_history.rs` where the `rev` parameter is passed directly into the git argv without validation or an end-of-options sentinel. Since `git show` supports `--output=<path>` to redirect output to a file, an attacker can craft `rev` as `--output=/home/victim/.bashrc` to write arbitrary files with `O_WRONLY | O_CREAT | O_TRUNC` permissions. The tool is marked `ApprovalRequirement::Auto` and falsely advertises `ToolCapability::ReadOnly`, so the write occurs silently without user confirmation. Exploitation requires a malicious repository whose auto-loaded `AGENTS.md` instructs the AI model to invoke `git_show` with a crafted `--output=` value, leveraging the prompt-injection threat documented in CVE-2026-45311. The written content includes commit hash, author, date, and diff text—all attacker-controlled—enabling file corruption, SSH key replacement, or shell initialization hijacking.
Affected products
- Hmbown DeepSeek-TUI >= 0.3.27, <= 0.8.41
- Hmbown CodeWhale >= 0.8.41, < 0.8.64
Timeline
- 2026-09-04: disclosed: Published to GitHub Advisory Database
- 2026-09-04: patched: Fixed in CodeWhale 0.8.64 (commit 9a34b5034d29f05d1f28fa61b04719ca6a741020)