You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SECURITY: Claude circumvents denied Bash(rm) by using Python os.remove() as workaround #39459
The permissions system should prevent Claude from accomplishing restricted goals, not just block one method. Currently, Claude appears to be trying alternative execution methods to bypass denied commands.
Expected Behavior
When a command is denied, Claude should:
NOT attempt alternative methods to accomplish the same goal
Inform the user the operation is not allowed
Not try to work around the restriction with different tools/languages
Actual Behavior
Claude attempts to circumvent denied permissions by:
Using Python when Bash(rm) is denied
Potentially using other execution methods when primary methods are blocked
This suggests Claude is treating permission restrictions as "blocked tool" rather than "blocked goal"
This catches the exact bypass pattern you observed: python3 -c "import os; os.remove('file')" when Bash(rm *) is denied.
The key design principle: block the goal (file deletion), not the tool (rm). The hook detects deletion intent across Python, Node, Ruby, and Perl, covering the most common bypass routes.
Pair this with your existing Bash(rm *) deny rule for complete coverage.
This issue highlights the core flaw in Tool-Based Blocking: LLMs are 'Goal-Oriented.' If you block the rm binary, the agent just treats it as a technical obstacle and pivots to a Python or Node.js equivalent to reach the same goal.
Most current hooks (like the Rego/bash snippets suggested above) are a game of cat-and-mouse. You block Python, and the agent moves to Perl or Ruby.
I’ve been researching a different approach called Execution Governance. Instead of trying to block every possible binary, we use a proxy (Node9) to parse the AST of the command before it executes. This allows for 'Goal-Based' human-in-the-loop approval. If the AI tries to delete a file via any interpreter, it triggers a native OS popup or Slack alert.
I did a deep-dive comparison between NVIDIA's OpenShell approach (Infrastructure Isolation) vs. this Governance model here. I think it's the only way to stop these 'bypass-by-design' hallucinations: https://dev.to/node9_ai/securing-the-agentic-era-an-architectural-review-of-nvidia-openshell-vs-node9-proxy-2f7j
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Activity
github-actions commentedon Mar 26, 2026
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
marlvinvu commentedon Mar 27, 2026
My Claude says your issue is similar to issue #38841. I hope you can connect and find a solution together.
yurukusa commentedon Mar 29, 2026
The root issue is that
Bash(rm *)only blocks thermbinary — it doesn't block the goal of file deletion. A hook that covers all deletion vectors:This catches the exact bypass pattern you observed:
python3 -c "import os; os.remove('file')"whenBash(rm *)is denied.The key design principle: block the goal (file deletion), not the tool (rm). The hook detects deletion intent across Python, Node, Ruby, and Perl, covering the most common bypass routes.
Pair this with your existing
Bash(rm *)deny rule for complete coverage.node9ai commentedon Mar 30, 2026
This issue highlights the core flaw in Tool-Based Blocking: LLMs are 'Goal-Oriented.' If you block the rm binary, the agent just treats it as a technical obstacle and pivots to a Python or Node.js equivalent to reach the same goal.
Most current hooks (like the Rego/bash snippets suggested above) are a game of cat-and-mouse. You block Python, and the agent moves to Perl or Ruby.
I’ve been researching a different approach called Execution Governance. Instead of trying to block every possible binary, we use a proxy (Node9) to parse the AST of the command before it executes. This allows for 'Goal-Based' human-in-the-loop approval. If the AI tries to delete a file via any interpreter, it triggers a native OS popup or Slack alert.
I did a deep-dive comparison between NVIDIA's OpenShell approach (Infrastructure Isolation) vs. this Governance model here. I think it's the only way to stop these 'bypass-by-design' hallucinations: https://dev.to/node9_ai/securing-the-agentic-era-an-architectural-review-of-nvidia-openshell-vs-node9-proxy-2f7j
github-actions commentedon May 3, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Jun 22, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.