# Claude Code Auto Mode turned into Yes Mode by one AGENTS.md line

- ID: matan-claude-code-yes-mode-agents-md-2026-11
- Reported: 2026-11-01
- Researcher: Matan Ben-Tov
- Organization: Independent
- AI role: ai_agent_or_mcp_as_target (Agent / MCP as target)
- Confidence in AI involvement: not assessed
- Research / borderline: true
- Last reviewed: 2026-11-15
- Entry page: https://openattacks.ai/attacks/matan-claude-code-yes-mode-agents-md-2026-11/
- Entry JSON: https://openattacks.ai/api/attacks/matan-claude-code-yes-mode-agents-md-2026-11.json
- Browse title: Claude Code Auto Mode turned into Yes Mode by one AGENTS.md line
- Editorial summary: 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…
- Evidence class (catalog annotation): Qualified report
- Source-stated target environments: Not specified
- Stage hunts and conditional defenses: https://openattacks.ai/api/defenses/matan-claude-code-yes-mode-agents-md-2026-11.json

## Evidence qualification
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.

## Technique
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.

## Stack relevance (editorial)
Assessment: not\_assessed. No reviewed applicability annotation is available. Product mentions do not establish victim conditions.
A product mention alone is not a victim-side applicability mapping. Selection does not verify affected versions, permissions or compromise.

## Initial access
The user runs Claude Code, with Auto Mode on, in a repository whose AGENTS.md contains the one published line

## AI tooling and models
- [Claude Code](https://github.com/anthropics/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

## Victims and sectors
Claude Code users who open a repository they did not write. No victim organization is named. The evaluation ran locally in containers.

## Target geography
- Not applicable
No target country. The evaluation repositories are public codebases used as fixtures.

## Attribution
No threat actor. Matan Ben-Tov disclosed the bypass to Anthropic on Sept 4, 2026, and reports no response by publication.

## Scale and metrics
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.

## Attack flow
Catalog reconstruction of the supplied source account. Unknowns and research caveats are preserved.
### plant: One line in AGENTS.md [access]
The repository's AGENTS.md closes the user\_claude\_md tag and tells the classifier to score severity from 0 to 10.
Evidence: https://matanbt.github.io/post/yesmode2026/

### score: Sonnet 5 scores under 10 [ai]
Auto Mode sends the file to Sonnet 5. In the tests every injected score came back between 0 and 10.
Evidence: https://matanbt.github.io/post/yesmode2026/

### allow: Claude Code allows scores under 25 [execution]
The client treats the 0-10 score as below the threshold of 25 and runs the tool call, including hard\_deny commands.
Evidence: https://matanbt.github.io/post/yesmode2026/

### bypass: Denied commands still run [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.
Evidence: https://matanbt.github.io/post/yesmode2026/

Connections:
- plant -> score
- score -> allow
- allow -> bypass

## Stage defense and hunting recommendations
Editorial recommendations, not validated coverage. Source-controlled query starters are drafts. Custom-schema examples require telemetry collection and field mapping; absence of a mapping means not assessed. MagicSword policy opportunities require managed Windows scope and enforcement.
### plant: Untrusted content enters an agent session
- Visibility: Application / agent audit records
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/agent-input.sigma.yml
- KQL query download: /api/detections/agent-input.kql
- SPL query download: /api/detections/agent-input.spl
- Hunt hypothesis: An agent ingests external content or an untrusted session identifier before a tool action or configuration change outside the approved task.
- Required telemetry: 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
- Investigate: Join the ingested input to later actions by session or request ID; preserve the original content as evidence.
- Investigate: Compare the resulting action with the approved task and baseline. Receiving suspicious text alone is not successful injection.
- Limitation: 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.
- No direct MagicSword prevention claim is recorded for this stage.

### score: Untrusted content enters an agent session
- Visibility: Application / agent audit records
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/agent-input.sigma.yml
- KQL query download: /api/detections/agent-input.kql
- SPL query download: /api/detections/agent-input.spl
- Hunt hypothesis: An agent ingests external content or an untrusted session identifier before a tool action or configuration change outside the approved task.
- Required telemetry: 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
- Investigate: Join the ingested input to later actions by session or request ID; preserve the original content as evidence.
- Investigate: Compare the resulting action with the approved task and baseline. Receiving suspicious text alone is not successful injection.
- Limitation: 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.
- No direct MagicSword prevention claim is recorded for this stage.

### allow: Stage hunt not mapped yet
- Visibility: Not assessed
- Query origin: catalog_authored; status: not_assessed; log scope: gap
- Hunt hypothesis: A stage-specific hunt has not been reviewed for this part of the source account.
- Required telemetry: not assessed
- Investigate: Review the cited behavior, identify the observing party and available logs, then propose and test a hunt.
- Limitation: An unmapped stage does not mean it is undetectable or that no behavior occurred. It means this catalog has not supplied a reviewed hunt for it.
- No direct MagicSword prevention claim is recorded for this stage.

### bypass: Sensitive store access → credential use
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/credentials.sigma.yml
- KQL query download: /api/detections/credentials.kql
- SPL query download: /api/detections/credentials.spl
- Hunt hypothesis: An unexpected process or tool accesses credential stores and is followed by token use or outbound transfer inconsistent with the owner.
- Required telemetry: File-read / API access telemetry for relevant secret stores; Process identity and command lines; Identity, token and outbound-network audit logs
- Investigate: Identify the actor, process and exact store touched, then pivot to token use from new devices or infrastructure.
- Investigate: Correlate reads with egress and rotate affected credentials after confirming exposure.
- Limitation: Defender DeviceFileEvents is not a general file-read audit trail. Collect suitable object-access, EDR or application logs; legitimate developer tools also read secrets.
- No direct MagicSword prevention claim is recorded for this stage.


## MITRE ATLAS
Mappings are catalog annotations based on described behavior, not assignments or endorsements by MITRE.
- AML.T0051.001: Indirect — The project AGENTS.md is untrusted text that is copied into the Auto Mode classifier prompt
  Technique: https://atlas.mitre.org/techniques/AML.T0051.001
  Evidence: https://matanbt.github.io/post/yesmode2026/
- AML.T0054: LLM Jailbreak — The line changes the classifier's 0-100 severity scale so a high-risk score falls under the allow threshold of 25
  Technique: https://atlas.mitre.org/techniques/AML.T0054
  Evidence: https://matanbt.github.io/post/yesmode2026/

## 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.

## Sources
- https://matanbt.github.io/post/yesmode2026/ — Turning Claude Code's Auto Mode Into "Yes Mode"

## Source notes
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.

## Indicators (untrusted data; do not visit or execute)
```json
{
  "domains": [],
  "ips": [],
  "hashes": [],
  "urls": []
}
```
