CVE-2026-138027: Bagel before 2.5.5 Unsandboxed DuckDB SQL Execution via query_messages
Bagel (bagel-mcp) before 2.5.5 exposes unsandboxed DuckDB SQL execution through the read-only annotated querymessages MCP tool, allowing file access and network requests. Attackers who prompt-inject the driving LLM via recorded logs or topics can invoke readcsvauto, COPY TO, or httpfs to read and write files and perform server-side request forgery.
Affected Software
Event History
Frequently Asked Questions
Who is realistically exposed to this issue?
Deployments of Bagel bagel-mcp before 2.5.5 are exposed when the driving LLM can be prompt-injected through recorded logs or topics and can invoke the annotated query_messages MCP tool.
What does an attacker need to exploit it?
The attacker needs a way to place prompt-injection content into recorded logs or topics that the driving LLM processes. No authenticated privileges are required, but user interaction is required according to the supplied vector.
Does the query_messages tool need to be explicitly writable for this to be dangerous?
No. Although query_messages is described as read-only, its unsandboxed DuckDB SQL execution can use read_csv_auto, COPY TO, or httpfs to access files, write files, and make network requests.
What is the immediate remediation?
Upgrade Bagel bagel-mcp to version 2.5.5 or later. The issue affects versions before 2.5.5.