# MCP line jumping: attack before first tool use

- ID: trailofbits-mcp-line-jumping-2025-04
- Reported: 2025-04-21
- Researcher: Trail of Bits
- Organization: Trail of Bits
- AI role: ai_agent_or_mcp_as_target (Agent / MCP as target)
- Confidence in AI involvement: not assessed
- Research / borderline: false
- Last reviewed: 2026-10-20
- Entry page: https://openattacks.ai/attacks/trailofbits-mcp-line-jumping-2025-04/
- Entry JSON: https://openattacks.ai/api/attacks/trailofbits-mcp-line-jumping-2025-04.json
- Browse title: MCP line jumping: attacks before the first tool use
- Editorial summary: Research showed malicious MCP tool descriptions can inject instructions before any tool runs, enabling code execution, data theft and approval bypass.
- Evidence class (catalog annotation): Research demonstration
- Source-stated target environments: Agents & MCP
- Stage hunts and conditional defenses: https://openattacks.ai/api/defenses/trailofbits-mcp-line-jumping-2025-04.json

## Technique
Malicious MCP servers inject via tool descriptions before any tool is invoked ('line jumping'), enabling code execution/exfil and approval bypass. Follow-up showed conversation-history theft paths and ANSI escape deception in tool UX.

## Stack relevance (editorial)
Assessment: mapped. Editorial applicability reviewed against the catalog source account; not a scan or independent incident verification.
First action: Review server descriptions before connection and minimize tool and data access before approval.
- Relationship: workflow; tools: no specific product; OS scope: not OS-specific / not stated; requires existing MCP connections: true.
  Relevance: The research places malicious instructions in MCP descriptions before a tool is invoked.
  Condition to check: Review the connected server, model / client behavior and the permissions exercised by the demonstration.
  Evidence: https://blog.trailofbits.com/2025/04/21/jumping-the-line-how-mcp-servers-can-attack-you-before-you-ever-use-them/ ; https://blog.trailofbits.com/2025/04/23/how-mcp-servers-can-steal-your-conversation-history/
A product mention alone is not a victim-side applicability mapping. Selection does not verify affected versions, permissions or compromise.

## Initial access
unknown

## AI tooling and models
- MCP servers/clients

## Other tooling
- unknown

## Victims and sectors
unknown

## Target geography
- unknown

## Attribution
unknown

## Scale and metrics
unknown

## Attack flow
Catalog reconstruction of the supplied source account. Unknowns and research caveats are preserved.
### step-1: Connection route is unspecified [unknown]
The supplied record starts with a malicious MCP server available to the agent.
Evidence: https://blog.trailofbits.com/2025/04/21/jumping-the-line-how-mcp-servers-can-attack-you-before-you-ever-use-them/ ; https://blog.trailofbits.com/2025/04/23/how-mcp-servers-can-steal-your-conversation-history/

### step-2: Tool descriptions enter model context [access]
The attack content is ingested before the first tool use.
Evidence: https://blog.trailofbits.com/2025/04/21/jumping-the-line-how-mcp-servers-can-attack-you-before-you-ever-use-them/ ; https://blog.trailofbits.com/2025/04/23/how-mcp-servers-can-steal-your-conversation-history/

### step-3: Injected instructions jump the approval boundary [ai]
The model can be redirected without an initial explicit tool invocation.
Evidence: https://blog.trailofbits.com/2025/04/21/jumping-the-line-how-mcp-servers-can-attack-you-before-you-ever-use-them/ ; https://blog.trailofbits.com/2025/04/23/how-mcp-servers-can-steal-your-conversation-history/

### step-4: Demonstrated execution or exfiltration [impact]
The research describes approval bypass and conversation-history theft paths.
Evidence: https://blog.trailofbits.com/2025/04/21/jumping-the-line-how-mcp-servers-can-attack-you-before-you-ever-use-them/ ; https://blog.trailofbits.com/2025/04/23/how-mcp-servers-can-steal-your-conversation-history/

Connections:
- step-1 -> step-2
- step-2 -> step-3
- step-3 -> step-4

## Stage defense and hunting recommendations
Editorial recommendations, not validated coverage. Source-controlled query starters are drafts. Custom-schema examples require telemetry collection and field mapping; absence of a mapping means not assessed. MagicSword policy opportunities require managed Windows scope and enforcement.
### step-1: No source-backed runtime hunt yet
- Visibility: Not established
- Query origin: catalog_authored; status: not_applicable; log scope: gap
- Hunt hypothesis: The supplied account does not establish a deployed victim-side behavior for this stage.
- Required telemetry: not assessed
- Investigate: Obtain a source-backed procedure and identify which party could observe it before drafting a detection.
- Limitation: Marketing claims, unknown steps and unconfirmed deployments are not detection coverage. No rule is generated for this stage.
- Qualification: The supplied account leaves this stage unestablished. Obtain a source-backed procedure before proposing a runtime query.
- No direct MagicSword prevention claim is recorded for this stage.

### step-2: Unexpected agent tool use
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/agent-tools.sigma.yml
- KQL query download: /api/detections/agent-tools.kql
- SPL query download: /api/detections/agent-tools.spl
- Hunt hypothesis: Untrusted content or a changed tool definition precedes a file read, command, or remote call outside the user's intended task.
- Required telemetry: Agent tool-call audit records with session / tool / destination; Tool-definition and approval changes; Endpoint process, file-access and network evidence where available
- Investigate: Join input provenance, tool descriptions and calls by session ID and compare the action to the approved task.
- Investigate: Inspect child processes and destinations; record whether execution was in-process, local, or through a remote SaaS connector.
- Limitation: Process logs cannot recover model intent. Remote connectors and in-process interpreters may produce no local child process. Prompt content alone is not a reliable signature.
- No direct MagicSword prevention claim is recorded for this stage.
- Community intelligence: LOLSkills — https://lolskills.io

### step-3: Unexpected agent tool use
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/agent-tools.sigma.yml
- KQL query download: /api/detections/agent-tools.kql
- SPL query download: /api/detections/agent-tools.spl
- Hunt hypothesis: Untrusted content or a changed tool definition precedes a file read, command, or remote call outside the user's intended task.
- Required telemetry: Agent tool-call audit records with session / tool / destination; Tool-definition and approval changes; Endpoint process, file-access and network evidence where available
- Investigate: Join input provenance, tool descriptions and calls by session ID and compare the action to the approved task.
- Investigate: Inspect child processes and destinations; record whether execution was in-process, local, or through a remote SaaS connector.
- Limitation: Process logs cannot recover model intent. Remote connectors and in-process interpreters may produce no local child process. Prompt content alone is not a reliable signature.
- No direct MagicSword prevention claim is recorded for this stage.

### step-4: Sensitive data → unusual destination
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/exfil.sigma.yml
- KQL query download: /api/detections/exfil.kql
- SPL query download: /api/detections/exfil.spl
- Hunt hypothesis: Sensitive reads are followed by outbound transfer, a public artifact, or a tool call to a destination outside the approved workflow.
- Required telemetry: Sensitive resource access / DLP records; Proxy, egress and cloud upload events; Agent / SaaS audit with correlation IDs
- Investigate: Join the resource read and outbound action by session, identity or process, preserving a bounded time window.
- Investigate: Inspect destination ownership, payload classification and the user's intended action; baseline sanctioned sharing.
- Limitation: An outbound connection or high byte count alone is not exfiltration. Encrypted traffic may hide content, and bulk legitimate exports are common.
- No direct MagicSword prevention claim is recorded for this stage.


## MITRE ATLAS
Mappings are catalog annotations based on described behavior, not assignments or endorsements by MITRE.
No source-backed mapping is currently recorded.

## Defensive notes
TOFU pinning (mcp-context-protector); sanitize ANSI; never auto-trust tool metadata

## Sources
- https://blog.trailofbits.com/2025/04/21/jumping-the-line-how-mcp-servers-can-attack-you-before-you-ever-use-them/
- https://blog.trailofbits.com/2025/04/23/how-mcp-servers-can-steal-your-conversation-history/
