CVE-2026-7812
Command Injection in code-mcp MCP Tool
Publication date: 2026-05-05
Last updated on: 2026-05-05
Assigner: VulDB
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| 54yyyu | code_mcp | to 4cfc4643541a110c906d93635b391bf7e357f4a8 (inc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-77 | The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. |
| CWE-74 | The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in the MCP Tool component, specifically in the function git_operation within the file src/code_mcp/server.py. It occurs due to improper handling of the argument 'operation', which allows an attacker to perform command injection.
The attack can be initiated remotely, meaning an attacker does not need local access to exploit this vulnerability. The exploit has been made public, increasing the risk of exploitation.
How can this vulnerability impact me? :
This vulnerability can allow an attacker to execute arbitrary commands on the affected system remotely. This could lead to unauthorized access, data manipulation, or disruption of services.
Because the exploit is publicly available, the risk of exploitation is higher, potentially leading to system compromise or data breaches.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability allows remote attackers to perform arbitrary command injection via the git_operation function, potentially leading to unauthorized access, modification, or destruction of sensitive data.
Such unauthorized access and data manipulation can compromise confidentiality, integrity, and availability of data, which are core principles in standards like GDPR and HIPAA.
Therefore, if exploited, this vulnerability could lead to non-compliance with regulations requiring protection of sensitive data and secure system operations.
Mitigations such as restricting access, running with least privilege, and input validation are necessary to reduce compliance risks.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by monitoring for unusual or suspicious usage of the MCP tool's git_operation function, especially commands that include shell metacharacters such as semicolons (;), ampersands (&), or pipes (|) which indicate command injection attempts.
A proof of concept involves sending an operation value like `status; id` to see if arbitrary commands are executed alongside the intended git command.
To detect exploitation attempts on your system, you can search logs or monitor processes for suspicious git_operation invocations containing these metacharacters.
- Use command-line tools like `grep` to search logs for suspicious patterns, e.g., `grep -E 'git_operation.*[;&|]' /var/log/*`
- Monitor running processes for unexpected commands spawned by the MCP tool, e.g., `ps aux | grep code_mcp` or `ps aux | grep git_operation`
- Use network monitoring tools to detect unusual remote invocations of the MCP tool, especially if it is exposed over the network.
What immediate steps should I take to mitigate this vulnerability?
Immediate mitigation steps include restricting access to the MCP server to trusted users and networks to prevent unauthorized remote exploitation.
Disable the `git_operation` tool in environments where it is not needed or where untrusted users have access.
Run the MCP service with the least privilege necessary to limit the impact of any successful exploitation.
Longer-term fixes involve modifying the code to avoid shell-string execution by using argument arrays with `shell=False`, enforcing a strict allowlist of permitted git subcommands, and rejecting any metacharacters in user input.