CVE-2026-138028 in Bagel
Summary
by MITRE • 11/27/2026
Bagel (bagel-mcp) before 2.5.5 contains an argument injection vulnerability in RsyncFilesToLocalDirectory that allows attackers to inject rsync options because only --quiet and --log-format values are rejected. Attackers who influence the LLM through prompt-injected content can trigger run_pipeline with -e/--rsh or --rsync-path options to execute commands as the Bagel server process.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/27/2026
The vulnerability identified in versions of Bagel prior to 2.5.5 represents a critical argument injection flaw within the RsyncFilesToLocalDirectory function, which fundamentally compromises the integrity and security of command execution processes. This issue arises from an insufficient validation mechanism where the software attempts to sanitize user-supplied input by rejecting only specific dangerous flags such as --quiet and --log-format. However, this whitelist approach is inherently flawed because it fails to account for other potentially malicious rsync options that can alter program behavior or facilitate remote code execution. By relying on a limited set of rejected values rather than enforcing strict parameter constraints or using safe API calls instead of shell interpretation, the application leaves itself exposed to injection attacks when processing file transfer operations initiated through its interface.
The operational impact of this vulnerability is severe, as it allows attackers who have gained influence over the Large Language Model context through prompt-injected content to manipulate the execution pipeline. Specifically, an attacker can craft inputs that trigger the run_pipeline function with dangerous rsync arguments such as -e or --rsh, which specify alternative remote shell programs, or --rsync-path, which defines a custom path for the rsync binary on the remote system. When these options are processed by the underlying operating system command interpreter, they enable the execution of arbitrary commands under the privileges of the Bagel server process. This effectively grants an attacker full control over the host machine running the service, potentially leading to data exfiltration, lateral movement within a network, or complete system compromise depending on the permissions assigned to the application user account.
From a classification perspective, this vulnerability aligns with CWE-78 Improper Neutralization of Special Elements used in an OS Command and CWE-20 Incorrect Input Validation. The failure to properly sanitize input before constructing shell commands is a classic example of command injection where the attacker injects additional arguments that modify the intended behavior of the utility. In terms of offensive security frameworks, this technique corresponds to ATT&CK T1059 Command and Scripting Interpreter sub-techniques related to argument injection or indirect command execution via system utilities like rsync. The exploitation vector typically involves social engineering or automated prompt injection attacks against the LLM component, which then passes maliciously crafted parameters down to the backend file handling logic without adequate security checks.
Mitigation strategies must prioritize immediate updates to version 2.5.5 or later where this validation flaw has been addressed by developers implementing more robust input sanitization and parameter parsing mechanisms. Organizations should also consider defense-in-depth measures such as running the Bagel service with minimal privileges using principle of least privilege, ensuring that even if command injection occurs, the attacker cannot escalate to root or access sensitive system resources. Additionally, restricting network egress from the server can limit the impact of any successful exploitation by preventing data exfiltration or communication with external command-and-control infrastructure. Input validation should be strengthened to reject not just specific known bad flags but all non-essential arguments for rsync operations, and where possible, replace shell-based execution with native library calls that do not invoke a command interpreter.