PyPI: metagpt
CVE-2026-5972
Safety vulnerability ID: SFTY-20260409-34215
Safety legacy ID: pyup.io-92526
Affected versions of the metagpt package are vulnerable to OS Command Injection due to improper neutralisation of user-controlled input in the terminal command execution component. The Terminal.run_command function in metagpt/tools/libs/terminal.py passes input to the operating system shell without adequate sanitisation, enabling injection of arbitrary commands. An attacker can remotely exploit this flaw to execute arbitrary operating system commands on the host by supplying crafted input that is processed by the vulnerable function.
Overview
FoundationAgents MetaGPT vulnerable to os command injection via the Terminal.run_command
Advisory
Affected versions of the metagpt package are vulnerable to OS Command Injection due to improper neutralisation of user-controlled input in the terminal command execution component. The Terminal.run_command function in metagpt/tools/libs/terminal.py passes input to the operating system shell without adequate sanitisation, enabling injection of arbitrary commands. An attacker can remotely exploit this flaw to execute arbitrary operating system commands on the host by supplying crafted input that is processed by the vulnerable function.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20260409-34215/CVE-2026-5972
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-5972
- https://github.com/advisories/GHSA-wp29-qmvj-frvp
- https://pypi.org/project/metagpt
- https://nvd.nist.gov/vuln/detail/CVE-2026-5972
- https://github.com/FoundationAgents/MetaGPT/issues/1929
- https://github.com/paipeline/MetaGPT/commit/d04ffc8dc67903e8b327f78ec121df5e190ffc7b
- https://github.com/FoundationAgents/MetaGPT
- https://vuldb.com/submit/791745
- https://vuldb.com/vuln/356526
- https://vuldb.com/vuln/356526/cti
- https://github.com/advisories/GHSA-wp29-qmvj-frvp
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
