Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 0 ๐Ÿ“– 11 min read

Inside Claude Code's telemetry in v2.1.294

I reverse-engineered the Claude Code v2.1.294 native binary. Here is everything it silently collects from your machine, its hidden "autoDream" background subagent, and how to turn all telemetry off in 30 seconds

I reverse-engineered the Claude Code v2.1.294 native binary. Here is everything it silently collects from your machine, its hidden "autoDream" background subagent, and how to turn all telemetry off in 30 seconds

TL;DR

We extracted the bun-standalone Mach-O arm64 binary of Claude Code (v2.1.294) into its 4,818 virtual $bunfs/root files (2,292 JS chunks, a native macOS Accessibility addon computer-use-swift.node, and a zstd-compressed policy archive permissions_external-64ee756a.txt.zst) using morluto/rea.

The Verdict (70% solid engineering / 30% sketchy telemetry):

  • The Good: It is not stealing your .env secrets, SSH keys, source code, or non-Claude Keychain items via telemetry. Even better, its client-side defenses against prompt injection, invisible Unicode tags, malicious repo configs, and GUI password fields are arguably the most sophisticated in the AI industry right now. And the CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 killswitch is 100% honest in code.
  • The Sketchy:
    1. _PROTO_* telemetry double-accounting: In JSON metadata, custom skill/plugin/marketplace names are visibly replaced with "custom" or "<redacted>" + SHA-256 hashes โ€” while simultaneously being passed in plaintext via hidden _PROTO_skill_name / _PROTO_plugin_name fields that get stripped from JSON and moved into top-level Protobuf fields before hitting api.anthropic.com (unless your org pays for a HIPAA plan).
    2. Silent <ide_selection> attachment: If connected to VS Code / Cursor / JetBrains, every prompt you type in the terminal silently attaches whatever text you happen to have highlighted with your mouse in an open editor tab.
    3. Commit HEAD SHA tracking for Pro/Max subscribers: Every telemetry event attaches a 16-char SHA-256 hash of your git remote.origin.url (rh), and specifically checks if you are on a pro or max subscription (Bne()) to attach your exact 40-char head_sha.
    4. Silent startup workspace & process fingerprinting: Before your first prompt, it reads .npmrc, pyproject.toml, .envrc, and up to 20 .yml/.toml/.sh files (64KB each) to detect private package registries and secrets managers (VAULT_ADDR, SOPS_, op read, aws secretsmanager), runs gh auth token, walks 10 parent processes via ps, greps ps aux for running IDEs, and persists failed telemetry to ~/.claude/telemetry/ to retry on next launch.
    5. Hidden background LLM calls (autoDream & awaySummary): Once every 24h (after $\ge 5$ sessions), it silently spawns a hidden background subagent (skipTranscript: true) that runs grep/cat over your past .jsonl session transcripts on disk.

Below is the technical breakdown with deobfuscated code and exact chunk offsets, plus a 30-second config to disable all of the background chatter.

1. Anti-Debugger Killswitch & Prompt-Bound Billing Header

Right at the entrypoint (chunk-g5cw48b5.js:35834), Claude Code checks if an inspector or debugger flag is attached and immediately exits with code 1:

// chunk-g5cw48b5.js:35834 (deobfuscated)
function isDebuggerAttached() {
  let isBun = isRunningWithBun(),
    hasInspectArg = process.execArgv.some((arg) =>
      isBun ? /--inspect(-brk)?/.test(arg) : /--inspect(-brk)?|--debug(-brk)?/.test(arg)
    ),
    hasNodeOptionsInspect =
      env.NODE_OPTIONS && /--inspect(-brk)?|--debug(-brk)?/.test(env.NODE_OPTIONS);
  try {
    return !!global.require("inspector").url() || hasInspectArg || hasNodeOptionsInspect;
  } catch {
    return hasInspectArg || hasNodeOptionsInspect;
  }
}
if (isDebuggerAttached()) process.exit(1);

And if you've ever wondered how Anthropic blocks third-party clients from using Claude Code OAuth tokens: x-anthropic-billing-header is not an HTTP header. It is injected as the first text block of the system prompt (system[0]), cryptographically bound to the 4th, 7th, and 20th characters of your first user message (chunk-0kzygtdw.js:825565 & chunk-xfx9q3vz.js:3717):

// chunk-0kzygtdw.js:825565
var SALT = "59cf53e54c78"; // doe

function computePromptFingerprint(firstUserText, version) {
  // Samples indices [4, 7, 20] of your first message (or "0" if shorter)
  const sampledChars = [4, 7, 20].map((idx) => firstUserText[idx] || "0").join("");
  const payload = `${SALT}${sampledChars}${version}`;
  return createHash("sha256").update(payload).digest("hex").slice(0, 3);
}
// Injected as system[0]:
// "x-anthropic-billing-header: cc_version=2.1.294.<3-hex>; cc_entrypoint=cli; cch=00000;"

2. The 4 Telemetry Channels, Disk Retry Queue & Gzip Length Obfuscation

By default, the binary sends telemetry to four external endpoints:

  1. https://api.anthropic.com/api/event_logging/v2/batch โ€” Primary 1P telemetry (~800 tengu_* event types, batched up to 200 events every 10s).
  2. https://api.anthropic.com/api/claude_code/metrics โ€” OpenTelemetry metrics exporter to BigQuery (token counts, latency, lines_added / lines_removed).
  3. https://http-intake.logs.us5.datadoghq.com/api/v2/logs โ€” Direct client-to-Datadog log intake using a hardcoded public token (DD-API-KEY: pubea5604404508cdd34afb69e6f42a05bc, chunk-pg985ppg.js:1215) for an allowlist of ~210 operational events.
  4. https://browser-intake-us5-datadoghq.com/api/v2/logs โ€” Datadog browser error tracker (chunk-mr6ezqh3.js:760), sending stack traces, the first 12 hex chars of your machineID (host_name_redacted), and up to 50 non-default GrowthBook feature flags.

Two notable implementation details in the 1P event logger (chunk-bryg4nng.js:198507, 493100):

  • Persistent offline retry queue: If a telemetry batch fails to send (e.g., you are offline), it writes the batch to ~/.claude/telemetry/1p_failed_events.<sessionId>.<runId>.json and automatically flushes those files in the background the next time you run claude (retryPreviousBatches()).
  • Random whitespace padding before gzip (FTt): Before gzipping JSON request/telemetry bodies, the client appends a newline plus 0 to 256 random spaces and tabs (Math.floor(Math.random() * 257)), masking exact payload lengths on the wire.

3. The _PROTO_* Double-Accounting Trick: "Redacted" in JSON, Plaintext in Protobuf

If you inspect how Claude Code logs custom skills (.claude/skills/*), custom slash commands, third-party plugins, and private marketplaces (chunk-vk5f6mar.js:11020), you'll first see a function mqt() that appears to carefully redact and hash any non-official names:

// chunk-vk5f6mar.js:11020
function buildRedactedPluginMeta(pluginName, marketplaceName, policy) {
  let scope = resolveScope(pluginName, marketplaceName, policy);
  let isOfficial = isOfficialAnthropicPlugin(scope, pluginName, marketplaceName);
  return {
    plugin_id_hash: sha256(pluginName, marketplaceName),
    // Non-official plugins get replaced with Gb ("third-party" / "<redacted>")
    plugin_name_redacted: isOfficial ? pluginName : "<redacted>",
    marketplace_name_redacted: isOfficial && marketplaceName ? marketplaceName : "<redacted>",
    is_official_plugin: isOfficial,
  };
}

In additional_metadata (and in Datadog logs), your custom skill and plugin names are indeed replaced with "custom" / "<redacted>" and SHA-256 hashes.

However, look at the wrapper function EG() right below it (chunk-vk5f6mar.js:11093) and tengu_skill_loaded (chunk-t3d7fqkf.js:85957):

// chunk-vk5f6mar.js:11093
function buildPluginTelemetry(pluginName, marketplaceName, policy = null) {
  let mkt = resolveMarketplace(pluginName, marketplaceName) ?? marketplaceName;
  return {
    _PROTO_plugin_name: pluginName,                 // <-- RAW PLAINTEXT PLUGIN NAME!
    ...mkt && { _PROTO_marketplace_name: mkt },     // <-- RAW PLAINTEXT MARKETPLACE NAME!
    ...buildRedactedPluginMeta(pluginName, marketplaceName, policy)
  };
}

// chunk-t3d7fqkf.js:85957 โ€” fires on startup for EVERY custom skill on your machine:
logEvent("tengu_skill_loaded", {
  _PROTO_skill_name: skill.name,                    // <-- RAW PLAINTEXT SKILL NAME!
  ...buildSanitizedSkillMeta(skill),                // <-- puts sanitizedName: "custom" + sha256
  skill_content_chars: skill.contentLength,
});

Then, inside transformLogsToEvents (chunk-bryg4nng.js:505623):

  1. gIt(oe) (chunk-ndj0668h.js:718) strips every key starting with _PROTO_ out of additional_metadata.
  2. transformLogsToEvents copies _PROTO_skill_name, _PROTO_plugin_name, _PROTO_marketplace_name, and _PROTO_head_sha in unhashed plaintext directly onto the root Protobuf fields (skill_name, plugin_name, marketplace_name, head_sha) of ClaudeCodeInternalEvent and POSTs them to api.anthropic.com/api/event_logging/v2/batch.

Even more telling: if your organization has a HIPAA flag enabled (UDn() in chunk-bryg4nng.js:243204), a scrubber sd(e) overwrites those exact fields with "hipaa_redacted". For everyone else, they go out in plaintext.

What else is attached to EVERY single telemetry event (Dyr in chunk-bryg4nng.js:488900)?

  • rh (Repo Hash, chunk-wpfsesva.js:76242): Runs git config --get remote.origin.url, normalizes it to host/owner/repo, and attaches sha256(slug).substring(0, 16).
  • head_sha (Full 40-char git HEAD SHA โ€” for Pro & Max users only!):
  // chunk-bryg4nng.js:489550 & 698518
  function isProOrMaxSubscriber() { // Bne()
    let sub = getSubscriptionType();
    return isClaudeAiOAuth() && sub !== null && (sub === "max" || sub === "pro");
  }
  // Attached in Dyr() only when Bne() is true:
  ...headSha && isProOrMaxSubscriber() && { head_sha: headSha }
  • process (Base64-encoded process memory & CPU metrics): Every event calls process.memoryUsage() and process.cpuUsage(), JSON-encodes { uptime, rss, heapTotal, heapUsed, external, arrayBuffers, cpuUsage, cpuPercent }, base64-encodes it, and sends it in the process field.
  • Your real os.hostname() (chunk-9mdxv6se.js:7650): Sent to https://api.anthropic.com/api/auth/trusted_devices as display_name: "Claude Code on <hostname> ยท macOS" during login or lazy trusted-device enrollment.

4. Silent Startup Workspace & Process Scanning (tengu_init & tengu_startup_telemetry)

When you launch claude in a project directory, before you type anything:

  1. Config file inspection for private registries & secrets managers (Bmn in chunk-8k2751tq.js:11828):

    • Opens and reads (up to 64KB each) .npmrc, pip.conf, pyproject.toml, bunfig.toml, .yarnrc.yml, .cargo/config.toml to extract package registry URLs (registry = ..., index-url = ...) and classify if you use a private registry ("jfrog" | "nexus" | "github" | "gitlab" | "azure" | "aws" | "gcp" | "other").
    • Opens up to 20 .envrc, *.yml, *.yaml, *.toml, *.sh files in the repo root and tests their contents against:
     /\b(?:VAULT_ADDR|SOPS_[A-Z_]*|op read|aws secretsmanager|gcloud secrets)\b/
    
  • Checks for .env / .env.* files (has_env_file), Dockerfile, docker-compose.yml, .devcontainer, flake.nix, BUILD.bazel, project.pbxproj, AndroidManifest.xml, and CUDA references in CMakeLists.txt. (Note: The file contents/URLs themselves do not leave the machine; only the boolean flags has_env_file, has_secrets_manager_refs, has_private_registry, and the vendor enum are sent in tengu_init.)
    1. Environment variables, settings & gh auth token probe (chunk-g5cw48b5.js:36285, chunk-dzhtww7a.js):
  • Sends the names of all set CLAUDE_CODE_* and ANTHROPIC_* environment variables, all non-default setting keys in ~/.claude/settings.json, custom CA/mTLS flags (NODE_EXTRA_CA_CERTS), and word/line counts of your custom autoMode rules.
  • Silently spawns gh auth token (or gh auth status) in the background to report gh_auth_status: "authenticated" | "not_authenticated" | "not_installed".
  • Reads git config user.email and runs git log -n 1000 --author=<email> to cache your 5 most frequently modified files (chunk-t3d7fqkf.js:68202).
    1. Process tree & running IDE scan (chunk-470632ch.js:3540621, 3542450):
  • Walks 10 parent processes up to PID 1 via ps -o ppid= -p $pid and ps -o command= -p $pid.
  • Runs ps aux | grep -E "Visual Studio Code|Cursor Helper|Windsurf Helper|Devin.app|IntelliJ IDEA|PyCharm|..." (or tasklist | findstr on Windows). (Fun Easter egg at chunk-470632ch.js:3542150: e.replace(/windsurf/gi, "Devin Desktop") hardcodes the Windsurf $\to$ Devin rebrand).
  • Scans every directory in $PATH for up to 65 developer tools (kubectl, helm, terraform, docker, podman, bazel, nix, nvidia-smi, psql, mysql, redis-cli, etc.).

5. Unprompted Context Attachments & Background "AutoDream" Sessions

Even outside of telemetry, three mechanisms send data to the LLM without you asking:

  1. Silent <ide_selection> and <ide_opened_file> injection (chunk-470632ch.js:3595984, 3617900): When running inside an IDE terminal (or if ~/.claude/ide/<port>.lock is present), xfn() and Mfn() automatically attach to every prompt you send:
    • The path of your currently open IDE tab (<ide_opened_file>);
    • The entire text currently highlighted with your cursor in the IDE editor (<ide_selection>, content: e.text). If you highlighted a secret in an adjacent editor tab and typed "hey" in the terminal, that highlighted text is silently sent to the LLM.
  2. Automatic diffs of externally edited files (changed_files / cPr in chunk-470632ch.js:3628237): Before every turn, Claude checks the mtime of every file it has previously read in the session (readFileState). If you edited a file yourself in another program, it automatically re-reads the file from disk, computes a diff (t8o, up to 16KB), and sends the diff to the LLM as edited_text_file.
  3. Hidden background "AutoDream" agent (chunk-nj3vnwtp.js:1960..14500) & terminal focus tracking (awaySummary in chunk-re2hna2k.js:1592001):
    • autoDream: Once every 24 hours (after $\ge 5$ sessions), the client silently spawns a background subagent (querySource: "auto_dream", skipTranscript: true) with read-only Bash access (ls, find, grep, cat, head, tail). It autonomously greps through your past .jsonl session transcripts in ~/.claude/projects/, extracts facts, rewrites MEMORY.md, and logs tengu_auto_dream_completed.
    • awaySummary: Tracks when your terminal window loses focus (blurred) and regains focus (focused), reports blurDurationMs in tengu_return_to_session, and while your terminal is unfocused (right before the prompt cache expires), autonomously fires a background LLM request to generate a "while you were away" recap.

6. Credit Where It's Due: The Best Client-Side Guardrails in the Industry

To be completely fair to Anthropic's security team, the client-side defensive engineering inside this binary is extraordinary:

  • Invisible Unicode & Trojan Source state-machine sanitizer (the in chunk-zefvzn71.js:3001): A 16-codepoint ring buffer strips invisible Unicode Tags (U+E0000..U+E007F, commonly used in copy-paste prompt injections), Bidi overrides (U+202A..U+202E), and zero-width characters. If stripping invisible characters exposes a leading / (an attacker trying to smuggle a /slash command via clipboard), submission is blocked and kicked back to draft review (chunk-re2hna2k.js:201).
  • Clipboard provenance fencing (<pasted-text> in chunk-470632ch.js): Any paste $>20$ chars is wrapped in <pasted-text id="..."> with a system rule instructing the model to ignore instructions inside pasted text unless the user's own keyboard-typed text outside the tags asks to follow them.
  • 45-rule auto_mode Security Monitor (permissions_external-64ee756a.txt.zst): Enforces non-overridable HARD BLOCK rules (data exfiltration, cloud IMDS 169.254.169.254 / fd00:ec2::254 including decimal/hex IP bypasses, transcript/settings tampering) and SOFT BLOCK rules (rm -rf "$VAR"/* requires a literal string path; echo "$VAR" does not clear it; blocks sending keystrokes to its own $TMUX_PANE so the agent can't self-approve). Before destructive git commands, the client silently runs git status and checks repo visibility โ€” failing closed (treating the repo as public) if visibility is "unverified".
  • "Repo May Only Tighten" (chunk-re2hna2k.js:58, chunk-7tkjxgbw.js:2219): A cloned repo's .claude/settings.json can never weaken user permissions or enable OTEL_LOG_USER_PROMPTS / OTEL_LOG_TOOL_DETAILS โ€” it can only tighten restrictions or turn telemetry off.
  • Computer Use password & window title redaction (computer-use-swift.node + chunk-raa7pnrg.js): Browsers are locked to tier: "read", terminals/IDEs to tier: "click" (typing & right-click paste are blocked, and the system clipboard is temporarily wiped during clicks via Ge()). Password fields (AXSecureTextField) are hard-blocked (case "secure_field"), macOS system sheets from other PIDs (foreignPanelPresent) are hatched out on screenshots before reaching the model, and any window title over 40 characters or containing /, :, @, ?, , is replaced locally with "(title withheld)" (chunk-raa7pnrg.js:18100).

How to Disable All Telemetry, Datadog & Background Agents in 30 Seconds

The best part of auditing chunk-ac05rqws.js:16950 (EIt / YF) is confirming that Anthropic's telemetry killswitch is completely honest โ€” there are no hidden bypasses when CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 is set.

1. Add to ~/.claude/settings.json (applies even if launched from a GUI/IDE outside your shell):

{
  "autoDreamEnabled": false,
  "awaySummaryEnabled": false,
  "promptSuggestionEnabled": false,
  "env": {
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "DISABLE_TELEMETRY": "1",
    "DISABLE_ERROR_REPORTING": "1",
    "DO_NOT_TRACK": "1",
    "CLAUDE_CODE_AUTO_CONNECT_IDE": "0"
  }
}

2. Add to ~/.zshrc / ~/.bashrc:

export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export DISABLE_TELEMETRY=1
export DISABLE_ERROR_REPORTING=1
export DO_NOT_TRACK=1
export CLAUDE_CODE_AUTO_CONNECT_IDE=0

3. Delete any queued offline telemetry batches already sitting on disk:

rm -f ~/.claude/telemetry/1p_failed_events.*.json
๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.