Skip to content

GET /api/v1/info returns the global admin API key to any agent token — full privilege escalation #1180

Closed

Description

@Dumbris

Summary

GET /api/v1/info returns the global admin API key to any authenticated caller, including a read-only agent token scoped to a single server. The scoped token can then authenticate as admin, which defeats every scope and permission control in the product.

Pre-existing on main; not introduced by the #1166/#1167 work, but found while verifying it.

Reproduce

Instance with api_key: devkey-abc123 and two servers. Mint a token scoped to one server with read-only permissions:

mcpproxy token create --name scoped-ci --servers alpha --permissions read

Then:

curl -s http://127.0.0.1:8080/api/v1/info -H "X-API-Key: mcp_agt_..."

Response (verified live):

{"success":true,"data":{ ...
  "web_ui_url":"http://127.0.0.1:8080/ui/?apikey=devkey-abc123"}}

Mechanism

The route is registered with no gate (internal/httpapi/server.go:765). handleGetInfo builds web_ui_url through buildWebUIURLWithAPIKey, which appends cfg.APIKey verbatim.

Impact

Complete privilege escalation from any agent token to admin. With the key, the holder reaches every admin route: full server inventory, config read and write, secret-bearing payloads when reveal_secret_headers is set, token management.

It also means the allowed_servers scope is not a security boundary today: a scoped token does not need to defeat the scope checks, it just reads the admin key and stops being scoped.

Related

Same helper is used at cmd/mcpproxy/main.go:596 to print the key at startup. That one is defensible — it is the operator's own key in the operator's own log, as a copy-paste affordance — but it is worth re-examining alongside this, since anything that reads main.log inherits it, and GET /api/v1/servers/{id}/logs serves log content over REST.

Fix direction

A non-admin caller must not receive the key in any field. Options: omit web_ui_url for a non-admin, return it without the apikey query parameter, or require admin for the route. Whichever is chosen, sweep every other caller of buildWebUIURLWithAPIKey and every other site that renders the API key into a response body, a URL or a log field.

Being fixed on claude/sec-1166-1167-rest-sse-doors alongside #1166/#1167.

Activity

  1. added
    kind/bug
    kind/security
    area/proxy
    priority/critical
    on Sep 2, 2026
  2. Dumbris commented on Sep 2, 2026

    @Dumbris
    MemberAuthor

    Fixed in #1182 (merged 2026-09-02). GitHub only auto-closed the first reference in that PR's "Closes" line, so closing manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/proxykind/bugkind/securitypriority/critical

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions