CVE-2026-138027 in Bagelinfo

Summary

by MITRE • 11/27/2026

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. Attackers who prompt-inject the driving LLM via recorded logs or topics can invoke read_csv_auto, COPY TO, or httpfs to read and write files and perform server-side request forgery.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 11/27/2026

The vulnerability identified in Bagel versions prior to 2.5.5 represents a critical security flaw within its Model Context Protocol implementation, specifically affecting the query_messages tool. This component is designed to facilitate interactions with DuckDB, an embedded analytical database engine, by allowing users to execute SQL queries through natural language prompts processed by large language models. The core issue lies in the fact that this execution environment operates without adequate sandboxing or strict command whitelisting mechanisms. While the interface may be labeled as read-only for standard data retrieval operations, it inadvertently exposes powerful DuckDB functions and extensions that allow for arbitrary file system access and network connectivity. This architectural oversight transforms a seemingly benign analytical tool into a vector for significant server compromise, enabling attackers to bypass intended restrictions on data access and external communications.

The technical mechanism of this exploitation relies heavily on prompt injection attacks targeting the driving large language model. By manipulating input via recorded logs or specific topics, an attacker can craft prompts that trick the LLM into generating SQL statements invoking dangerous DuckDB functions such as read_csv_auto, COPY TO, and httpfs. The read_csv_auto function allows for the reading of arbitrary files from the server's file system, effectively bypassing database-level access controls to expose sensitive configuration files, source code, or user data stored in CSV format elsewhere on the disk. Furthermore, the COPY TO command enables the writing of query results directly to specific file paths, which can be leveraged to plant malicious scripts or exfiltrate large volumes of structured data. The httpfs extension provides network capabilities within SQL queries, allowing for server-side request forgery where the vulnerable service initiates HTTP requests to external domains controlled by the attacker. This capability facilitates data exfiltration over standard web protocols and can also be used in conjunction with other vulnerabilities to perform internal port scanning or access restricted backend services that are not directly exposed to the public internet.

The operational impact of this vulnerability is severe, as it grants an unauthenticated or low-privileged user full control over the underlying server's file system and network stack through the database interface. This leads to a complete loss of confidentiality for sensitive data residing on the host machine, including credentials, proprietary algorithms, and personal identifiable information if accessible via CSV exports. Additionally, the ability to write files can lead to remote code execution if an attacker manages to overwrite executable scripts or configuration files that are subsequently executed by system processes. The network request capability expands the attack surface significantly, allowing the compromised server to act as a pivot point for further lateral movement within the internal network infrastructure. This effectively turns the Bagel application into a persistent foothold for attackers seeking deeper access to enterprise environments, potentially leading to full system compromise and significant business disruption.

Mitigation strategies must prioritize immediate remediation through software updates alongside robust architectural hardening. The most effective solution is to upgrade Bagel to version 2.5.5 or later, where these sandboxing issues have been addressed by the developers. In cases where upgrading is not immediately feasible, organizations should implement strict input validation and output sanitization layers at the application gateway level to filter out malicious SQL keywords such as read_csv_auto, COPY TO, and httpfs before they reach the LLM processing engine. Additionally, deploying a Web Application Firewall with rules specifically tuned for prompt injection patterns can help detect and block attempts to manipulate the driving model. It is also critical to enforce principle of least privilege by running the Bagel service under a restricted user account with minimal file system permissions and no network access capabilities where possible. Regular auditing of LLM prompts and logs should be conducted to identify any signs of prompt injection attempts, ensuring that security monitoring remains proactive against evolving adversarial techniques targeting generative AI systems.

Responsible

VulnCheck

Reservation

11/27/2026

Disclosure

11/27/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!