Sep 4, 2026·5 min read·42 visits
CodeWhale versions prior to 0.8.64 are vulnerable to a path traversal attack. By introducing a symbolic link inside the agent workspace that points to a sensitive host file but naming it with an image extension, attackers can force the image_analyze tool to read the target file, encode its contents, and leak them directly to a vision LLM endpoint without user consent.
An improper link resolution vulnerability (CWE-59) in the image_analyze tool of CodeWhale allows remote attackers to traverse directories (CWE-22) and leak sensitive local files via symlink manipulation.
CodeWhale is an open-source, terminal-based autonomous coding assistant implemented in Rust. To assist developers with visual assets, CodeWhale integrates a vision subsystem featuring the image_analyze tool. This tool exposes an attack surface by accepting directory path parameters from the agent's current workspace, reading the specified target files, and transmitting them to a configured vision model endpoint for text extraction or description.
To prevent the autonomous agent from accessing host resources outside its intended scope, the application establishes a logical workspace boundary. All tool execution is intended to be confined within this root workspace directory. However, in versions prior to 0.8.64, the path validation implementation relied exclusively on abstract string parsing rather than physical filesystem-backed validation, which completely bypassed this confinement boundary.
This vulnerability is highly relevant in autonomous agent workflows where the agent operates on untrusted codebases or repositories cloned from the internet. An attacker can structure a malicious repository to include nested symbolic links. When CodeWhale executes tools over this directory, the security boundaries fail, allowing the agent to read arbitrary host files, including configuration files, credentials, and local system parameters.
The underlying vulnerability is an instance of CWE-59 (Improper Link Resolution) leading to CWE-22 (Path Traversal). The core defect resides in the path validation logic of the image_analyze tool located in crates/tui/src/vision/tools.rs. Before opening a file, the application validates the candidate path parameter (image_path) using the standard library's logical path parsing API.
Specifically, the validator scans the path's components to check if any of them match Component::Prefix, Component::RootDir, or Component::ParentDir (such as ..). If these components are absent, the application assumes the path is a safe relative path and joins it to the workspace root directory. This model is fundamentally flawed because it operates entirely on the lexical structure of the path string and does not inspect the underlying physical filesystem objects.
Under standard operating systems, a symbolic link (symlink) is a filesystem object that references another file or directory path. A symlink's directory entry contains only a standard, benign name (for example, leak.png). Because the name contains no relative traversal tokens, it passes the lexical verification check. When the application subsequently invokes filesystem operations such as std::fs::read on the resolved workspace path, the operating system kernel transparently follows the symlink to its physical destination outside the workspace, resulting in an unauthorized out-of-bounds file read.
In the vulnerable implementation, the application checks path safety lexically and immediately appends the input to the workspace path without resolving the physical destination. This can be seen in the following code block:
// Vulnerable Implementation (Before 0.8.64)
let image_path_buf = Path::new(image_path);
if image_path_buf.components().any(|c| {
matches!(
c,
Component::Prefix(_) | Component::RootDir | Component::ParentDir
)
}) {
return Err(ToolError::execution_failed(
"image_path must be a relative path within the workspace and cannot escape it.",
));
}
let resolved_path = context.workspace.join(image_path_buf);
let (image_data, mime_type) = Self::read_image_file(&resolved_path).await?;The patch introduced in version 0.8.64 resolves this defect by establishing a safe path resolver function, resolve_image_path. This function canonicalizes both the workspace root and the candidate path before performing a safety check. Canonicalization resolves all symbolic links, relative segments, and redundant separators, converting the path into its unique absolute physical representation on the filesystem.
// Patched Implementation in 0.8.64
fn resolve_image_path(workspace: &Path, image_path: &str) -> Result<PathBuf, ToolError> {
let image_path_buf = Path::new(image_path);
if image_path_buf.components().any(|c| {
matches!(
c,
Component::Prefix(_) | Component::RootDir | Component::ParentDir
)
}) {
return Err(ToolError::execution_failed(
"image_path must be a relative path within the workspace and cannot escape it.",
));
}
// Establish a verified canonicalized baseline for the workspace root
let workspace = workspace.canonicalize().map_err(|e| {
ToolError::execution_failed(format!("Failed to resolve workspace path: {e}"))
})?;
// Construct the absolute candidate path and canonicalize it to resolve symlinks
let candidate = workspace.join(image_path_buf);
let resolved = candidate.canonicalize().map_err(|e| {
ToolError::execution_failed(format!("Failed to resolve image file: {e}"))
})?;
// Verify the physical target path resides strictly inside the canonical workspace prefix
if !resolved.starts_with(&workspace) {
return Err(ToolError::execution_failed(
"image_path must resolve within the workspace and cannot escape it.",
));
}
Ok(resolved)
}By comparing the canonicalized representation of the target path with the canonicalized workspace root using resolved.starts_with(&workspace), the application ensures that any attempt to follow a symlink that points to an external resource is detected and blocked before any read operations occur.
To exploit this vulnerability, an attacker must have the ability to supply or modify files within the directory where the CodeWhale agent is executing. This is typically achieved when the user clones an untrusted public repository or opens a project workspace containing malicious structures configured by an external threat actor.
The attacker first creates a symbolic link inside the project directory, giving it a filename that resembles a standard image file but targeting a sensitive resource on the host operating system. The following shell commands demonstrate this step on a Unix-like system:
# Establish a symbolic link pointing to the host's primary user account database
ln -s /etc/passwd ./leak.pngOnce the symlink is placed, the attacker triggers the agent to run the image_analyze tool on the crafted path. The tool validates `
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
CodeWhale Hmbown | >= 0.8.32, < 0.8.64 | 0.8.64 |
| Attribute | Detail |
|---|---|
| Primary CWE ID | CWE-22 |
| Secondary CWE ID | CWE-59 |
| Attack Vector | Network |
| CVSS v4.0 Base Score | 8.7 (High) |
| Exploit Status | poc |
| CISA KEV Status | Not Listed |
The application fails to properly limit a pathname to a restricted directory by following symbolic links to external paths without canonicalization verification.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.
The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.