DEV Community

yutianle
yutianle

Posted on

Bagel MCP: rsync Options That Escape the File-Copy Task

Bagel MCP: rsync Options That Escape the File-Copy Task

A pipeline task called RsyncFilesToLocalDirectory sounds bounded: copy files from one place to another. CVE-2026-138028 shows that the options supplied to rsync decide whether that label remains true. Bagel before 2.5.5 rejected only --quiet and --log-format, leaving options such as -e, --rsh, and --rsync-path available to influence command execution.

How the input moved

The CVE record says an attacker who influences the driving LLM through prompt-injected content can trigger run_pipeline. The model then chooses parameters that reach the rsync task. This is an agentic command boundary, not a conventional endpoint where a request body directly reaches a shell.

The person submitting the prompt may not need to know the rsync syntax. They need to persuade the model to run the pipeline with the right sequence of values. That makes tool descriptions, prompt provenance, and parameter schemas part of the attack surface.

Why argument injection is different from a normal command string

An instruction builder that has already chosen the executable can still be abused when untrusted data becomes an option. A value beginning with a dash may be interpreted as a switch rather than data. rsync has options that start remote shells or name a remote binary. Those options can change which process runs on which host.

The CVE gives CVSS 4.0 a base score of 7.7 and CVSS 3.1 a score of 7.5. It requires a high-complexity path and passive user interaction in the 4.0 model, while the outcome includes high confidentiality, integrity, and availability impact. The score reflects the capability reached after the model is influenced, not a claim that every prompt is sufficient.

Required controls

Upgrade to Bagel 2.5.5 or later. Then move from option filtering to a fixed command shape. The task should define the exact rsync arguments it needs, pass source and destination as validated values in fixed positions, and reject values that begin with a dash where the grammar expects a path. A deny-list of two options does not cover the command's authority.

Run the task under a dedicated account with access only to the intended source and destination. Keep SSH keys, cloud credentials, and service tokens out of the process environment. If the pipeline supports remote shell selection, expose a small enumerated set of approved connection profiles rather than a free-form option.

Detection

Log the complete argument vector before execution, the model or user identity that initiated the pipeline, and the source content that influenced the decision. Protect secrets in those logs. Alert on rsync processes with remote-shell, remote-binary, or unexpected option combinations. Correlate the alert with the pipeline run and the agent conversation that requested it.

The relevant question is not whether the model can be convinced to use a dangerous tool. Assume it may be. The stronger question is whether the tool can still execute a different command or reach a different host when the model asks for a file copy. Bagel's fix addresses the vulnerable option handling; least privilege limits the account that remains available.

References

Top comments (0)