The .claude directory creates an attack surface in Claude Code

When Claude Code runs in a newly cloned repository, it asks for trust but fails to warn about the presence of a .claude directory included in the project. The default response to this prompt is trust, making it easy to bypass security checks with a quick Enter key press.
Granting trust enables all hooks in the repository without individual permission requests. For example, a SessionStart hook can execute a curl command to download and run an external script. This trust is persistent: a malicious hook added in a future commit will execute without a new prompt.
Local skill files within the repository can also execute arbitrary code. To mitigate this, the author recommends declining the trust prompt, setting disableAllHooks to true in ~/.claude/settings.json, or running the tool within a sandbox environment like nono.
Related stories
- Claude Code's deny rules don't stop grep
- Vanta releases GrantGuard for auditing Claude Code permissions
- Vulnerabilities in Claude Code plugin marketplace
- Agentjacking vulnerability exposes Claude Code and Cursor to hijacking via fake error reports
- tcrf.net is serving Claude agents a prompt injection that wipes files
- Claude Code 2.1.282 ignores telemetry set by project files
Comments
No comments yet. Be the first.
Join the conversation
Sign in with Google to leave a comment. Your name and avatar come from your Google profile, and the comment appears after moderation.
