search menu icon-carat-right cmu-wordmark

CERT Coordination Center

MS-Agent does not properly sanitize commands sent to its shell tool, allowing for RCE

Vulnerability Note VU#431821

Original Release Date: 2026-03-02 | Last Revised: 2026-03-02

Overview

A command injection vulnerability was identified in the MS-Agent framework that can be triggered through unsanitized prompt-derived input. An attacker can craft untrusted input introduced via a chat prompt or other external content sources, resulting in arbitrary command execution on the target system(s) where the MS-Agent framework is deployed. No patch or vendor statement was obtained during the coordination process.

Description

MS-Agent is a lightweight framework that enables agents to perform autonomous task execution and tool invocation. The MS-Agent framework includes several features, including a Shell tool that enables execution of commands on the target operating system to complete agentic actions.

A vulnerability has been identified that allows unsanitized input to be executed through the Shell tool. This occurs because the software does not sufficiently verify and sanitize content before execution. As a result, an attacker can leverage prompt injection techniques to influence the agent into executing unintended shell commands when interacting with attacker-controlled content.

The Shell tool relies on regular expression–based filtering in the check_safe() method, which is intended to restrict unsafe commands. The implemented default denylist can be bypassed, allowing crafted input to evade validation checks and reach the shell execution layer.

The vulnerability is tracked as:

CVE-2026-2256
Command injection vulnerability in ModelScope's ms-agent allows an attacker to execute arbitrary operating system commands through crafted prompt-derived input.

This vulnerability may be exploited when the agent is instructed to process or retrieve external content, such as analyzing code, summarizing documents, or performing other tasks that involve interacting with attacker-controlled data. If the retrieved or processed content contains malicious command sequences that bypass the check_safe() validation, the agent may forward those commands to the Shell tool for execution.

The use of a regular expression denylist in the check_safe() method is insufficient to prevent command injection. Denylist-based filtering is inherently fragile and can often be bypassed through encoding, command obfuscation, or alternative shell syntax. In this case, the filtering logic can be circumvented, enabling arbitrary command execution within the execution context of the agent process.

Impact

An attacker who successfully exploits this vulnerability may execute arbitrary operating system commands on the target with the privileges of the MS-Agent process. This may allow modification of system files, lateral movement within the environment, establishment of persistence mechanisms, or exfiltration of sensitive data accessible to the agent.

Solution

No statement was provided by the vendor during coordination efforts. Users should deploy MS-Agent only in environments where ingested content is trusted, validated, or sanitized. Agents with shell execution capabilities should be sandboxed or executed with least-privilege permissions. Additional mitigation strategies include replacing denylist-based filtering with strict allowlists and implementing stronger isolation boundaries for tool execution.

Acknowledgements

Thanks to the reporter, Itamar Yochpaz, for this report. Document written by Christopher Cullen.

Vendor Information

431821
 

ModelScope Unknown

Notified:  2026-01-15 Updated: 2026-03-02

CVE-2026-2256 Unknown

Vendor Statement

We have not received a statement from the vendor.


Other Information

CVE IDs: CVE-2026-2256
API URL: VINCE JSON | CSAF
Date Public: 2026-03-02
Date First Published: 2026-03-02
Date Last Updated: 2026-03-02 20:09 UTC
Document Revision: 1

Sponsored by CISA.