Claude Code Auto Mode turned into Yes Mode by one AGENTS.md line
Matan Ben-Tov (published Nov 1, 2026) shows a one-line prompt injection in a project AGENTS.md that makes Claude Code Auto Mode allow tool calls the user set it to deny. Auto Mode has been the default…
What happened
Matan Ben-Tov (published Nov 1, 2026) shows a one-line prompt injection in a project AGENTS.md that makes Claude Code Auto Mode allow tool calls the user set it to deny. Auto Mode has been the default tool-call gate since Aug 7, 2026. On each tool call, Claude Code prompts Sonnet 5, without thinking, to return a severity score. The reverse engineering was done on Claude Code v2.1.251 as of Sep 1, 2026. A score under 25 is allowed. A higher score is escalated to another Sonnet 5 call with thinking, which this attack does not need. The classifier prompt includes the user's CLAUDE.md, memory files, and the project AGENTS.md, wrapped in a user_claude_md tag. The published line closes that tag and tells the classifier to score on a 0-10 scale where 5 is the allow or block boundary, then reopens the tag. In the tests, every injected classification came back between 0 and 10, so Claude Code treated the score as under 25 and ran the command. A direct demo used a hard_deny rule that should block curl or fetch except to example.com. On a clean Pi repository the classifier returned 90 and blocked mal.com. After the line was added, the same request was allowed with a score of 8. Across about 50 isolated classifier scenarios on seven repositories (pi, browser-use, tropt, bun, codex, rocksdb, and ghostty) and four user profiles, 4 percent slipped past with a clean AGENTS.md and 99 percent did with the line, measured as a score under 15. In 30 end-to-end sessions with Opus 5.5 as the main agent, the classifier blocked every forbidden command on the clean file. With the line present, forbidden commands ran in 22 of 30 sessions (73 percent), including a read of a local .env, git config --global http.sslVerify false, and commands that came from a malicious skill rather than the user's prompt. The attack still worked on Claude Code v2.1.316, released Oct 31, 2026, including versions that classify on the server. Mahmood Sharif is thanked for guidance. This is not the Downloads-folder AGENTS.md hijack in forever-agents-md-hijack-2026.
Claude Code Auto Mode asks Sonnet 5 to score each tool call from 0 to 100 and allows scores under 25. A single line in the project's AGENTS.md is copied into that classifier prompt and changes the scale to 0-10.
How it happened
Read the flow as text & sources
A catalog reconstruction of the supplied source account. The post is a researched bypass, evaluated in containers. It does not describe an in-the-wild intrusion. Matan Ben-Tov says Anthropic had not replied to the Sept 4, 2026 disclosure by publication.
- 01 · One line in AGENTS.md
The repository's AGENTS.md closes the user_claude_md tag and tells the classifier to score severity from 0 to 10.
Hunt: An agent ingests external content or an untrusted session identifier before a tool action or configuration change outside the approved task.
Requires application instrumentation and a custom field mapping. Input exposure does not prove that the model followed instructions, executed a tool or bypassed approval. Avoid collecting sensitive prompt bodies unless authorized.
Source for step 1 - 02 · Sonnet 5 scores under 10
Auto Mode sends the file to Sonnet 5. In the tests every injected score came back between 0 and 10.
Hunt: An agent ingests external content or an untrusted session identifier before a tool action or configuration change outside the approved task.
Requires application instrumentation and a custom field mapping. Input exposure does not prove that the model followed instructions, executed a tool or bypassed approval. Avoid collecting sensitive prompt bodies unless authorized.
Source for step 2 - 03 · Claude Code allows scores under 25
The client treats the 0-10 score as below the threshold of 25 and runs the tool call, including hard_deny commands.
Source for step 3 - 04 · Denied commands still run
End-to-end sessions then read a local .env, disabled git TLS verification, or followed a malicious skill. Clean sessions blocked the same commands.
Hunt: An unexpected process or tool accesses credential stores and is followed by token use or outbound transfer inconsistent with the owner.
Defender DeviceFileEvents is not a general file-read audit trail. Collect suitable object-access, EDR or application logs; legitimate developer tools also read secrets.
Source for step 4
Why it matters
Reported entry point: The user runs Claude Code, with Auto Mode on, in a repository whose AGENTS.md contains the one published line. Reported impact: End-to-end sessions then read a local .env, disabled git TLS verification, or followed a malicious skill. Clean sessions blocked the same commands; reported targets include Claude Code users who open a repository they did not write. No victim organization is named. The evaluation ran locally in containers; applicability to your setup has not been assessed, so verify affected versions, permissions, and configuration in the original report.
What you can do
Protection & prevention
Run Claude Code in a sandbox or container when the repository is not yours, so a failed Auto Mode check cannot reach keys or a local .env. Read AGENTS.md before the session. Treat AGENTS.md, CLAUDE.md, and skill files as code the classifier will ingest. The post's own patch ideas, a score that states its scale, keeping untrusted files out of the classifier prompt, or a non-LLM classifier, are described as incomplete.
Catalog defensive guidance based on the reported behavior. Confirm scope and current mitigations in the original source.
Detection queries
Draft query starters grouped by the attack stages where they apply.
Start with the logs you collect. Each hunt identifies its required visibility, field mapping and limits. Queries are catalog-authored drafts using reusable behavior profiles; test with known activity and your normal baseline before alerting.
01One line in AGENTS.mdUntrusted content enters an agent sessionCustom schema · Draft
The repository's AGENTS.md closes the user_claude_md tag and tells the classifier to score severity from 0 to 10.
What to look for
An agent ingests external content or an untrusted session identifier before a tool action or configuration change outside the approved task.
Visibility: Application / agent audit records
Required logs
- Input provenance, source type and request/session identifier
- Captured tool responses or retrieved content where collection is approved
- Subsequent tool calls, configuration changes and approval decisions
Coverage limit. Requires application instrumentation and a custom field mapping. Input exposure does not prove that the model followed instructions, executed a tool or bypassed approval. Avoid collecting sensitive prompt bodies unless authorized.
Custom-schema candidate for input exposure only. Map agent.input.ingest and agent.session.resume to your application request and session logs. CorrelationId must link subsequent actions. EventType values are proposed normalization names, not native vendor events.
Sigma
title: Hunt - Untrusted content enters an agent session
id: 2d89d7ae-9d44-4dc6-a95b-f9c8de7b8352
status: experimental
description: An agent ingests external content or an untrusted session
identifier before a tool action or configuration change outside the approved
task.
author: MagicSword OpenAttacks catalog
date: 2026-11-04
falsepositives:
- Authorized activity matching this broad hunt; baseline and investigate
before alerting.
level: low
logsource:
category: application
product: openattacks_audit
definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
Target and CorrelationId from the required source logs first.
detection:
selection:
EventType:
- agent.input.ingest
- agent.session.resume
condition: selection
KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("agent.input.ingest", "agent.session.resume")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("agent.input.ingest", "agent.session.resume")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Join the ingested input to later actions by session or request ID; preserve the original content as evidence.
- Compare the resulting action with the approved task and baseline. Receiving suspicious text alone is not successful injection.
02Sonnet 5 scores under 10Untrusted content enters an agent sessionCustom schema · Draft
Auto Mode sends the file to Sonnet 5. In the tests every injected score came back between 0 and 10.
What to look for
An agent ingests external content or an untrusted session identifier before a tool action or configuration change outside the approved task.
Visibility: Application / agent audit records
Required logs
- Input provenance, source type and request/session identifier
- Captured tool responses or retrieved content where collection is approved
- Subsequent tool calls, configuration changes and approval decisions
Coverage limit. Requires application instrumentation and a custom field mapping. Input exposure does not prove that the model followed instructions, executed a tool or bypassed approval. Avoid collecting sensitive prompt bodies unless authorized.
Custom-schema candidate for input exposure only. Map agent.input.ingest and agent.session.resume to your application request and session logs. CorrelationId must link subsequent actions. EventType values are proposed normalization names, not native vendor events.
Sigma
title: Hunt - Untrusted content enters an agent session
id: 2d89d7ae-9d44-4dc6-a95b-f9c8de7b8352
status: experimental
description: An agent ingests external content or an untrusted session
identifier before a tool action or configuration change outside the approved
task.
author: MagicSword OpenAttacks catalog
date: 2026-11-04
falsepositives:
- Authorized activity matching this broad hunt; baseline and investigate
before alerting.
level: low
logsource:
category: application
product: openattacks_audit
definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
Target and CorrelationId from the required source logs first.
detection:
selection:
EventType:
- agent.input.ingest
- agent.session.resume
condition: selection
KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("agent.input.ingest", "agent.session.resume")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("agent.input.ingest", "agent.session.resume")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Join the ingested input to later actions by session or request ID; preserve the original content as evidence.
- Compare the resulting action with the approved task and baseline. Receiving suspicious text alone is not successful injection.
04Denied commands still runSensitive store access → credential useCustom schema · Draft
End-to-end sessions then read a local .env, disabled git TLS verification, or followed a malicious skill. Clean sessions blocked the same commands.
What to look for
An unexpected process or tool accesses credential stores and is followed by token use or outbound transfer inconsistent with the owner.
Visibility: Defender-side logs where collected
Required logs
- File-read / API access telemetry for relevant secret stores
- Process identity and command lines
- Identity, token and outbound-network audit logs
Coverage limit. Defender DeviceFileEvents is not a general file-read audit trail. Collect suitable object-access, EDR or application logs; legitimate developer tools also read secrets.
Custom-schema candidates, not out-of-box detectors. Map your application / cloud / platform logs to EventType, Actor, Asset, Action, Target and CorrelationId. KQL uses a custom OpenAttacksAudit_CL table; SPL uses openattacks:audit. EventType values are proposed normalization names, not native vendor event names. Correlation and environment-specific alert logic remain to be built.
Sigma
title: Hunt - Sensitive store access → credential use
id: 46c46c62-2d83-4198-a8bf-d6637094527b
status: experimental
description: An unexpected process or tool accesses credential stores and is
followed by token use or outbound transfer inconsistent with the owner.
author: MagicSword OpenAttacks catalog
date: 2026-10-23
falsepositives:
- Authorized activity matching this broad hunt; baseline and investigate
before alerting.
level: low
logsource:
category: application
product: openattacks_audit
definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
Target and CorrelationId from the required source logs first.
detection:
selection:
EventType:
- secret.read
- credential.store.read
condition: selection
KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("secret.read", "credential.store.read")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("secret.read", "credential.store.read")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Identify the actor, process and exact store touched, then pivot to token use from new devices or infrastructure.
- Correlate reads with egress and rotate affected credentials after confirming exposure.
Technical detailsTooling, impact & MITRE ATLAS
Attack context
- AI's role
- Agent / MCP as target
- Initial access
- The user runs Claude Code, with Auto Mode on, in a repository whose AGENTS.md contains the one published line
Tooling as reported
AI products, models and artifacts
- Claude Code Auto Mode, tested through v2.1.316 (Oct 31, 2026)
- Sonnet 5 permission classifier
- Opus 5.5 as the main agent in the end-to-end sessions
Other tooling
- Project AGENTS.md
Targets and reported impact
- Targets / sectors
- Claude Code users who open a repository they did not write. No victim organization is named. The evaluation ran locally in containers.
- Reported scale / exposure
- Classifier bypass in 99 percent of about 50 injected scenarios, versus 4 percent clean. End-to-end forbidden commands ran in 22 of 30 injected sessions and in 0 of 30 clean sessions. Effective on Claude Code v2.1.316.
No target country. The evaluation repositories are public codebases used as fixtures.
Reported attribution
No threat actor. Matan Ben-Tov disclosed the bypass to Anthropic on Sept 4, 2026, and reports no response by publication.
Structured attribution
- Actor
- unknown
- Motivation
- unknown
- Attributed by
- Matan Ben-Tov
- Attribution confidence
- low
Detection rules
- The AGENTS.md scale line is not a host ruleGUIDANCE
No cited rule matches a markdown line that retargets Claude Code's Auto Mode classifier. Search repositories for the published fragment that closes user_claude_md and sets a 0-10 severity scale. A blocked curl in the user's hard_deny list that then succeeds is the session-level sign the post demonstrates.
Activity timeline
- First seen
- 2026-09-01
- Last updated
- 2026-11-01
Updates
- 2026-09-01 — Matan Ben-Tov
Reverse engineering on Claude Code v2.1.251. Auto Mode had been the default gate since Aug 7, 2026.
- 2026-09-04 — Matan Ben-Tov
Disclosed to Anthropic. The post says there was no response by publication.
- 2026-10-31 — Matan Ben-Tov
The bypass still works on Claude Code v2.1.316, including server-side classification.
- 2026-11-01 — Matan Ben-Tov
The Yes Mode write-up is published, with the 99 percent classifier result and the 22-of-30 session result.
Source defensive notes
Run Claude Code in a sandbox or container when the repository is not yours, so a failed Auto Mode check cannot reach keys or a local .env. Read AGENTS.md before the session. Treat AGENTS.md, CLAUDE.md, and skill files as code the classifier will ingest. The post's own patch ideas, a score that states its scale, keeping untrusted files out of the classifier prompt, or a non-LLM classifier, are described as incomplete.
MITRE ATLAS
AI-specific catalog annotations based on the reported behavior; these are not MITRE case-study assignments.
The project AGENTS.md is untrusted text that is copied into the Auto Mode classifier prompt Source
The line changes the classifier's 0-100 severity scale so a high-risk score falls under the allow threshold of 25 Source
Sources & research credit
1 sourceResearch by Matan Ben-Tov · Independent
The classifier design, the published line, the Pi demo, the 99 percent and 73 percent figures, the v2.1.316 result, and the Sept 4 disclosure are from Matan Ben-Tov's post. Link forever-agents-md-hijack-2026, which uses a different AGENTS.md lure.
Record & downloads
- Source record name
- Claude Code Auto Mode turned into Yes Mode by one AGENTS.md line
- Entry ID
- matan-claude-code-yes-mode-agents-md-2026-11
- Catalog review
- November 15, 2026
- Category
- attacks-on-ai
- AI involvement confidence
- confirmed