Claude Code bypasses safety rule if given too many commands
<h4>A hard-coded limit on deny rules drops automatic enforcement for concatenated commands</h4> <p>Claude Code will ignore its deny rules, used to block risky actions, if burdened with a sufficiently long chain of subcommands. This vuln leaves the bot open to prompt injection attacks.…</p>
Claude Code will ignore its deny rules, used to block risky actions, if burdened with a sufficiently long chain of subcommands. This vuln leaves the bot open to prompt injection attacks.
Adversa, a security firm based in Tel Aviv, Israel, spotted the issue following the leak of Claude Code's source.
Claude Code implements various mechanisms for allowing and denying access to specific tools. Some of these, like curl, which enables network requests from the command line, might pose a security risk if invoked by an over-permissive AI model.
One way the coding agent tries to defend against unwanted behavior is through deny rules that disallow specific commands. For example, to prevent Claude from using curl via ~/.claude/settings.json, you'd add something like { "deny": ["Bash(curl:)"] }.
But deny rules have limits. The source code file bashPermissions.ts contains a comment that references an internal Anthropic issue designated CC-643. The associated note explains that there's a hard cap of 50 on security subcommands, set by the variable MAX_SUBCOMMANDS_FOR_SECURITY_CHECK = 50. After 50, the agent falls back on asking permission from the user. The comment explains that 50 is a generous allowance for legitimate usage.
"The assumption was correct for human-authored commands," the Adversa AI Red Team said in a writeup provided to The Register. "But it didn't account for AI-generated commands from prompt injection – where a malicious CLAUDE.md file instructs the AI to generate a 50+ subcommand pipeline that looks like a legitimate build process."
The Adversa team's proof-of-concept attack was simple. They created a bash command that combined 50 no-op "true" subcommands and a curl subcommand. Claude asked for authorization to proceed instead of denying curl access outright.
-
Claude Code source leak reveals how much info Anthropic can hoover up about you and your system
-
Don't open that WhatsApp message, Microsoft warns
-
Ruby Central report reopens wounds over RubyGems repo takeover
-
One in seven Americans are ready for an AI boss, but they might not trust it
In scenarios where an individual developer is watching and approving coding agent actions, this rule bypass might be caught. But often developers grant automatic approval to agents (--dangerously-skip-permissions mode) or just click through reflexively during long sessions. The risk is similar in CI/CD pipelines that run Claude Code in non-interactive mode.
Ironically, Anthropic has developed a fix – a parser referred to as "tree-sitter" that's also evident in its source code and is available internally but not in public builds.
Adversa argues that this is a bug in the security policy enforcement code, one that has regulatory and compliance implications if not addressed.
A fix would be easy. Anthropic already has "tree-sitter" working internally and a simple one line change, switching the "behavior" key from "ask" to "deny" in the bashPermissions.ts file at line 2174, would address this particular vulnerability.
Anthropic did not immediately respond to a request for comment. ®
The Register AI/ML
https://go.theregister.com/feed/www.theregister.com/2026/04/01/claude_code_rule_cap_raises/Sign in to highlight and annotate this article

Conversation starters
Daily AI Digest
Get the top 5 AI stories delivered to your inbox every morning.
More about
claudesafetyclaude code[Side B] Pursuing OSS Quality Assurance with AI: Achieving 369 Tests, 97% Coverage, and GIL-Free Compatibility
<blockquote> <p><strong>From the Author:</strong><br> Recently, I introduced <strong>D-MemFS</strong> on Reddit. The response was overwhelming, confirming that memory management and file I/O performance are truly universal challenges for developers everywhere. This series is my response to that global interest.</p> </blockquote> <h3> 🧭 About this Series: The Two Sides of Development </h3> <p>To provide a complete picture of this project, I’ve split each update into two perspectives:</p> <ul> <li> <strong>Side A (Practical / from Qiita):</strong> Implementation details, benchmarks, and technical solutions.</li> <li> <strong>Side B (Philosophy / from Zenn):</strong> The development war stories, AI-collaboration, and design decisions.</li> </ul> <h2> Testing is a "Contract between the Design
Anthropic Executive Sees Cowork Agent as Bigger Than Claude Code - Bloomberg.com
<a href="https://news.google.com/rss/articles/CBMitgFBVV95cUxOM0VfSzdRYUNpT21XMlVuNXhsVEY4TUFxM3UzWUJDOEhFcUtJQnhTbjY2VjBXOUw1d1ZOUDRKeHVKMzkta3pFVWRWSGNoQkp3aWVndlRBQlpVUGxVN0ZnQW80OUZnYWN6RlhJWHRjT0V4RVhPcGhxMmE3b3oyVDlUV2RLY0g2NEx4M1dfMXhvTlhPTW50eFR1cEhxcHB3SXpURnRtbDZtZHp6bGQ2Z09IMjZBODBjdw?oc=5" target="_blank">Anthropic Executive Sees Cowork Agent as Bigger Than Claude Code</a> <font color="#6f6f6f">Bloomberg.com</font>
Knowledge Map
Connected Articles — Knowledge Graph
This article is connected to other articles through shared AI topics and tags.
More in Models
Introducing The Screwtape Ladders
The time has come for me to find a new home for my writings. Like many an author before me, I've enjoyed improving my craft and getting feedback on my essays here. LessWrong is a good incubator for honing one's skills in that arena. There's a chance to get your point out in front of a really broad audience of really smart people. There's been some cool moments. My oldest visible post, Write A Thousand Roads to Rome , got cited in a discussion with Eliezer Yudkowsky once. I keep seeing people bring up Loudly Give Up, Don't Quietly Fade as a motivator for speaking out. Sometimes it's really cool people working on awesome projects, and I feel a flash of sadness at 'aww, it's not going to happen' and also a bit of cool 'whoa, they remember that post?' You've all also let me get away with a lot
Anthropic Executive Sees Cowork Agent as Bigger Than Claude Code - Bloomberg.com
<a href="https://news.google.com/rss/articles/CBMitgFBVV95cUxOM0VfSzdRYUNpT21XMlVuNXhsVEY4TUFxM3UzWUJDOEhFcUtJQnhTbjY2VjBXOUw1d1ZOUDRKeHVKMzkta3pFVWRWSGNoQkp3aWVndlRBQlpVUGxVN0ZnQW80OUZnYWN6RlhJWHRjT0V4RVhPcGhxMmE3b3oyVDlUV2RLY0g2NEx4M1dfMXhvTlhPTW50eFR1cEhxcHB3SXpURnRtbDZtZHp6bGQ2Z09IMjZBODBjdw?oc=5" target="_blank">Anthropic Executive Sees Cowork Agent as Bigger Than Claude Code</a> <font color="#6f6f6f">Bloomberg.com</font>
Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT - wsj.com
<a href="https://news.google.com/rss/articles/CBMiogNBVV95cUxNdjBYMFhlczBFa0NWeTB6T0tzLWNfcV9GNmMzaFdHR2xKcW5QV1l4NTBIYVZncmZFU0poSWdibHVSREczeFczZFRtNl9FSWl3bG9EMFhuLUJuWFYtOWh6d2tRYmxOODhGSmdmQkdBbURXVklyZU0tYVdSZ1JhMVFFNjRxZTBvVUlLNnpIWEZCT2ZQX0I3cm9FWUNIYTBRMlRuOVYybXZrYUhDay00UzgwUEZHQjFNeTBFOWMtN2RSbXVIU0FNVV9NNUhwTGwwWml1S2o3Nk1wcUU2SEdxWXF5bDhQZ2YyNHJpeGlOS2R5XzluU0ZyblNnS2xjZElVSC1DMXpYeVl6ZERZeTRCVnVPX1VUS2NKRVlGY1hrVmRZUkFXMWlMUEliOVFJMUdXNllYTHRMcGJhbWJrYmZFWi03TjgwMXhLdDVrZWtMTGRFTEtGdFlsb3lhX2pCWFd6eVJiTlRrZ0pCN3dKSTVnLWoxQmZQc25HVlJLOHhnRFBwekw3WG81MURaYUhncmk0aGx0YmRMWVVqNkxhS0kyZmtXbWtn?oc=5" target="_blank">Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT</a> <font color="#6f6f6f">wsj.com</font>
Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT - wsj.com
<a href="https://news.google.com/rss/articles/CBMiogNBVV95cUxOdFpHbnQyNmZoUzR3dXJDb25HalR1TWp2OWFqVGgyeWRucVVaaUlWaWU1SjJqX0xEcjE5R3g3RGczeU9jRGRvSHc4U0I4RFZickNFZ1k3VnM5VUxQQTFrVXdNWS1IekVRQmZyem40SXpISEVCUEZ6aFd4d2VZVWd3QWQ1UlEtbnJ3MlFQMzdYcWx5dnVqbTNXdXhiOTlScFZzemVUUzFXdEJBTXJaWTJYbXJPLVZCMjVvS1VwVUpndktzNnVpT1AyeFcya0FtbXJqem1idzZIdWhkTWJSV0ktNkduSEV2Wno4VkdGQ3QtdlRTVUhxSXVxNHR2V256ZjVaVG1LZVFIdFhkTnFQUFBuMXcwOUlnSEkxOFRoNWRMdkczRXZqV1V3UG9QcEh4UHJwN0xrUTNYVzkzYmhpSldtc1EzdXJVNW1id2xTSEFwOVplcE1iZVpyUmM1X2R5UnNyckhHQm56eWpCZTRXWW1Hd3N3Ukh1YnpJcjJWV1hZazdqdHZJMlVBTV9RM085TmRSZFRlSlFOTTNhS21NRGVGRjdB?oc=5" target="_blank">Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT</a> <font color="#6f6f6f">wsj.com</font>

Discussion
Sign in to join the discussion
No comments yet — be the first to share your thoughts!