In short
Claude Code is Anthropic's agentic coding tool. It reads a codebase, edits files, runs shell commands and works with git, from a terminal, IDE, desktop app or browser. It saves transcripts and settings in a .claude folder in the user's home directory, and on Linux its login credentials too, so that folder is sensitive.
Key takeaways
- What it is
- An AI coding agent from Anthropic that plans and carries out development tasks: reading code, editing files, running commands and opening pull requests.
- How it works
- The agent calls tools under a permission system, connects to outside services through MCP, and records every session as a plaintext JSONL transcript under ~/.claude.
- Why it matters
- Transcripts can hold pasted keys and command output. Anthropic and MITRE have also documented attackers who used Claude Code to automate intrusions.
- What Odin Research saw
- Claude Code made up 85.2% of 1,731 exposed coding-agent files in Monograph 04, and 26 servers exposed Claude Code folders in Monograph 10.
- What to do first
- Never serve a home folder over HTTP, deny dotfile paths at every proxy, and rotate any key that ever passed through an agent session.
What is Claude Code?
Claude Code is an agentic coding tool from Anthropic. It reads a codebase, edits files, runs commands and works with git and other developer tools. Developers use it from a terminal, an IDE extension, a desktop app or a browser. It writes its sessions and settings to local folders that defenders should treat as sensitive.
Anthropic's documentation describes it as an AI-powered coding assistant that can work across many files and tools. Typical tasks are writing tests, fixing bugs, resolving merge conflicts and opening pull requests. It can also run without a human in the loop, for example in CI pipelines or on a schedule.
From a security point of view, Claude Code is one of a growing set of AI agents with real access to systems. An agent that can run shell commands holds the same power as the account it runs under. That is why its configuration, its permissions and the files it leaves behind matter.
How Claude Code works
Claude Code runs a loop. The model reads the task, chooses a tool such as a file edit or a shell command, reads the result and decides on the next step. Several features shape what it can do:
- Permissions. Anthropic documents permission modes. In manual mode the agent starts read-only and asks before edits or commands. In auto mode a separate classifier reviews actions and blocks those it judges unsafe. Allow, ask and deny rules live in
settings.jsonfiles. - MCP. The Model Context Protocol lets Claude Code call outside tools and data sources. Project servers are listed in
.mcp.json. See Securing MCP Servers and Tool Access. - Instructions and memory. A
CLAUDE.mdfile in a project gives standing instructions at the start of each session. Auto memory notes live under~/.claude/projects/. - Subagents. The agent can start helper agents with their own context. Their transcripts are stored next to the parent session.
The documentation is direct about local data. Transcripts in ~/.claude/projects/<project>/<session>.jsonl are plaintext. Anything that passes through a tool, such as file contents, command output or pasted text, is written to them. The file-history/ folder keeps pre-edit snapshots of changed files. These are deleted after cleanupPeriodDays, 30 days by default. Login credentials are kept in the macOS Keychain when available, and on Linux in a file with mode 0600.
How attackers use Claude Code
Attackers have misused Claude Code in two ways: as an automation engine for intrusions, and as a source of secrets.
- AI-orchestrated espionage. In November 2025, Anthropic reported a campaign it detected in mid-September 2025 and attributed, with high confidence, to a Chinese state-sponsored group. The actor manipulated Claude Code into attempting intrusions against about thirty targets. Anthropic estimated that AI performed 80 to 90% of the campaign. The attackers split the work into small, innocent-looking tasks and claimed to be a security firm. Anthropic banned the accounts and notified affected parties.
- A government-sector campaign. MITRE ATT&CK tracks campaign C0064, active from December 2025 to February 2026, in which human operators used Claude Code and an OpenAI model against Mexican government bodies. MITRE lists scanning, web shells, Active Directory credential attacks such as DCSync, and data theft. The operators kept a
CLAUDE.mdfile updated with their findings. - Secret theft. Because transcripts and credential files sit in predictable paths, malware and careless file servers can expose them. See Credentials in Files (T1552.001).
None of this makes Claude Code malware. It shows that a capable agent amplifies whoever controls it.
What Odin Research observed
Odin Research found Claude Code data exposed on public servers in four monographs. Most owners appear to be developers who made a mistake, so addresses stay withheld.
- Claude Code dominates exposed agent files. Monograph 04 found 1,731 readable coding-agent session and config files. Claude Code accounted for 1,475 of them (85.2%), mostly subagent JSONL conversation logs. The usual cause was
python3 -m http.serverstarted in/rootor a home folder, which publishes hidden folders such as.claude. - Few servers, many secrets. Monograph 10 found 112 servers exposing the hidden folders of five AI agents. Claude Code folders sat on 26 of them (25 with user files) and produced 988 secret and session matches, mostly inside live session logs. Whether the exposed credentials still worked was not tested.
- Summaries keep the secrets. In Monograph 10, compaction summaries written when a session filled its context window carried keys and tokens from earlier turns. One Claude Code workspace copied to two European servers held the same credential block in a memory note, main sessions, six summary files, side-query logs and file-history snapshots.
- Borrowed logins. Monograph 09 described a third-party gateway whose code can reuse a developer's Claude Code CLI login from disk or the macOS Keychain. Serving that folder over HTTP would publish the token. No such token was found in that case.
- Agents managing agents. Monograph 16 found Hermes Agent playbooks that start Claude Code processes for coding work, and a Claude Code CLI wrapper installed inside an exposed Hermes folder.
How to detect Claude Code exposure and misuse
- Your own attack surface. Search for HTTP 200 responses on
/.claude/paths on your public hosts. Any hit is a leak. - Requests for agent files. Alert on web requests for
/.claude/.credentials.json,.jsonlfiles under/.claude/projects/, or subagent logs. - Archiving agent folders. Flag
tar,zip,scp,curlornccommand lines that name.claude/. - Non-official access to credentials. Alert when a process other than the official CLI reads or writes the Claude Code credential file or queries its Keychain entry.
- Agent-driven bursts. On the network side, watch for many requests per second against your services, a pattern Anthropic described in the espionage case.
Odin Research publishes rules for these. Monograph 10 carries Suricata signatures for requests to agent credential and session paths, a Sigma rule for web log hits on agent dotfiles and a YARA rule for Claude credentials and compaction files. Monograph 04 adds a Sigma rule for archiving coding-agent folders, and Monograph 09 a Sigma rule for non-official access to agent credential stores. All are in the Defense Kit.
How to secure Claude Code in your organization
- Never serve home folders. Require file servers to bind only to the loopback interface, and deny dotfile paths such as
/.claude/at every reverse proxy. - Treat sessions as secret stores. When you rotate a key, also delete transcripts, subagent files and file history that held it. Lower
cleanupPeriodDayson shared servers. See How to respond to leaked credentials. - Use managed settings. Enforce permission rules, deny reads of
.envand credential files, and restrict MCP servers through organization-wide managed settings. - Give agents their own identity. Use scoped, short-lived tokens rather than personal admin keys. See AI Agent Identity and Access.
- Log agent actions. Anthropic supports OpenTelemetry monitoring. Feed it to your SIEM. See Monitoring and Logging for AI Agents.
Claude Code compared with other AI agents
| Agent | Home folder | Typical use | Monograph 10 exposure |
|---|---|---|---|
| Claude Code | ~/.claude | Interactive and scripted coding | 26 servers, 988 matches |
| OpenAI Codex CLI | ~/.codex | Interactive coding | 16 servers, 74 matches |
| Cursor | ~/.cursor | IDE with remote agents | 6 servers, 184 matches |
| OpenClaw | ~/.openclaw | Open-source autonomous agent | 21 servers, 932 matches |
| Hermes Agent | ~/.hermes | Unattended agent with cron and bots | 75 servers, 967 matches |
Frequently asked questions about Claude Code
What is Claude Code?
Claude Code is Anthropic's agentic coding tool. It reads a codebase, edits files, runs commands and works with git, and is available as a CLI, IDE extensions, a desktop app and on the web.
Is Claude Code malware?
No. Claude Code is a commercial developer tool. Like any agent that can run commands, it can be misused, and Anthropic and MITRE have documented attackers who did so.
Where does Claude Code store data?
In ~/.claude in the user's home folder, in ~/.claude.json, and in .claude folders inside projects. Transcripts are plaintext JSONL files under ~/.claude/projects/.
Does Claude Code store API keys in plain text?
Anthropic says credentials go to the macOS Keychain when available and to a file with mode 0600 on Linux. But any key you paste or that a command prints is written into the plaintext session transcript.
How long does Claude Code keep transcripts?
By default, 30 days. Claude Code deletes transcripts and related session data older than the cleanupPeriodDays setting, which administrators can lower.
Have attackers used Claude Code?
Yes. Anthropic reported in November 2025 that a Chinese state-sponsored group manipulated it to attempt intrusions against about thirty targets. MITRE ATT&CK also tracks campaign C0064, in which operators used Claude Code against Mexican government bodies.
How do I check if my Claude Code data is exposed?
Request /.claude/ paths on your own public hosts and look for directory listings or JSONL files. Odin Research publishes Suricata, Sigma and YARA rules for agent folder exposure in its Defense Kit.
Claude Code vs OpenAI Codex CLI: which leaks more?
Both store sessions in a home folder. In Odin Research's Monograph 10, Claude Code folders appeared on 26 exposed servers with 988 matches, and Codex CLI folders on 16 servers with 74 matches.
Sources
- Anthropic, Claude Code overview documentation. code.claude.com/docs/en/overview (checked 21 November 2026)
- Anthropic, Explore the .claude directory (Claude Code documentation). code.claude.com/docs/en/claude-directory (checked 21 November 2026)
- Anthropic, Claude Code security documentation. code.claude.com/docs/en/security (checked 21 November 2026)
- Anthropic, Claude Code settings documentation. code.claude.com/docs/en/settings (checked 21 November 2026)
- Anthropic, report on disrupting an AI-orchestrated espionage campaign, 13 November 2025. www.anthropic.com/news/disrupting-AI-espionage (checked 21 November 2026)
- MITRE ATT&CK, Campaign C0064: AI-Assisted Breach of Mexico's Government Infrastructure. attack.mitre.org/campaigns/C0064/ (checked 21 November 2026)
Related tools and terms
What is CyberStrikeAI?
CyberStrikeAI is a public AI-driven offensive security platform. It spreads its operator interface, API and agent listener across several ports on one host and exposes tools through MCP.
AI offensive toolWhat is PentAGI?
PentAGI is an open-source autonomous penetration testing system that coordinates AI agents and security tools in containers.
AI offensive toolWhat is HexStrike AI?
HexStrikeAI is a public project that exposes many security tools to AI agents through the Model Context Protocol (MCP).
AI security toolWhat is DeepAudit?
DeepAudit is an open-source AI code auditing tool. Application security teams use it to find flaws in source code.
AI security toolWhat is AutoCVE?
AutoCVE is an AI-assisted tool that turns new vulnerability advisories into HTTP checks.
AI security toolWhat is Cairn?
Cairn is a reconnaissance tool that keeps an asset graph built from DNS zones, TLS certificates and HTTP banners.
Odin Research
Get the rules, not just the definition
Every Odin Research report ships with verified indicators and detection rules you can load today.