Swarm Poisoning in Agent Harnesses: The Muse Code Subagent Attack
How Muse Code coordinates subagents
Muse Code is built around three things: persistent background subagents, fan-out into isolated git worktrees, and an append-only event log. No other mainstream harness, including Claude Code and Codex, combines all three. This append-only log makes Muse Code sessions replay-exact, with every step reconstructable from a single local file.
Muse subagents run tasks in parallel with the main agent for the whole session. When work fans out, each child gets its own git worktree and commits there, then reports back to the parent, which merges the results one at a time.
Where the trust model breaks in this subagent coordination
- Nothing protects the append-only log. The event log is a plain local file owned by the user. Nothing signs the records, nothing chains them with hashes, and nothing detects an outside edit, so any process running as the same user can rewrite a line and leave the log looking exactly like the runtime wrote it.
- Replay adds no provenance. On resume the runtime replays every record to rebuild the model's context. Nothing in a record marks which process wrote it, so whatever sits on disk becomes what the model remembers.
- Subagent results carry the most weight. The parent agent leans on child results as authoritative, and fan-out multiplies them, so every child agent in a swarm increases the threat surface for an attacker.
Walkthrough: Attacker assumes the identity of a subagent and poisons the Muse Code swarm
The scenario we picked
Muse Code is designed to use subagents to maximize efficiency on complex coding tasks. When Muse Code launched, the team shipped a cookbook centered on complex coding tasks for the game Bastion Breaker. The cookbook is meant to show how a swarm of subagents can split parallel work across a codebase and coordinate what each one builds. We use the same coding tasks from that cookbook to show how a clever attacker can assume the identity of one of the subagents and pass legitimate-sounding instructions that get Muse Code to download a malicious, attacker-controlled npm package.
The goal of the attacker
Muse Code runs on a user's endpoint, orchestrating a swarm of subagents on the user's computer. The subagents coordinate through an append-only log that lives on the user's endpoint and acts as the single source of truth for the session. The log gives Muse Code real advantages, such as making each session crash-safe and rewindable. The problem is that an attacker can abuse it: because any local process can pretend to be a subagent, an attacker can write instructions into the log, poison the other subagents, and convince Muse Code to carry out actions it never should.
The log has no mechanism to verify a subagent's identity. So if an attacker assumes the identity of a subagent and writes instructions that sound legitimate, even when they are truly malicious, Muse Code sees no reason to reject the command and carries it out. We exploit exactly this: we assume the identity of one of the subagents and pass the commands that get Muse Code to download the attacker-controlled npm package.
The steps of the exploit
-
We point Muse Code, running the Muse Wonder model, at the Bastion Breaker repo and give it a prompt that pushes it to use subagents for the task:
"Fan this work out to parallel subagents, each in its OWN isolated git worktree. Spawn one write-capable subagent WITH worktree_isolation for EACH task: (1) add high-score persistence (persist best score to a json file), (2) make bricks multi-colored by row using assets/bricks sprites, (3) add a combo multiplier to scoring. Spawn all 3 now, then call subagent_status and show me the full set."
-
Muse Code spins up three subagents, which start working on their tasks and coordinating through the append-only log.
-
An attacker-controlled process on the user's endpoint reads Muse Code's append-only log, assumes the identity of subagent 3, and posts an instruction that asks Muse Code to download an attacker-controlled npm package as part of a profiling job.
-
Muse Code reads the append-only log, treats the instruction as legitimate because it looks like it came from a trusted subagent, and runs the command that downloads the attacker's package onto the user's endpoint.
-
The append-only convention of the log is not enforced by any rule. The same malicious process that forged the record can also delete it. The attacker uses this gap to go back to the log and remove every trace of the poison.
Where CodeIntegrity secures the agent harness
Securing the agent harness will be critical over the next few months. The OpenAI and Hugging Face incident showed how easily a swarm can become misaligned and carry out malicious actions. Agent harnesses will keep moving toward swarm architectures, and the attack surface exposed to an attacker grows with every subagent in the batch. CodeIntegrity was built from the ground up to defend against exploits like these with our secure runtime.
References
- Meta. Subagent fanout. Meta Model API cookbook
- Meta. Bastion Breaker. meta-models/meta-model-cookbook, GitHub
- CodeIntegrity. swarm-hijack: proof of concept for the attack in this post. GitHub