| शीर्षक | nanocoai NanoClaw 2.0.64 Improper Limitation of a Pathname to a Restricted Directory (CWE-22) |
|---|
| विवरण | # Technical Details
An Arbitrary Local File Exfiltration via `send_file` absolute path exists in the `send_file` tool handler in `container/agent-runner/src/mcp-tools/core.ts` of NanoClaw.
The application fails to restrict file reads to trusted roots. The `send_file` MCP tool explicitly accepts absolute filesystem paths and copies the referenced file into the outbound outbox without any allowlist, `realpath` canonicalization, or containment check. When an absolute path is provided, the code resolves it unchanged and only checks existence before copying: `const resolvedPath = path.isAbsolute(filePath) ? filePath : path.resolve('/workspace/agent', filePath)`. This allows a prompt-injected agent to exfiltrate arbitrary container-visible files, including files mounted under `/workspace/extra/*`.
# Vulnerable Code
File: container/agent-runner/src/mcp-tools/core.ts
Method: send_file tool handler (lines ~136-176) — resolves absolute paths without root restriction, copies to outbox
Why: No allowlist of permitted local roots, no containment enforcement. The agent runner also auto-discovers directories under /workspace/extra/* and exposes them to the runtime, making sensitive mounts realistically reachable.
# Reproduction
1. Create `/workspace/agent/docs/allowed.txt` and `/workspace/extra/secret-mount/canary.txt`.
2. Start the built-in MCP stdio server and invoke `send_file` with `docs/allowed.txt` (relative, allowed) and `/workspace/extra/secret-mount/canary.txt` (absolute, should be blocked).
3. Observe both files are staged into `/workspace/outbox/<message_id>/` for outbound delivery.
# Impact
- Arbitrary local file read leading to data exfiltration through NanoClaw's outbound attachment pipeline.
- A prompt-injected or compromised agent can export local documents, internal artifacts, or other readable files to external messaging destinations.
- Sensitive mounted directories under `/workspace/extra/*` are directly reachable. |
|---|
| स्रोत | ⚠️ https://github.com/nanocoai/nanoclaw/issues/2760 |
|---|
| उपयोगकर्ता | JohnChen (UID 99088) |
|---|
| सबमिशन | 18/06/2026 08:51 AM (2 महीनों पहले) |
|---|
| संयम | 05/08/2026 08:48 PM (2 months later) |
|---|
| स्थिति | स्वीकृत |
|---|
| VulDB प्रविष्टि | 386367 [nanocoai NanoClaw तक 2.0.64 send_file core.ts निर्देशिका ट्रैवर्सल] |
|---|
| अंक | 20 |
|---|