/

CVE-2026-79408

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in MetaGPT RepoParser

CVE-2026-79408

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

MetaGPT contains an OS command injection vulnerability in the RepoParser.rebuild_class_views() method. An attacker who can control the method's path argument may execute arbitrary operating-system commands with the privileges of the affected process.

Affected context

The vulnerability occurs in MetaGPT's repository parsing functionality when the RepoParser.rebuild_class_views() method processes a path argument. Risk is present when attacker-controlled or insufficiently trusted path data reaches command construction or execution without being safely isolated from the operating system shell.

Exploit preconditions

  • Attack surface: The repository parsing interface that invokes RepoParser.rebuild_class_views()
  • Required access: The ability to supply or influence the method's path argument, directly or through an exposed application workflow
  • Trigger point: Processing the path argument during repository class-view rebuilding
  • Why exploitation is possible: Untrusted path data may be interpreted as operating-system command syntax rather than treated solely as a filesystem path

Why this happens

The underlying bug is an OS command injection condition mapped to CWE-78. The vulnerable pattern occurs when application-controlled input is incorporated into a system command without strict separation between data and executable command elements. Shell interpretation or unsafe command construction can cause specially formed input to alter the intended operation and execute additional commands.

Potential impact

  • An attacker could execute arbitrary commands on the host running MetaGPT.
  • The vulnerability may expose application secrets, source code, or local files.
  • The affected process could be used to modify repositories or application data.
  • An attacker could gain a foothold for lateral movement, depending on runtime permissions and network access.
  • Service availability could be disrupted through destructive or resource-intensive commands.

General mitigation guidance

Mitigation generally focuses on preventing user-controlled data from reaching shell interpretation.

Common defensive patterns include:

  • Prefer direct library and process APIs that pass arguments as structured values without invoking a shell.
  • Treat repository paths as untrusted data and apply canonicalization, allowlisting, and confinement to expected directories.
  • Avoid dynamically assembled command strings and reject unexpected path formats before processing.
  • Run repository parsing with a dedicated low-privilege account, restricted filesystem access, and minimal network permissions.
  • Apply sandboxing and read-only controls where the workflow permits them.
  • Separate validation from execution and ensure validation cannot be bypassed by alternate path representations.

How teams detect issues like this

Detection approaches commonly include:

  • Static analysis rules for shell invocation, dynamic command construction, and string interpolation involving path or request data.
  • Code review checks for subprocess or shell APIs that receive concatenated or formatted user-controlled values.
  • Runtime monitoring for unexpected child processes spawned by MetaGPT or its worker services.
  • Audit logging and policy enforcement for process creation, filesystem access, and outbound network connections.
  • Automated security review tools can help identify command execution paths that lack argument separation or input validation.

Sources

SourceLink
github.comgithub.com/REYu6/Metagpt-vul/blob/main/CVE-1-MetaGPT-command-injection.md

Frequently asked

questions

It may be remotely exploitable when a network-accessible workflow accepts attacker-controlled path values and passes them to the affected repository parsing functionality. Exploitability depends on how MetaGPT is deployed and exposed.

An attacker must be able to influence the path argument, either through a directly exposed interface or through another feature that forwards untrusted input to rebuild_class_views().

Avoid shell interpretation entirely and invoke required tools through structured argument APIs. Validate and constrain paths before use, while ensuring the execution context has minimal privileges.

Use secure subprocess patterns, allowlist expected input formats, apply static analysis and code review policies, and monitor unexpected process creation in production environments.

Find out what's already
exploitable in your codebase.