Severity:

HIGH RISK

(7.3)

OS Command Injection in mcp-dnstwist MCP Interface

CVE-2026-7443

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution via OS Command Injection

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

mcp-dnstwist versions up to 1.0.4 contain an OS command injection issue in the MCP Interface's fuzz_domain function, where a manipulated request argument is incorporated into system-level commands.

An attacker who can send crafted requests to the MCP endpoint may execute arbitrary commands on the hosting system, resulting in remote code execution under the MCP service account.

Affected context

This vulnerability appears in deployments that expose the mcp-dnstwist MCP Interface and pass user-controlled or upstream-controlled request data into the fuzz_domain function.

It is relevant when:

  • The MCP process runs on a server or agent that accepts remote requests
  • Request parameters are used to build or forward shell commands
  • The hosting environment grants the MCP process meaningful OS-level privileges

The exact risk depends on how the MCP Interface is integrated and what commands are executed behind fuzz_domain.

Exploit preconditions

  • Attack surface: Network-accessible MCP Interface that routes requests into fuzz_domain.
  • Required access: Ability to send or influence requests processed by the MCP Interface (e.g., remote client, automated agent, or compromised upstream service).
  • Trigger point: Submission of a specially crafted Request argument that is later interpolated into an OS command or shell invocation.
  • Why exploitation is possible: The fuzz_domain implementation appears to concatenate or embed request data directly into command strings or shell arguments without robust quoting, validation, or use of safe process-spawning APIs, allowing the attacker-controlled input to alter command structure.

Why this happens

The core issue is improper handling of untrusted input when constructing OS commands, aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command (OS Command Injection).

In the MCP Interface, the Request argument processed by fuzz_domain is likely used to form a command line or passed through a shell where characters such as ;, &&, |, or backticks can change the intended behavior.

Instead of treating request fields as opaque data, the code appears to treat them as part of the command syntax, failing to:

  • Strictly validate allowed characters or patterns for domain-related input
  • Use parameterized or argument-array process execution APIs
  • Enforce a clear separation between command logic and user-supplied values

This insecure pattern enables injected content to escape the expected argument context and execute additional operations.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the MCP service process
  • Unauthorized access to local files, including reading sensitive configuration or credential material
  • Lateral movement within the host or attached network, depending on available tools and connectivity
  • Data exfiltration or tampering via invoked system utilities
  • Service disruption through process termination, resource exhaustion, or destructive commands
  • Use of the compromised host as a pivot point for further attacks

General mitigation guidance

Mitigation typically focuses on removing direct string-based command construction and reducing trust in request data:

  • Prefer high-level APIs or libraries instead of spawning shell commands for domain fuzzing or DNS operations.
  • When command-line tools are unavoidable, use safe process execution primitives that accept an argument array (e.g., spawn/execFile style) rather than concatenated strings, avoiding shell interpretation.
  • Apply strict input validation and canonicalization on all fields used by fuzz_domain, limiting them to expected patterns such as domain-name character sets and rejecting or sanitizing anything else.
  • Enforce least privilege for the MCP process (minimal filesystem, network, and OS-level permissions) so that a successful injection has a constrained blast radius.
  • Introduce secure defaults where the MCP Interface does not execute system commands based on arbitrary, unvetted parameters.
  • Centralize and document command execution paths, making it easier to review and control how untrusted data interacts with the operating system.

How teams detect issues like this

Detection efforts can combine code-centric and operational approaches:

  • Static analysis: Configure linters or SAST tools to flag use of shell-invoking APIs (e.g., child_process.exec/execSync in TypeScript/Node) where any part of the command originates from request data, especially within the MCP Interface or fuzz_domain.
  • Code review signals: Look for string concatenation or template literals that combine user-derived values with command fragments, the presence of shell metacharacters in allowed inputs, or ad-hoc sanitization logic in command construction.
  • Security testing: Incorporate fuzzing and targeted penetration tests that inject shell metacharacters into relevant request fields, monitoring for abnormal command execution or error behavior.
  • Runtime monitoring: Use process and log monitoring to detect unexpected sub-process execution patterns, anomalous commands, or spikes in shell usage originating from the MCP service.
  • Policy enforcement: Introduce development policies or CI checks that disallow direct shell execution in high-risk components (such as network-facing interfaces) without explicit security review.

Sources

SourceLink
github.comgithub.com/BruceJqs/public_exp/issues/22
github.comgithub.com/BurtTheCoder/mcp-dnstwist/
github.comgithub.com/BurtTheCoder/mcp-dnstwist/issues/13
vuldb.comvuldb.com/submit/804027
vuldb.comvuldb.com/vuln/360185
vuldb.comvuldb.com/vuln/360185/cti

Frequently asked

questions

Exploitability depends on whether the mcp-dnstwist MCP Interface is reachable by untrusted clients or indirectly by user-controlled workflows. In setups where remote users or agents can send arbitrary requests, the vulnerability can often be exploited over the network.

An attacker needs the ability to influence the Request argument processed by fuzz_domain, typically by sending crafted requests to the MCP endpoint or controlling an upstream component that forwards data into it. No local shell access is required if the interface is remotely exposed.

The most robust fix is to remove shell-based command execution entirely from fuzz_domain and rely on library calls or strictly parameterized process execution. Where external tools must be used, construct commands via argument arrays, enforce strict input validation, and avoid any shell interpretation of user-controlled data.

Establish development guidelines that prohibit building command strings from untrusted input, mandate use of safe execution primitives, and require security review for any OS command integration. Combine these with automated checks (linters/SAST), strong input validation routines, and least-privilege deployment practices to make command injection vulnerabilities less likely.

Find out what's already
exploitable in your codebase.