Severity:

HIGH RISK

(7.3)

OS Command Injection in mcp-javadc HTTP Interface

CVE-2026-5802

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.3)

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

An OS command injection vulnerability in the HTTP interface of mcp-javadc up to version 1.2.4 allows attacker-controlled data in the jarFilePath parameter to influence system command execution.

When reachable over the network, a remote attacker can leverage this flaw to execute arbitrary commands on the host running mcp-javadc.

Affected context

This vulnerability appears in deployments of mcp-javadc (up to 1.2.4) that expose the HTTP interface and accept a jarFilePath argument as part of request handling.

The issue manifests when user-supplied path values are used to construct or pass arguments to underlying operating system commands without robust validation or neutralization.

Any environment where the HTTP interface is reachable from untrusted networks, or from users with untrusted input capability, may be affected.

Exploit preconditions

  • Attack surface: The HTTP interface of mcp-javadc, reachable over the network.
  • Required access: Ability to send crafted HTTP requests that control the jarFilePath parameter (authentication requirements, if any, depend on deployment).
  • Trigger point: Handling of the request that causes jarFilePath to be passed into an OS shell or process invocation without proper sanitization or safe APIs.
  • Why exploitation is possible: The application appears to construct or forward shell commands using untrusted input, enabling injection of additional command tokens or arguments that the OS interprets as executable instructions.

Why this happens

The underlying bug class is OS command injection, captured by CWE-78 (Improper Neutralization of Special Elements used in an OS Command) and closely related to CWE-77 (Improper Neutralization of Special Elements used in a Command).

The HTTP interface accepts a jarFilePath value and, instead of treating it strictly as data, incorporates it into a command context that is executed by the operating system, likely via shell-based APIs or unsafely constructed process invocation.

Without strict validation, proper quoting, or the use of parameterized, non-shell command execution primitives, the input can break out of the intended file path context and introduce arbitrary command segments.

This pattern reflects a broader class of vulnerabilities where application code conflates untrusted input with executable command syntax.

Potential impact

  • Remote execution of arbitrary OS commands under the privileges of the mcp-javadc process.
  • Reading, modifying, or deleting local files accessible to the process.
  • Installing or running additional malicious software on the host.
  • Using the compromised host as a pivot point for lateral movement within the network.
  • Disruption of service, including crashes, resource exhaustion, or data corruption.
  • Possible exfiltration of sensitive configuration or environment data.

General mitigation guidance

Resilience against command injection focuses on eliminating unsafe command construction and reducing trust in inbound data:

  • Prefer high-level APIs (e.g., library calls, native process builders with argument arrays) that avoid invoking a shell entirely.
  • Treat file paths and similar parameters strictly as data, not as fragments of a command string; avoid concatenating input into command lines.
  • Apply strict allowlists for acceptable values (e.g., constrained directory roots, specific file name patterns) and reject anything unexpected.
  • Normalize and validate file paths to prevent injection via special characters, metacharacters, or control operators.
  • Run the service under least privilege, limiting what damage an injected command can do if exploitation occurs.
  • Isolate the component via containerization or sandboxing, reducing the blast radius of any command execution.
  • Restrict network exposure of the HTTP interface to only trusted origins where feasible, for example via firewalls or reverse proxies with access control.

How teams detect issues like this

Detection typically combines code-level analysis with runtime monitoring:

  • Static analysis: Configure rules or linters to flag string-based command construction and APIs that invoke shells (e.g., variants of exec, Runtime.exec, or similar) with concatenated user input.
  • Code review signals: Pay attention to any use of jarFilePath (or similarly named parameters) in contexts that launch external processes or handle system-level operations.
  • Policy enforcement: Enforce a coding standard that bans shell command construction with untrusted input and requires safe wrappers or libraries for process execution.
  • Runtime monitoring: Log and monitor command execution, especially unexpected or anomalous commands, arguments, or working directories originating from HTTP requests.
  • Automated tooling: Use SAST/DAST tools that specialize in injection pattern detection to automatically highlight risky command usage paths during CI/CD.

Sources

SourceLink
github.comgithub.com/BruceJqs/public_exp/issues/2
github.comgithub.com/idachev/mcp-javadc/
github.comgithub.com/idachev/mcp-javadc/issues/7
vuldb.comvuldb.com/submit/786974
vuldb.comvuldb.com/vuln/356241
vuldb.comvuldb.com/vuln/356241/cti

Frequently asked

questions

Yes. Because the vulnerable behavior is exposed through the HTTP interface, an attacker who can send requests to that interface can potentially exploit the issue remotely, subject to any network and authentication controls in front of the service.

That depends on how mcp-javadc is deployed. If the HTTP interface is publicly reachable and does not enforce strong authentication, even unauthenticated users may be able to exploit it. If access is restricted, the attacker would need at least the level of access required to invoke the vulnerable endpoint.

The most robust approach is to remove all shell-based command construction that includes user input and switch to safe, parameterized process execution APIs or equivalent high-level library calls. Additionally, strictly validate and constrain jarFilePath to a narrow set of allowed values and locations, so it cannot influence command syntax.

Establish coding standards that prohibit embedding untrusted input into command strings, adopt secure wrappers for any process execution, and use automated code scanning to detect violations. Combine this with defense-in-depth measures like least privilege, service isolation, and careful input validation to reduce risk from any remaining command execution surfaces.

Find out what's already
exploitable in your codebase.