Claude Code hook
Claude Code Backdoor
Backdooring Claude Code via hooks in settings.json. Authorized use only!
Install
git clone https://github.com/s0ld13rr/claude-code-backdoor.gitFrom the README
Claude Code Backdoor (PoC) A Proof of Concept demonstrating how Claude Code (Anthropic's CLI AI agent) hooks can be leveraged for Initial Access and Persistence. ⚠️ Disclaimer This project is for educational and ethical security testing purposes only. Unauthorized access to computer systems is illegal. The author is not responsible for any misuse of this information. 🔍 Overview Similar to the classic VSCode tasks.json backdoor, Claude Code provides a "Hooks" mechanism. Hooks allow users to execute automated scripts during specific lifecycle events, such as starting a session or executing a command. From a security perspective, these hooks represent a significant attack surface: - Initial Access: By including a malicious .claude/settings.json in a repository, an attacker can execute code when a developer runs claude inside that folder. - Persistence: By modifying the global ~/.claude/settings.json, an attacker can ensure their payload runs every time the user interacts with the AI agent. ⚙️ How It Works Claude Code looks for configuration in two places: Local: path/to/project/.claude/settings.json Global: ~/.claude/settings.json (on macOS/Linux) The following configuration executes a script (script.js) automatically when a Claude session starts: 🚀 Attack Scenarios 1. Supply Chain / Social Engineering An attacker sends a Pull Request or invites a developer to a repository for a "code review." If the developer uses Claude Code to analyze the project, the SessionStart hook triggers, granting the attacker execution in the developer's environment. 2. Stealthy Persistence If a system is already compromised, an attacker can infect the global config. Since developers expect AI agents to run commands, install dependencies, and run tests, a "noisy" terminal won't…
How hooks work
- Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
- They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
- A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Details
- Repository
- s0ld13rr/claude-code-backdoor
- Type
- Hooks
- Language
- JavaScript
- Last updated
- 16 April 2026
- Topics
- backdoorclaude-codeinitial-accessmalwarepentestingpersistencephishingredteaming
FAQ
What is Claude Code Backdoor?
Backdooring Claude Code via hooks in settings.json. Authorized use only! It is a hook for Claude Code, from s0ld13rr/claude-code-backdoor on GitHub.
How do I install Claude Code Backdoor?
Clone s0ld13rr/claude-code-backdoor from GitHub and follow the setup steps in its README.
Is Claude Code Backdoor popular?
s0ld13rr/claude-code-backdoor has 91 GitHub stars and 18 forks. It was last updated on 16 April 2026.
More hooks
Company OS Starter Kit
93Workflowsio/company-os-starter-kit
Build your own Company OS with Claude Code. CLAUDE.md template, 5 GTM skills, workflow plugin, safety hooks, and full blueprint.
Themata Claude Scribe
118Vitorlindo201/Themata-Claude-Scribe
Claude Mythos Engine 2026: AI Sub-Agent Framework for Epic Interactive Storytelling
Uces
104eticmedya/uces
Production-grade configuration system for Claude Code CLI with smart routing, skill modules, and automation hooks.
Youtube Skills
87sergebulaev/youtube-skills
YouTube and YouTube Shorts marketing skills for Claude Code and Codex: high-CTR titles, SEO descriptions, retention hooks, thumbnails, and a content plan. Publish via Publora. MIT. Content engineering by Creative Content Crafts.
Claude Code Tips
92sgaabdu4/claude-code-tips
Token-optimisation stack for Claude Code — CBM + context-mode + RTK + Headroom + Caveman + enforcement hooks
First Pass
129joetawil7/first-pass
Rules and checks that make Claude Code look around a change, not just at the lines it writes: ten questions before code, a reviewer that didn't write it, proof before done, bugs fixed as a class.
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.