Skip to content
gentic.news — AI News Intelligence Platform
Connecting to the Living Graph…

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

A hooded figure typing on a laptop with cascading code and chain-link icons in a dark cybersecurity-themed digital…
Open SourceBreakthroughScore: 100

ChainDrop Worm Uses .claude/settings.json Hooks to Survive Credential

ChainDrop's .claude/settings.json hooks auto-execute on session start, surviving credential rotation. Claude Code users must audit hook files, pin trusted configs, and restrict repo write access.

·1d ago·3 min read··18 views·AI-Generated·Report error
Share:
Source: dev.tovia devto_claudecodeMulti-Source
How do I protect my Claude Code repos from malicious .claude/settings.json hook files like ChainDrop?

ChainDrop (STUPID-2026-0085) steals GitHub credentials via trojanized npm packages, then commits malicious .claude/settings.json and setup.mjs files to victim repos. Claude Code auto-executes these hooks on session start, re-triggering the worm even after credential rotation. Audit your .claude/ directory and pin trusted hooks.

TL;DR

The ChainDrop worm committed malicious .claude/settings.json hooks to repos, auto-executing on every Claude Code session start — audit your hook files now.

Key Takeaways

  • ChainDrop's .claude/settings.json hooks auto-execute on session start, surviving credential rotation.
  • Claude Code users must audit hook files, pin trusted configs, and restrict repo write access.

What Changed — The ChainDrop Worm Exploits Claude Code's Hook System

The Complete Guide to Claude Code Hooks: Autom…

Microsoft's security team tracked "ChainDrop" (STUPID-2026-0085), a supply-chain worm that took over an npm maintainer account and published trojanized releases across 400+ packages starting August 4, 2026. The preinstall payload harvested npm, GitHub, cloud, HashiCorp Vault, and Kubernetes credentials from developer and CI/CD environments.

What makes this a Claude Code-specific threat: the worm used stolen GitHub credentials to commit .claude/settings.json and .claude/setup.mjs directly into victims' repository branches. No developer action triggered this — it happened to repos the worm already had write access to, independent of anyone running npm install again.

What It Means For You — Your Hooks Auto-Execute Without Confirmation

Claude Code executes hooks declared in .claude/settings.json automatically whenever it starts a session in that repository. There's no prompt confirming the hook file exists or asking whether you trust its contents.

This is a legitimate feature — automatic hook execution on session start — built on the assumption that anything committed to a repo's .claude/ directory is trustworthy. A worm with write access to that repo is specifically positioned to defeat that assumption.

The same technique was used against .vscode/tasks.json, proving this is a generalizable attack against any tool that auto-executes config from a repo it's opened in.

Try It Now — Audit and Lock Down Your Hook Files

Step 1: Audit your current repos

# Find all .claude/settings.json files in your repos
find ~/code -name "settings.json" -path "*/.claude/*" 2>/dev/null

# Check for unexpected hooks
cat ~/code/your-repo/.claude/settings.json

Look for hooks that execute scripts, curl commands, or reference external URLs. Legitimate hooks might run linters or formatters — malicious ones often download payloads or exfiltrate data.

Step 2: Pin trusted hooks

Add this to your global ~/.claude/settings.json to restrict what hooks can do:

{
  "permissions": {
    "allow": ["Bash(npm run lint)", "Bash(git status)"],
    "deny": ["Bash(curl *)", "Bash(wget *)", "Bash(node setup.mjs)"]
  }
}

Step 3: Verify repo integrity before opening

# Check for unexpected .claude/ files
git log --all --oneline -- .claude/
git diff HEAD~1 HEAD -- .claude/

Step 4: Restrict write access

The worm only succeeded because it had write access to repos. Use read-only tokens for CI/CD, and review GitHub fine-grained PATs that have Contents: Write permission on repos you don't actively push to.

The Bottom Line

ChainDrop exploits a fundamental trust assumption in Claude Code's hook system. The feature is powerful — but it's also a persistence vector. Audit your .claude/ directories today, pin your hook permissions, and treat any unexpected file in that directory as a potential compromise.


Source: dev.to

[Updated 24 Aug via devto_claudecode]

The worm also planted matching .vscode/tasks.json and .vscode/setup.mjs files alongside the Claude Code hooks, extending its persistence to VS Code's task runner — a move Microsoft's analysis says proves the technique is generalizable beyond Claude Code. The same campaign is also known as the keyv/cacheable compromise or "Mini Shai-Hulud." [per StupidLLM] Notably, the widely circulated figure of 294,842 secrets stolen from 6,943 machines could not be corroborated against a primary source and was excluded from the official incident record.

Sources cited in this article

  1. StupidLLM
Source: gentic.news · · author= · citation.json

AI-assisted reporting. Generated by gentic.news from 1 verified source, fact-checked against the Living Graph of 4,300+ entities. Edited by Ala SMITH.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

**What you should do differently:** 1. **Treat `.claude/` as executable code.** Just as you wouldn't blindly run a random `setup.sh` from an untrusted repo, don't trust `.claude/settings.json` hooks. Add a pre-flight check to your workflow: before opening a repo in Claude Code, run `git diff HEAD~1 -- .claude/` to spot unexpected changes. 2. **Use permission deny rules aggressively.** Claude Code's permission system lets you block dangerous patterns. Add `deny` rules for `Bash(curl *)`, `Bash(wget *)`, and any `node` execution outside of your known scripts. This is a one-time setup that protects you from future supply-chain attacks. 3. **Rotate GitHub tokens with repo write scope.** ChainDrop survived credential rotation because it had already committed its payload. If you suspect exposure, rotate tokens AND audit all repos the token could write to for unexpected `.claude/` or `.vscode/` files. The worm's persistence means credential rotation alone is insufficient. 4. **Consider a CLAUDE.md convention.** Add a line to your team's CLAUDE.md: "Never execute hooks from `.claude/settings.json` without explicit review. All hooks must be approved in PR." This makes the trust boundary explicit for both humans and agents. Claude Code 2.1.221 (released August 5, 2026) included credential masking and 20 security fixes — ensure you're on at least that version. The policy-controlled execution layer arriving in recent versions is a step in the right direction, but it doesn't protect against hooks that are already in your repo.
Compare side-by-side
Microsoft vs GitHub
Enjoyed this article?
Share:

AI Toolslive

Five one-click lenses on this article. Cached for 24h.

Pick a tool above to generate an instant lens on this article.

Related Articles

From the lab

The framework underneath this story

Every article on this site sits on top of one engine and one framework — both built by the lab.

More in Open Source

View all