Security guidance: tool-input file paths written without containment (arbitrary file write class)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 65/100
- Issue-Typ
- Dokumentation
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- security
Rechercherichtung
Beginne damit, die Serverdokumentation für Tool-Hinweise zu finden; das Issue nennt weder eine Datei noch einen Test. Füge einen Abschnitt hinzu, der erklärt, wie von Tools bereitgestellte Pfade innerhalb eines Workspace-Stammverzeichnisses aufgelöst und absolute Pfade sowie ..-Ausbrüche zurückgewiesen werden, mit einem Beispiel. Erledigt ist die Aufgabe, wenn die Dokumentation die Hinweise zur Pfadbegrenzung enthält; der optionale Helper resolveWithin(root, p) würde einen separaten Umfang und Entwurf erfordern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
While auditing the MCP server ecosystem (1,654 npm-backed servers
deep-scanned with MCP-aware CodeQL taint analysis), I found a recurring,
independently-rediscovered class: a tool declares a path-shaped input
(output_path, local_path, output_dir) as an unconstrained string and passes
it to path.resolve()/path.join() then fs.writeFileSync, with no workspace
containment. Because an MCP tool caller is frequently an LLM acting on
untrusted content, the path is attacker-influenced via indirect prompt
injection - no human chooses it. Result: arbitrary file write and
destructive overwrite (authorized_keys, rc files, configs).
Prevalence in the scanned sample is material (path-traversal flows present
in a measurable share of servers; aggregate scorecard available). Several
affected servers even shipped a containment helper for one sink and left
the tool-input writes raw.
This is a server-author footgun, not an SDK bug, but the SDK is the natural
place to prevent it at scale. Proposed, in order of increasing
intrusiveness:
- A short "Writing files from a tool safely" section in the server-author
docs, with the containment pattern (resolve against a workspace root,
reject absolute and ".." escapes). - Optionally, an exported
resolveWithin(root, p)helper so authors do not
hand-roll it (several who did, got it wrong).
I can open the docs PR with the guidance text and an example. Full
methodology and the CodeQL pack that finds this are public at
github.com/stillmarcus24/mcp-security-research. No unfixed server is named;
findings are under coordinated disclosure.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 13.8k
- Forks
- 2.5k
- Ø Merge
- 6 T. 23 Std.
- Gemergte PRs (30 T.)
- 2
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/typescript-sdk
-
v2
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`Evtl. vergeben @mgoldsborough hat das vor 6 Tagen übernommen. Offenv2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
modelcontextprotocol/typescript-sdk#3249 ·
Maintainer antworten meist innerhalb von 1 Tag
-
v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` replyEvtl. vergeben @Tidehyc hat das vor 7 Tagen übernommen. Offenv2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
UriTemplate.match() throws a TypeError on an empty expression it acceptsEvtl. vergeben @yunusemrejs hat das vor 12 Tagen übernommen. Offenv1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/typescript-sdk
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Vessel9817/onion-site-template#512 ·
Maintainer antworten meist innerhalb von 1 Tag
-
nightly-tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Maintainer antworten meist innerhalb von 1 Tag
-
approved
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
fritzprix/libr-agent#3266 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
better-auth/better-auth#13101 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag