Skip to content

fix(ai): a server url that the mcp tool ai_benchmark gets from the model reaches loopback with post requests #2638

Description

@dan-petty

Problem Description

The MCP tool ai_benchmark publishes the options servers ("Comma-separated Ollama server URLs") and models (an entry can be model@url). The model that calls the tool gives both. The benchmark sends its chat requests to each URL with POST {url}/api/chat. The client dials at the configured level, which admits loopback without ai.allow_private_network. The AI API key does not go to such a URL (#954), but the requests do.

The URL can end in ?x=. Then the path of the request is the path that the caller wrote. So a model can make the tool send many POST requests, with a prompt body, to any path of any loopback service of the host.

The cause is the same as in #2480: a URL from the caller is used as configuration.

Reproduction Steps

  1. Leave ai.allow_private_network unset, and set ai.provider to ollama.
  2. In a test, install record_connects from tests/web_fakes.py with canned Ollama chat answers.
  3. Call the MCP tool ai_benchmark with servers="http://127.0.0.1:8200/v1/sys/seal-status?x=" and models="qwen3:0.6b". Run it again with models="qwen3:0.6b@http://127.0.0.1:8200/v1/sys/seal-status?x=".
  4. Read recorder.dialled and recorder.written.

Expected vs Actual Behavior

Expected: the tool benchmarks only the configured servers. The URL options stay for a person at the command line.

Actual: on main at a3eb41f4, each call dialled 127.0.0.1:8200 eight times and wrote POST /v1/sys/seal-status?x=/api/chat.

Environment Diagnostics

  • DevOps CLI Version: 0.15.1 (main at a3eb41f4)
  • Python Version: 3.14.10
  • OS & Architecture: Linux x86_64
  • Execution Environment: DevContainer

Logs, Traces, or Terminal Output

recorder.dialled -> [('127.0.0.1', 8200)] x 8
recorder.written -> [b'POST /v1/sys/seal-status?x=/api/chat HTTP/1.1\r\nHost: 127.0.0.1:8200\r\n...']

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Proposed design

Problem statement

The MCP tool ai_benchmark publishes servers and models options that a model can supply. A model can use these to direct POST requests to any loopback path on the host. This is a server-side request forgery vulnerability. The fix removes the model-supplied URL options from the tool schema. The tool uses only the server configured by ai.provider.

Acceptance criteria

Requirement: No servers option in tool schema

The ai_benchmark MCP tool SHALL NOT publish a servers option in its input schema.

Scenario: Schema inspection

  • WHEN A client reads the ai_benchmark tool input schema
  • THEN The schema has no servers property

Requirement: No model@url in models option

The ai_benchmark MCP tool SHALL NOT accept a model@url format in its models option.

Scenario: Model-supplied URL rejected

  • WHEN A model calls ai_benchmark with models set to qwen3:0.6b@http://127.0.0.1:8200
  • THEN The tool does not dial 127.0.0.1:8200

Requirement: Uses configured server only

The ai_benchmark tool SHALL send its chat requests only to the server configured by ai.provider.

Scenario: Configured server used

  • WHEN ai.provider is set to ollama and the tool is called with no servers option
  • THEN The request goes to the configured Ollama endpoint

Requirement: Loopback not reached

A model-supplied loopback URL in any option SHALL NOT cause a dial to a loopback address.

Scenario: Loopback dial blocked

  • WHEN record_connects is installed and the tool is called with a loopback URL in the servers field
  • THEN recorder.dialled contains no loopback address

Existing Tool Considered

The project builds its own MCP tool. No open library provides this fix. The cost is the tokens to remove the servers option and model@url parsing from the tool schema, add a loopback-dial test, and update docs/MCP_TOOLS.md. Estimate: 3000 tokens to write, 500 tokens per regression fix, and 2 hours of elapsed time.

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/security
    status/new
    value/high
    effort/low
    on Oct 29, 2026
  2. dan-petty commented on Oct 29, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/security. A model can direct POST requests to any loopback path, a server-side request forgery vulnerability.
    • Priority: P1-High. The vulnerability lets a model issue arbitrary POST requests to local services without ai.allow_private_network.
    • Value: High. It exposes all local services to model-directed POST requests, a direct security risk to the host.
    • Effort: Low. The fix removes or restricts the servers and model@url options from the tool schema, a targeted change.
    • Related: fix(ai): a url that the mcp tool ai_prewarm gets from the model reaches loopback with a post request #2637, which asks for a different change. Both fix model-supplied URLs in an MCP tool reaching loopback with POST, but #2637 covers ai_prewarm and this covers ai_benchmark.
  3. added
    priority/p1-high
    on Oct 29, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 29, 2026
  5. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 8036e7e (see proposed design in issue body).

  6. added a commit that references this issue on Oct 30, 2026
  7. removed
    status/ready
    on Oct 30, 2026
  8. added a commit that references this issue on Nov 2, 2026
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

    effort/lowpriority/p1-highsource/agenttype/securityvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions