Pentera Labs "AI Double Agent" — What the Attack Looks Like and How to Defend Your Claude Setup
Security firm Pentera Labs has published detailed research showing how Claude Desktop's Personal Preferences sync mechanism — the per-account instruction block that travels across every device and session — can be turned into a persistent, invisible backdoor. The finding is not theoretical: Pentera's researchers walked through a complete proof-of-concept attack chain in a controlled lab environment and disclosed the results to Anthropic. A Claude Code /tmp path predictability bug (now patched in v2.1.128+) was separately surfaced in security digests today as a companion finding relevant to Claude Code users on shared machines.
The Personal Preferences attack chain
- Step 1 — Account takeover via magic-link phishing: The attacker crafts a lookalike login page and captures the magic-link token from the victim's email. Once in, they access Settings → Personal Preferences — a plain-text instruction block that syncs to Claude Desktop on every device the victim has signed in to.
- Step 2 — Malicious instruction injection: The attacker appends hidden instructions into the Personal Preferences field. Because Claude treats these as high-trust context (they come from the authenticated user's own settings), the injected instructions execute silently alongside every subsequent conversation.
- Step 3 — Tool execution or phishing overlay: If the victim's Claude Desktop has MCP tool integrations enabled, the injected instructions can direct Claude to enumerate the filesystem, run shell commands via connected tools, or render a convincing in-app overlay prompting the user to re-enter credentials. The attack requires no malware on the victim's machine — Claude itself becomes the execution engine.
The Claude Code /tmp path bug (patched)
On shared Linux systems (dev VMs, CI runners, containerised environments with multiple users), Claude Code versions prior to v2.1.128 wrote temporary working files to a predictable path under /tmp/claude-code-{uid}. A lower-privileged process that could observe or write to that path could inject content into Claude Code's context mid-session — a classic TOCTOU prompt-injection pattern. Claude Code v2.1.128 (released early November) randomises the temp directory per session. If you run shared infrastructure, verify every Claude Code instance is on v2.1.128 or later.
Open claude.ai → Settings → Personal Preferences and read every line. You should recognise every sentence as something you wrote. Any text you do not recognise should be deleted immediately. If you use a shared Anthropic account (team logins are not supported, but some teams do this informally), rotate the account password now and enable a hardware security key rather than relying on magic-link email login.
Five defensive measures you can apply right now
- Use a hardware security key (FIDO2/passkey) for your Anthropic account — magic-link login is the entry point for this attack. A hardware key eliminates that vector entirely.
- Audit Personal Preferences regularly — treat the field as a privileged config file, not a casual scratchpad. Keep a copy offline so you can diff it against what's in the UI.
- Restrict MCP tool scopes — in
claude_desktop_config.json, give each MCP server the narrowest filesystem and network permissions that still let it function. A tool scoped to~/projects/cannot exfiltrate your SSH keys even if Claude is instructed to try. - Keep Claude Code updated — the /tmp path fix is in v2.1.128+. Run
claude --versionand update if needed. - Run Claude Code as a dedicated OS user on shared machines — a dedicated user account with no access to other users' home directories contains any in-session compromise to that account's scope.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem",
"/Users/you/projects"], // ← scope to one directory
"env": {}
}
}
}
Restrict the filesystem MCP server to your project directory only. Any injected instruction attempting to read ~/.ssh/id_rsa will get a permission denied at the MCP layer, before Claude even sees a response.