Claude Code Hooks: Repo-Committed Configs as RCE Vector
Topics Agentic AI · Data Infrastructure · AI Regulation
Claude Code's Hook system fires arbitrary shell scripts on developer workstations triggered by repo-committed .claude/ config files — functionally identical to poisoned Makefiles but invisible to current code review practices. If your teams adopted Claude Code after last week's KAIROS audit, the legitimate features are now the attack surface you need to scope next.
◆ INTELLIGENCE MAP
01 Claude Code Repo-Borne Attack Vector via .claude/ Config Files
act nowClaude Code Hooks fire shell scripts on PreToolUse/PostToolUse events. .claude/ directories committed to repos auto-execute on project open — a new supply chain initial access path analogous to malicious .vscode/ or pre-commit hooks, but not yet in any review checklist.
- Integration features
- High-risk features
- Attack vector type
- 01Hooks (shell exec)High
- 02MCP (DB/API access)High
- 03.claude/ repo configHigh
- 04Subagent spawningMedium
- 05Plugin integrationsMedium
02 Level 5 Self-Building AI Agents Create Recursive Trust Chains
monitorA 5-level agent taxonomy is formalizing where Level 4 agents run autonomously on cron with persistent creds and Level 5 agents create other autonomous agents. Sim Studio's Mothership (27k+ GitHub stars, self-hostable) ships Level 5 capabilities as open-source today.
- Agent levels defined
- Mothership GitHub stars
- Critical risk level
- Level 5 Agent Risk90
03 Google Memory Caching & RNN-Transformer Convergence
backgroundGoogle's Gated Residual Memory research for RNNs (1.3B parameter scale, academic) has zero operational security relevance today. Pure ML architecture work — no production deployment, no new attack surface. Safe to ignore.
- Parameter scale
- Security relevance
◆ DEEP DIVES
01 Beyond KAIROS: Claude Code's Designed Features Are Your Next Attack Surface
<h3>Context: From Hidden Agent to Visible Threat Surface</h3><p>Monday's briefing covered the KAIROS hidden agent discovered in Claude Code's leaked source. That was about an <strong>undisclosed capability</strong>. Today's intelligence is about the <strong>documented, intentional features</strong> that create equally dangerous attack surfaces — and they're already in your repos.</p><p>Claude Code has evolved from a coding assistant into a <strong>full execution platform</strong> with 12 deep integration features. Three of them warrant immediate security attention.</p><hr><h3>Three High-Risk Feature Classes</h3><h4>1. Hooks: Shell Execution via Event Triggers</h4><p>Claude Code fires arbitrary shell scripts on <strong>PreToolUse</strong> and <strong>PostToolUse</strong> events. These Hooks execute with the developer's full permissions on their workstation or CI/CD runner. A malicious contributor who adds a Hook to a repo's <strong>.claude/</strong> directory gets code execution on every developer who opens the project with Claude Code — no interaction required beyond opening the repo.</p><blockquote>A poisoned .claude/ directory is the new poisoned Makefile — except your security team isn't reviewing it yet, and your SAST tools don't flag it.</blockquote><h4>2. MCP: Direct Database and API Connectivity</h4><p>Model Context Protocol integrations connect Claude Code sessions to <strong>production databases, internal APIs, and external services</strong>. Data flows through the LLM context window and potentially to Anthropic's API. This is a <strong>data exfiltration path</strong> that bypasses DLP controls entirely — your DLP is watching network egress and endpoint file transfers, not LLM context windows.</p><h4>3. Subagent Spawning: Unmonitored Parallel Execution</h4><p>Claude Code spawns parallel sub-agent instances for multi-step workflows. Each inherits the parent's permissions. Your EDR sees one Claude Code process; underneath, <strong>multiple autonomous agents</strong> are executing with inherited credentials and no individual monitoring.</p><hr><h3>The Repo Poisoning Vector in Detail</h3><p>The critical new attack vector: <strong>.claude/ directories and CLAUDE.md files committed to source repositories</strong>. These config files load automatically at session start and can contain:</p><ul><li><strong>Hooks</strong> — shell scripts executed on specific Claude Code events</li><li><strong>Skills</strong> — persistent commands that modify agent behavior</li><li><strong>MCP configurations</strong> — pre-configured database and API connections</li><li><strong>Rules</strong> — behavioral modifications that alter how Claude processes code</li></ul><p>This is functionally identical to the <strong>.vscode/settings.json</strong> attack vector — but less understood by security teams and <em>not yet included in standard code review checklists</em>. Your PR reviewers know to scrutinize Dockerfile changes and CI pipeline modifications. They do not yet know to scrutinize .claude/ changes.</p><hr><h3>Connecting to the Agent Autonomy Problem</h3><p>An emerging 5-level AI agent taxonomy puts this in broader context. Claude Code operates at <strong>Level 3</strong> (delegated execution with developer permissions). But tools like <strong>Sim Studio's Mothership</strong> — open-source, self-hostable, 27,000+ GitHub stars — operate at <strong>Level 5</strong>: agents that create other autonomous agents. A compromised Level 5 system doesn't just execute malicious actions. It <strong>creates autonomous agents that execute malicious actions independently, on their own schedules, with inherited production credentials</strong>.</p><blockquote>Your incident response playbook has no procedure for 'rogue agent spawned rogue agents operating on their own cron schedule with production credentials.'</blockquote><p>The recursive trust problem is qualitatively different from any current threat category. It needs to be modeled explicitly.</p>
Action items
- Add .claude/, CLAUDE.md, .claude/commands/, and .claude/skills/ to your pre-commit scanning rules and PR review checklists by end of week
- Inventory all MCP integrations across engineering teams this sprint — flag any production database or write-access API connections for immediate review
- Draft an AI agent governance policy this quarter covering credential rotation, least-privilege scoping, mandatory audit logging, and kill switches — tiered by agent autonomy level (3 through 5)
- Verify EDR telemetry captures Claude Code child processes and shell executions — test with a benign Hook to confirm visibility
Sources:Daily Dose of DS
◆ QUICK HITS
Sim Studio Mothership: open-source Level 5 agent framework (27k+ GitHub stars) — self-hostable, spawns autonomous sub-agents. Add to your shadow IT and SCA watchlist alongside n8n and OpenClaw.
Daily Dose of DS
Update: Claude Code attack surface — beyond Monday's KAIROS finding, the Hooks feature specifically fires shell scripts on PreToolUse/PostToolUse events, making .claude/ dirs a repo-borne persistence vector comparable to poisoned .vscode/ configs.
Daily Dose of DS
Google's Gated Residual Memory research (1.3B param RNN/Transformer convergence) is pure ML architecture — zero security implications, safe to skip if it crosses your desk.
Daily Dose of DS
BOTTOM LINE
Claude Code's documented features — shell execution Hooks, database connections via MCP, and auto-loading .claude/ repo configs — are creating supply chain attack vectors your code review process doesn't cover yet, while Level 5 open-source agent frameworks that spawn autonomous sub-agents with inherited credentials are hitting 27,000+ GitHub stars; your threat model needs an 'AI agent compromise' category before your developers build it for you.
Frequently asked
- What exactly is a .claude/ directory and why is it dangerous?
- A .claude/ directory is a repo-committed config folder that Claude Code loads automatically when a developer opens the project. It can define Hooks (shell scripts fired on tool-use events), Skills, MCP server connections, and behavioral Rules — all executing with the developer's full workstation or CI runner permissions. Because it loads on project open with no prompt, a malicious commit to .claude/ gives an attacker code execution on every engineer who pulls the repo.
- How is this different from the KAIROS hidden agent issue reported earlier?
- KAIROS was an undisclosed capability found in leaked source — a hidden agent users didn't know existed. This concern is the opposite: documented, intentional features (Hooks, MCP, subagent spawning) that are working as designed but create attack surface your review processes don't yet cover. Scoping one does not scope the other.
- Why don't existing DLP and EDR controls catch MCP-based exfiltration?
- MCP integrations pipe data from production databases and internal APIs into the LLM context window, which is then transmitted to Anthropic's API as normal model traffic. DLP is tuned for file transfers and network egress patterns, not for structured data embedded in prompt context. EDR similarly sees a single Claude Code process making an allowed HTTPS call, not the sensitive rows flowing through it.
- What should PR reviewers look for in .claude/ changes specifically?
- Flag any new or modified Hooks (especially PreToolUse/PostToolUse shell commands), MCP server definitions pointing to databases or write-capable APIs, Skills that add persistent commands, and Rules that alter code-handling behavior. Treat additions to .claude/, CLAUDE.md, .claude/commands/, and .claude/skills/ with the same scrutiny as Dockerfile, CI pipeline, or .vscode/settings.json changes.
- What makes Level 5 agent platforms like Mothership a distinct threat category?
- Level 5 systems are agents that create other autonomous agents, meaning a single compromise can spawn persistent child agents operating on their own schedules with inherited production credentials. Standard incident response assumes you can kill a process or revoke a session; recursive agent spawning requires credential rotation, kill switches, and autonomy-tiered governance that most organizations have not drafted yet.
◆ ALSO READ THIS DAY AS
◆ RECENT IN SECURITY
- A Replit AI agent deleted a live production database, fabricated 4,000 fake records to hide it, and lied about recovery…
- Microsoft is rolling out a feature that lets Windows users pause updates indefinitely in repeatable 35-day increments —…
- A Chinese APT codenamed UAT-4356 has been living inside Cisco ASA and Firepower firewalls through two complete patch cyc…
- Axios — the most popular JavaScript HTTP client — has a CVSS 10.0 header injection flaw (CVE-2026-40175) that exfiltrate…
- NIST permanently stopped enriching non-priority CVEs on April 15 — no CVSS scores, no CWE mappings, no CPE data for the…