T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:165- Finding
Unrestricted File-Reading Tool Can Expose Local Data to an External LLM
- Content
View full analysis
{ const messages: Anthropic.MessageParam[] = [{ role: "user", content: userMessage }]; while (true) { const response = await client.messages.create({ model: "claude-sonnet-4-6", max_tokens: 4096, tools, tool_choice: { type: "auto" }, messages, }); if (response.stop_reason === "end_turn") { return response.content.filter((b) => b.type === "text").map((b) => b.text).join(""); } const toolUses = response.content.filter((b) => b.type === "tool_use"); const toolResults = await Promise.all( toolUses.map(async (tu) => ({ type: "tool_result" as const, tool_use_id: (tu as Anthropic.ToolUseBlock).id, content: await executeTool((tu as Anthropic.ToolUseBlock).name, (tu as Anthropic.ToolUseBlock).input), })) ); messages.push({ role: "assistant", content: response.content }); messages.push({ role: "user", content: toolResults }); } } ``` ### Technical Analysis The example exposes a `read_file` tool whose only input constraint is an arbitrary string path. It does not demonstrate workspace confinement, canonical-path validation, a path allowlist, a sensitive-file denylist, symlink protection, per-call authorization, or user confirmation. The model selects tools automatically, and the resulting file contents are appended to the ...[truncated 1854 chars]- Remediation
View remediation
