Executive brief
MetaGPT is a framework for autonomous software engineering agents. An OS command injection vulnerability in its repository parser allows attackers to execute arbitrary system commands by crafting malicious directory names or repository paths. An attacker who can control the repository path supplied to MetaGPT can achieve full system compromise in the context of the process running the application.
Technical details
The vulnerability is a classic OS command injection (CWE-78) in the RepoParser.rebuild_class_views() method in metagpt/repo_parser.py. The vulnerable code interpolates an attacker-controlled path argument directly into a shell command string without quoting or escaping, then executes it via subprocess.run(..., shell=True). An attacker can inject shell metacharacters (such as $(...) for command substitution or semicolons for command chaining) in a directory name to achieve arbitrary command execution. The attack requires the ability to influence the path argument, which can occur when processing attacker-supplied repository URLs or workspace directories. No authentication or user interaction is required if the path is directly controllable in the deployment.
Affected products
- MetaGPT MetaGPT 0.8.1
Timeline
- 2026-08-31: disclosed