Bash tool_result replaced by a concurrent session's assistant output (cross-session output bleed) — 2 documented occurrences

Status Fixed / completed
Reported on v2.1.220
Maintainer reply None cached
Activity 3 comments · opened Jul 30, 2026 · closed Aug 3, 2026

Environment

  • Claude Code CLI 2.1.220, macOS (darwin 25.6.0)
  • Multiple interactive sessions running in parallel in separate terminals (same user, different project directories) — a standard multi-clone workflow

Summary

Twice within a week, the assistant text of one running session materialized verbatim as the tool_result of a Bash call in a different session. The receiving session's command was a short wc -c on files in its own session scratchpad (/private/tmp/claude-<uid>/<project-hash>/<session-uuid>/scratchpad/). Instead of byte counts, the tool channel returned ~1.5–2.4k chars of coherent prose that session B had just generated as its normal assistant output — including references to session B's conversation history and action prompts addressed to its own user.

Both occurrences were verified afterwards from the two sessions' ~/.claude/projects/**/<session>.jsonl transcripts: the receiving side shows the text inside a regular tool_result block (is_error: false, matching tool_use_id), and the emitting side shows the identical text as an assistant/text block 4 seconds earlier in both cases.

The two occurrences

| | Case 1 | Case 2 |
|---|---|---|
| Date (UTC) | 2026-07-23 ~08:30 | 2026-07-30 ~06:27 |
| Victim command | wc -c <file1> <file2> (after cd into scratchpad) | pdftotext …; pdftotext …; wc -c … (only the wc output was replaced; the pdftotext outputs were fine) |
| Emitting session | long-running session in another project dir | same long-running session |
| Delta assistant-text → foreign tool_result | ~4 s | ~4 s |

Correlated anomalies (same command/path, same sessions)

  • Case 1: the first attempt of the identical wc -c call timed out after 2m (exit 143) with Warning: no stdin data received in 3s, proceeding without it… — a wrapper message, notable for a command that had file args and shouldn't read stdin. The retry (with < /dev/null) then received the foreign text.
  • Case 2: the next verification call after the bleed (ls + md5 + wc -c on the same files) hit the 120 s timeout and reported exit 1, while its output file contained the ls/md5 sections complete, cut off exactly before the wc section.

So all four anomalous events cluster on wc -c invocations over scratchpad paths while another session was actively generating output.

Why this matters

The foreign text arrives in the most-trusted channel a session has (its own tool results) and in both cases carried imperative content (trigger words for follow-up actions intended for the other session's user). Both receiving sessions correctly treated it as untrusted data, but this is effectively an unintended prompt-injection surface between concurrent sessions of the same user — and it initially presents as either a hook hijack or model confabulation, which costs real diagnosis time.

What it is not

  • Not file contents: the files involved were verified clean; the text existed only in the tool-result channel.
  • Not hooks: no PreToolUse/PostToolUse/Bash-wrapping hooks configured (only a Notification sound hook).
  • Not model confabulation on the receiving side: the text exists in the emitting session's transcript first, timestamped.

I can share redacted transcript excerpts (JSONL lines with timestamps/tool_use_ids) privately if useful — the full transcripts contain personal data I won't post publicly.

View original on GitHub ↗

3 Comments

kcarriedo · 2 months ago

This is a genuinely alarming report to read. Cross-session output bleed at the tool_result layer -- where a session's most trusted input channel gets overwritten with prose from a concurrent session -- is a different class of problem than most multi-session bugs, because the receiving session has no way to detect it from inside its own context. Both of your documented cases show the emitting session's text appearing with is_error: false and a matching tool_use_id, which means it passed every validity check the session could apply.

The 4-second delta between the emitting session's assistant text and the receiving session's tool_result, across both occurrences, suggests something deterministic rather than a race condition. The fact that all four anomalous events cluster on wc -c calls against scratchpad paths while another session was actively generating output is a strong enough pattern to reproduce from.

A few things worth including if you file the detailed report privately:

  • The session UUIDs of both sessions (not just "session A" and "session B") -- if they share any prefix pattern, that might help locate the dispatch routing.
  • Whether the scratchpad paths were under the same user's temp directory namespace, specifically whether /private/tmp/claude-<uid>/ used the same <uid> for both sessions.
  • Whether either session was using a shared MCP server (same process, different clients) -- a shared server with a mutable buffer is one candidate path for cross-session pollution.

The prompt-injection angle you flagged is real. Tool results arriving with imperative content from another session's context can influence planning even if the receiving agent treats the content as "untrusted data" -- most agents do not have an explicit skepticism mode for their own tool channels.

Worth opening a security-track issue or emailing security@anthropic.com if you have not already, given the prompt-injection surface.

sparkparkdigital · 2 months ago

Correction: my environment, not a Claude Code bug. Closing.

~/.zshrc, line 30:

wc() { cd "/Users/dustinlundt/Desktop/Waerrk Clones/Waerrk-curator" && claude "$@"; }
wc is a shell function here that launches claude with the arguments passed straight through. So wc -c <path> never counted bytes — it started a session, and that session's text came back as the genuine stdout of the command. That explains is_error: false, the matching tool_use_id, and the deterministic ~4s delta: process startup, not dispatch. wc is the only one of these shortcuts that shadows a real binary, which is why all four events sat on it.

No cross-session channel was involved, so the session-UUID, temp-directory and shared-MCP questions are moot — and the prompt-injection concern goes with them. Nothing to route to security@; sorry for the false alarm.

Thanks @kcarriedo for the questions that sent me to look at the shell rather than the dispatcher.

github-actions[bot] · 20 days ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.