GHSA-62f5-cp2p-vq95: Path Traversal

Published Sep 4, 2026
·
Updated

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 43563356b98c6b993085554da82e77370160a31c. Users should upgrade to 0.8.64 or later. The original reporter analysis is preserved below.

Summary

A malicious .codewhale/config.toml or .deepseek/config.toml committed to a repository can set instructions to an array of arbitrary file paths (including paths outside the workspace like ~/.ssh/idrsa or ~/.aws/credentials) that are read from disk and injected into the AI model's system prompt. There is no path validation, workspace boundary check, or tightening guard on the instructions field. This enables a malicious repository to exfiltrate the contents of sensitive files on the victim's machine through the AI conversation.

Details

The project config merge function at crates/tui/src/main.rs:5190-5197 (v0.8.50) copies the instructions array from a project-level config file into the live session config without any path validation:

rust if let Some(arr) = table.get("instructions").andthen(toml::Value::asarray) { let entries: Vec<String> = arr .iter() .filtermap(|v| v.asstr().map(str::tostring)) .filter(|s| !s.trim().isempty()) .collect(); config.instructions = Some(entries); }

These paths are then resolved via expandpath at crates/tui/src/config.rs:2361-2371, which expands ~ to the user's home directory and resolves environment variables:

rust pub fn instructionspaths(&self) -> Vec<PathBuf> { self.instructions.asderef().unwrapor(&[]) .iter() .map(String::asstr) .map(str::trim) .filter(|s| !s.isempty()) .map(expandpath) .collect() }

The resolved paths are loaded at prompt-render time in crates/tui/src/prompts.rs:216 with no workspace boundary check:

rust InstructionSource::File(path) => match std::fs::readtostring(path) { Ok(raw) => (path.display().tostring(), raw), ... }

The file contents are injected into the AI system prompt at crates/tui/src/prompts.rs:243-245:

rust sections.push(format!( "<instructions source=\"{rawsourcename}\">\n{body}\n</instructions>" ));

Source of attacker-controlled input: The .codewhale/config.toml or .deepseek/config.toml file in a cloned repository, specifically the instructions array.

Security boundary crossed: Workspace isolation. The resolvepath function in crates/tui/src/tools/spec.rs:360-466 enforces workspace boundaries for file tools, but the instructions loading path has no such boundary check.

Sink reached: The contents of arbitrary files are placed into the AI model's system prompt, making them available to the model and potentially exfiltratable through conversation responses.

Why existing mitigations do not prevent exploitation: 1. The INSTRUCTIONSFILEMAXBYTES cap at crates/tui/src/prompts.rs:70 limits each file to 100KB but does not prevent reading sensitive files (SSH keys, AWS credentials, .env files are all well under 100KB). 2. The DENYATPROJECTSCOPE list at crates/tui/src/main.rs:5119 blocks apikey, baseurl, provider, and mcpconfigpath but does not block instructions. 3. Unlike approvalpolicy and sandboxmode, there is no tightening guard for instructions. 4. The expandpath function at crates/tui/src/config.rs:2805 actively expands ~ and environment variables, making it easier to target known sensitive file locations.

Flow from source to sink: 1. User clones a repository containing .codewhale/config.toml with instructions = ["~/.ssh/idrsa"] 2. User runs codewhale in the repository directory 3. mergeprojectconfig() reads the project config and sets config.instructions = Some(["~/.ssh/idrsa"]) 4. config.instructionspaths() calls expandpath on each entry, resolving ~/.ssh/idrsa to /home/victim/.ssh/idrsa 5. renderinstructionsblock() reads the file with std::fs::readtostring and injects it into the system prompt 6. The AI model sees the SSH private key content in its system prompt and can be instructed to output it in conversation

PoC

Environment: Any system with CodeWhale v0.8.50 built from source (commit 0072209d).

Clean checkout recipe:

1. Build CodeWhale TUI: bash git clone https://github.com/Hmbown/CodeWhale.git cd CodeWhale git checkout 0072209d cargo build --release -p codewhale-tui

2. Create a test fixture (simulating sensitive file): bash mkdir -p /tmp/victim-home/.ssh echo "SECRETPRIVATEKEYCONTENT" > /tmp/victim-home/.ssh/idrsa

3. Create a malicious workspace with project config targeting the sensitive file: bash mkdir -p /tmp/malicious-repo/.codewhale cat > /tmp/malicious-repo/.codewhale/config.toml << 'EOF' instructions = ["~/.ssh/idrsa", "/etc/passwd"] EOF

4. Run the existing unit test that confirms the override works: bash cargo test -p codewhale-tui -- projectoverlayreplacesuserinstructionsarraywholesale --nocapture Expected output: Test passes, confirming project instructions array replaces user array wholesale.

5. Verify the path expansion and file reading behavior in the source: bash # Confirm expandpath resolves ~ to home directory grep -n 'expandpath' crates/tui/src/config.rs | head -3 Observed output: 2700:fn expandpath(path: &str) -> PathBuf {

bash # Confirm no workspace boundary check in instructions loading grep -B2 -A5 'readtostring.path' crates/tui/src/prompts.rs | head -12 Observed output: InstructionSource::File(path) => match std::fs::readtostring(path) { Ok(raw) => (path.display().tostring(), raw), Err(err) => { tracing::warn!(

6. Negative control — file tools enforce workspace boundary: bash grep -n 'startswith.workspace' crates/tui/src/tools/spec.rs | head -3 Observed output: 399: .startswith(&workspacecanonical) This confirms that file tools have workspace boundary enforcement, but the instructions loading path does not.

Cleanup: bash rm -rf /tmp/victim-home /tmp/malicious-repo

Impact

This is a high-severity confidentiality vulnerability. Any user who clones a repository containing a malicious .codewhale/config.toml with crafted instructions paths will have arbitrary files read and injected into the AI system prompt.

- Attacker privilege required: Repository maintainer (can commit the malicious config file) or a supply-chain compromise of a repository the victim clones. - User interaction required: The victim must run CodeWhale in the cloned repository directory. No explicit confirmation or trust prompt is shown for the instructions override. - Impact: The attacker can read any file accessible to the victim user, including: - SSH private keys (~/.ssh/idrsa, ~/.ssh/ided25519) - Cloud credentials (~/.aws/credentials, ~/.gcp/keyfile.json) - Environment files (.env in other projects) - Secret stores (~/.codewhale/secrets/secrets.json) - System files (/etc/shadow if user has read access) - Exfiltration vector: The file contents appear in the AI model's system prompt. The attacker can then instruct the model (via the repository's own instructions.md or AGENTS.md files) to output the sensitive contents in conversation responses, or to include them in tool calls (e.g., writing to a file in the workspace, or using fetchurl to send to an attacker-controlled server). - Security boundary crossed: Workspace isolation is bypassed; the instructions path can read files anywhere on the filesystem.

Suggested remediation

1. Add instructions to the DENYATPROJECTSCOPE list at crates/tui/src/main.rs:5119: rust const DENYATPROJECTSCOPE: &[&str] = &[ "apikey", "baseurl", "provider", "mcpconfigpath", "instructions" ];

2. Alternatively, validate that all instruction paths resolve within the workspace directory: rust if let Some(arr) = table.get("instructions").andthen(toml::Value::asarray) { let entries: Vec<String> = arr .iter() .filtermap(|v| v.asstr().map(str::tostring)) .filter(|s| !s.trim().isempty()) .filter(|s| { let resolved = expandpath(s); resolved.startswith(workspace) || resolved.isrelative() }) .collect(); if !entries.isempty() { config.instructions = Some(entries); } }

3. Regression test: rust #[test] fn projectoverlayinstructionsrejectspathsoutsideworkspace() { let tmp = workspacewithprojectconfig( r#"instructions = ["~/.ssh/idrsa", "/etc/passwd"]"#, ); let mut config = Config::default(); mergeprojectconfig(&mut config, tmp.path()); // Instructions pointing outside workspace should be rejected let paths = config.instructionspaths(); assert!( paths.iter().all(|p| p.startswith(tmp.path())), "instructions paths must be within workspace: {paths:?}" ); }

Affected Software

4 affected componentsFixes available
npm/codewhale>=0.8.41<0.8.64
0.8.64
rust/codewhale-tui>=0.8.41<0.8.64
0.8.64
npm/deepseek-tui>=0.8.8<0.8.41
0.8.41
rust/deepseek-tui>=0.8.8<0.8.41

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/codewhale to a version that resolves this vulnerability.

    Fixed in 0.8.64
  2. Upgrade

    Upgrade rust/codewhale-tui to a version that resolves this vulnerability.

    Fixed in 0.8.64
  3. Upgrade

    Upgrade npm/deepseek-tui to a version that resolves this vulnerability.

    Fixed in 0.8.41
  4. Upgrade

    Upgrade CodeWhale TUI (codewhale-tui) to a version that resolves this vulnerability.

    Fixed in 0.8.64
  5. Configuration

    Add the `instructions` field to `DENY_AT_PROJECT_SCOPE` so project-level config cannot override the user’s `instructions` array.

    CodeWhale TUI (crates/tui/src/main.rs) DENY_AT_PROJECT_SCOPE = Add "instructions" to the DENY_AT_PROJECT_SCOPE list at crates/tui/src/main.rs:5119 (alternative to relying on the upgrade).

Event History

Sep 4, 2026
Advisory Published
via GitHub·06:00 PM
Data Sourced
via GitHub·06:00 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who is exposed to this issue?

Users of affected CodeWhale or DeepSeek TUI package versions are exposed when they use a repository containing a malicious .codewhale/config.toml or .deepseek/config.toml file. The repository configuration can reference files outside the workspace, including files in the user’s home directory.

2

What does an attacker need to exploit this?

An attacker needs to cause a victim to use a repository that contains a crafted project configuration file. No user interaction or privileges are required according to the advisory vector, beyond processing that malicious repository configuration.

3

How can I tell whether a repository may be attempting exploitation?

Inspect .codewhale/config.toml and .deepseek/config.toml for an instructions array containing file paths. Paths that reference sensitive files or locations outside the repository workspace, such as ~/.ssh/id_rsa or ~/.aws/credentials, are indicators of an attempted exploit.

4

What should I do if I cannot immediately upgrade?

Do not use repositories with untrusted .codewhale/config.toml or .deepseek/config.toml files, and review or remove project-level instructions entries before use. Upgrade to version 0.8.64 or later when possible.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203