What happened
Bagel (bagel-mcp) before 2.5.5 exposes unsandboxed DuckDB SQL execution through the read-only-annotated `query_messages` MCP tool, allowing file access and network requests. An attacker who prompt-injects the driving LLM via recorded logs or topics can invoke `read_csv_auto`, `COPY TO`, or the httpfs extension to read and write files and perform server-side request forgery. Published 2026-11-27, CWE-749 (Exposed Unsafe Method), fixed in 2.5.5 (GHSA-xrqm-r82m-j847).
Why it matters
This violates the tool's read-only contract, turning a memory/RAG retrieval MCP tool into an arbitrary file read/write and SSRF primitive. Because the triggering input is attacker-controlled conversation content that the LLM ingests, a single prompt-injection in a multi-user or log-replay context can make the agent read secrets from the host, write files, or reach internal services.
Attack vector
Prompt injection via recorded logs or topics drives the model to call query_messages with DuckDB functions (read_csv_auto, COPY TO, httpfs) to read/write files on the host or reach internal network services.
Affected systems
Extelligence-ai Bagel (bagel-mcp) < 2.5.5
Mitigation
Upgrade bagel-mcp to 2.5.5 or later.