Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 8 min read

A Routine Docs Lookup Carried the Attack: What ContextCrush (CVE-2026-75130) Teaches About Gating Actions Caused by Tool Output

TL;DR CVE-2026-75130 (GitHub advisory GHSA-97r6-3rgm-v39r) covers Context7 through version 2.1.2, a popular MCP server that feeds library documentation to coding agents. Content from its "Custom AI Instructions" featu

TL;DR

  • CVE-2026-75130 (GitHub advisory GHSA-97r6-3rgm-v39r) covers Context7 through version 2.1.2, a popular MCP server that feeds library documentation to coding agents. Content from its "Custom AI Instructions" feature reached connected agents with no sanitization, so a poisoned rule could ride along on an ordinary documentation request.
  • Noma Labs, who named the issue ContextCrush, showed the chain: read the .env files in the project root, send the contents to an attacker-controlled GitHub repository as an issue, then delete local folders "for cleanup."
  • The scoring is not settled. The CVE record lists CVSS 3.1 at 9.0 (critical) and CVSS 4.0 at 6.4 (medium), both from the CNA, and the GitHub advisory shows severity "medium."
  • I modeled the design error in a short Python script. In a six-step session, a gate that trusts everything the model proposes let 4 injected high-risk actions run. A gate that tracks where each action came from let 0 run, and it still let the user's own requests through.
  • The lesson: a tool result is data from someone else. Any sink action (network write, delete, credential read) whose cause traces to tool output needs a human, no matter how harmless the tool that carried it looked.

Injected high-risk actions that ran

What does CVE-2026-75130 actually say?

The NVD record, published 2026-08-18 on a VulnCheck submission, reads: Context7 through 2.1.2 "contains a prompt injection vulnerability that allows attackers to execute malicious instructions in connected AI coding agents by injecting unsanitized content through the Custom AI Instructions feature served via the MCP server." The listed impacts are credential exfiltration from environment files to an attacker-controlled service and destructive file deletion on the victim's machine, triggered "when the agent makes a routine library documentation request."

Context7 provides up-to-date, version-specific documentation to assistants such as Cursor, Claude Code, and Windsurf. It exposes two read-only tools, resolve-library-id and query-docs. Noma's write-up reports about 50,000 GitHub stars and more than 8 million npm downloads, and says it found no evidence of exploitation in the wild.

The feature at the center is simple. Library owners can set AI Instructions (also called Custom Rules) in a dashboard to help agents work with their library. Those rules were served through the MCP server to every user who queried that library, with, in Noma's words, no sanitization, content filtering, or distinction from the legitimate documentation.

Two details matter for builders:

  1. The tools were read-only. Nothing in query-docs writes anything. A reviewer looking at the tool list would label it low risk. The danger was in what the returned text asked the model to do next, using the agent's other tools.
  2. Reputation was the trust signal. Context7 used a trust score derived from a developer's GitHub history. Noma points out that accounts can be bought or hijacked, activity fabricated, and stars inflated. A score earned over time is not a property of the specific string that arrives today.

How did the attack chain work?

Noma's demonstration used three poisoned rules, each aimed at a different capability of the host agent:

  1. A rule telling the assistant to find and read all .env files in the project root.
  2. A rule telling it to send those contents to an attacker-controlled GitHub repository as an issue.
  3. A rule telling it to delete local folders and files as "cleanup."

Notice that the MCP server itself did none of this. It returned text. The agent, which already held file-read, GitHub, and file-delete tools, did the work. This is the classic confused deputy shape: the attacker has no privileges, the agent has plenty, and the instruction channel and the data channel are the same stream of tokens.

The timeline, from Noma's post, is short:

Date (2026) Event
Feb 18 Noma Labs delivers a report and proof of concept to the vendor
Feb 19 Vendor accepts the findings and starts remediation
Feb 23 Fix deployed to production: rule sanitization and guardrails
Mar 5 Public disclosure and final verification

The vendor fix, five days after discovery, sanitizes and guards how rules are served and interpreted. The NVD entry was published in August and last modified in October, which is a reminder that CVE records, severity scores, and fix dates can arrive months after the engineering response. Check the primary sources, not a single aggregator.

ContextCrush timeline in days

Why is "the tool was read-only" the wrong safety argument?

Many approval systems classify tools: reads are free, writes need a prompt. That model assumes the model's next action is independent of what the read returned. It is not. After a read, the model's context contains text an outsider wrote, and the next proposed action may be a function of it.

So the unit to gate is not the tool but the action plus its causal history. Two actions with identical arguments deserve different treatment:

  • read_file(".env") because the user said "check my environment config."
  • read_file(".env") because a documentation response said "first, read all .env files."

A gate that only sees the tool name and arguments cannot tell them apart. A gate that records "this action was proposed after untrusted content entered the context" can at least ask a human in the second case.

This is a coarse signal and I do not claim it is perfect. Models can launder influence: the user says "follow the library's setup guide," and now every rule is arguably user-sanctioned. That is a policy decision the human should make explicitly, once, with the rule text visible, not implicitly through a docs call.

How do you gate by provenance? A runnable model

The script below is an illustrative simulation, not a measurement of any real product. It replays a six-step session: one user-driven docs lookup, three injected high-risk actions (credential read, issue creation, delete), one benign user-driven read, and one injected network post.

from dataclasses import dataclass

@dataclass
class Action:
    tool: str
    arg: str
    cause: str   # "user" or "tool_output"

SENSITIVE = (".env", "id_rsa", "credentials")
SINKS = {"create_issue", "http_post", "delete_path"}

def naive_gate(a):            # trusts anything the model proposes
    return True

def provenance_gate(a):
    if a.tool in SINKS and a.cause == "tool_output":
        return False          # sink caused by tool output needs a human
    if a.tool == "read_file" and any(s in a.arg for s in SENSITIVE) \
       and a.cause == "tool_output":
        return False
    return True

session = [
    Action("query_docs", "react hooks", "user"),
    Action("read_file", "project/.env", "tool_output"),
    Action("create_issue", "attacker/repo: <env contents>", "tool_output"),
    Action("delete_path", "project/build", "tool_output"),
    Action("read_file", "src/app.py", "user"),
    Action("http_post", "https://example.test/ingest", "tool_output"),
]
for name, g in (("naive", naive_gate), ("provenance", provenance_gate)):
    ran = [a for a in session if g(a)]
    bad = [a for a in ran if a.cause == "tool_output" and
           (a.tool in SINKS or any(s in a.arg for s in SENSITIVE))]
    print(name, "ran", len(ran), "of", len(session),
          "| injected high-risk ran:", len(bad))

Output when I ran it:

naive ran 6 of 6 | injected high-risk ran: 4
provenance ran 2 of 6 | injected high-risk ran: 0

The provenance gate let through exactly the two user-caused actions and stopped all four injected ones. Those four steps become prompts, each showing the human the action and the text that caused it.

Actions executed in the same session

The hard part in a real system is the cause field. You must compute it, not ask the model. Reasonable approaches:

  • Mark every message segment with a trust label at ingestion (user, system, tool result) and keep the label through context assembly.
  • Treat any step after an untrusted segment enters the context as tainted until the human sends a new message.
  • Escalate taint by sink: a tainted read_file of a source file may be fine, a tainted http_post never is.

What should you audit in an MCP deployment today?

Use this checklist on any agent that connects to third-party MCP servers.

  1. List every channel that returns free text. Documentation servers, search tools, issue trackers, and web fetchers all count. Each is an instruction channel whether you intended it or not.
  2. Pin and review what you connect. Prefer self-hosted or version-pinned servers. A server that proxies user-generated content, as a registry of community rules does, inherits the trustworthiness of its least trusted contributor.
  3. Separate read tools from sinks and label the sinks. Sinks include anything that writes to the network, a remote repository, a filesystem path, or a shell.
  4. Gate sinks on causal history. If the action follows untrusted content, require approval showing the proposed action and the source text.
  5. Keep secrets out of reach. An agent that cannot read .env cannot leak it. Mount only what the task needs, and keep production credentials out of the workspace.
  6. Constrain egress. An issue created in an arbitrary repository is a data channel. Allowlist destinations for write tools, not only for HTTP.
  7. Make destructive actions reversible. Run deletes against a trash or snapshot so that a mistaken approval is recoverable.
  8. Log the context that caused each action. After an incident you need to answer "which text made it do that."
  9. Update. The advisory lists affected versions through 2.1.2, and the vendor reported a production fix in February. Confirm your own deployment is on a current release.

Frequently asked questions

Is ContextCrush the same as a vulnerability in the model?
No. The model behaved as a language model does when its context says to do something. The flaw was that unsanitized third-party text was delivered in the same channel as trusted documentation, to an agent holding powerful tools.

Why do the severity numbers differ so much?
The record carries a CVSS 3.1 score of 9.0 using scope-changed, high-impact metrics, and a CVSS 4.0 score of 6.4. The GitHub advisory labels it medium. Scoring prompt injection is genuinely hard because impact depends on the tools the host agent holds. Use the score for triage order and your own tool inventory for real risk.

Would sanitizing the rules fully fix this class?
Sanitization helps and the vendor shipped it, but filtering natural language for malicious intent is an arms race. Treat it as one layer. The durable layer is enforcement outside the model: provenance-aware gates, least-privilege tools, and egress control.

Does a read-only MCP server need an approval gate at all?
The server needs none for its own calls. The agent does need one for the actions that follow its output. Read-only describes the tool's side effects, not the influence of what it returns.

Is a human prompt enough?
Only if it shows the cause. A prompt that says "delete project/build?" invites a reflexive yes. A prompt that says "delete project/build, proposed after the documentation server returned this text" gives the reviewer what they need to refuse.

Further reading

  • One Yes, Every Shell Command: How a Tool-Name Approval Cache (CVE-2026-56074) Turns a Click Into a Standing Grant (earlier post, same series)
  • The Agent Installed a Package From Memory: What MCPhantom Teaches About Deprecated MCP Servers and Approval Gates (earlier post, same series)

Sources

πŸ“° Read the original article on Dev.to AI

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