Severity:

HIGH RISK

(7.3)

OS Command Injection in A-G-U-P-T-A wireshark-mcp

CVE-2026-7785

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

A command injection flaw in the quick_capture function of pyshark_mcp.py allows attacker-controlled data to be passed into operating system commands without proper sanitization.

When exposed remotely, this can enable an attacker to execute arbitrary system commands on the host running the wireshark-mcp tooling, potentially taking over the underlying system or environment.

Affected context

The vulnerability occurs within the A-G-U-P-T-A wireshark-mcp project, specifically in the Python module pyshark_mcp.py in the quick_capture function.

It is relevant in deployments where:

  • The quick_capture functionality is reachable via a network-facing interface, API, or service
  • User-supplied or external input is used to construct shell commands
  • There is no robust validation, sanitization, or command argument escaping for those inputs

Because the project ships as a rolling release, the flaw may affect any environment using code that includes this function without a security hardening pass.

Exploit preconditions

  • Attack surface: Remote, via any interface that exposes the quick_capture function or wraps it (e.g., web service, RPC endpoint, automation scripts).
  • Required access: Ability to supply input parameters that influence the arguments or options passed into underlying OS commands.
  • Trigger point: Invocation of quick_capture in pyshark_mcp.py where attacker-controlled data is concatenated or interpolated into a shell command string or passed unsafely to a subprocess API.
  • Why exploitation is possible: The function likely constructs shell commands from input using unsafe patterns (e.g., string concatenation and shell=True), without strict allowlists, escaping, or separation between data and executable code, which is characteristic of CWE-78 / CWE-77.

Why this happens

The root cause is improper construction of operating system commands that incorporate untrusted input.

Insecure patterns typically include:

  • Building command lines via string concatenation or formatting
  • Passing these strings to shell interpreters or subprocess APIs with shell=True
  • Relying on minimal or ad-hoc sanitization instead of strict command argument validation and allowlisting

This maps to:

  • CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
  • CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')

The quick_capture function appears to treat user-controlled values as trusted command fragments, allowing crafted inputs to break out of expected arguments and inject arbitrary commands.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the wireshark-mcp process
  • Reading, modifying, or deleting files accessible to the process
  • Lateral movement within the host or connected systems via installed tooling
  • Exfiltration of network captures, credentials, or other sensitive data handled by the tool
  • Service disruption or denial of service by terminating processes or consuming resources
  • Establishment of persistent backdoors or further malware deployment

General mitigation guidance

Effective mitigation focuses on separating data from executable code and minimizing trust in incoming parameters.

Common defensive patterns include:

  • Avoiding shell invocation entirely; use subprocess APIs with argument lists (e.g., subprocess.run([...], shell=False) in Python)
  • Applying strict allowlists for all user-controllable parameters (e.g., only specific interface names, capture filters, or flags)
  • Rejecting or normalizing inputs that contain shell metacharacters, control operators, or unexpected characters
  • Encapsulating external tools behind a well-defined API that validates and constrains all options
  • Running capture-related components with least privilege, in isolated accounts or sandboxes, to limit impact if a command is compromised
  • Designing the interface so that untrusted users never directly influence low-level command construction, preferring fixed templates and controlled parameter substitution

How teams detect issues like this

Detection generally relies on both code-centric and operational approaches:

  • Static analysis: Configure SAST rules to flag:
  • Use of os.system, subprocess.* with shell=True, or similar APIs in pyshark_mcp.py
  • String concatenation or interpolation that mixes user input with command strings
  • Absence of robust validation on parameters passed into command-building functions
  • Code review: During manual reviews, treat any code that spawns external processes or shells as high-risk and verify:
  • That all arguments are passed as discrete list elements
  • That parameter values are constrained to expected formats and sets
  • That there is no reliance on blacklist-based sanitization alone
  • Security testing: Use focused dynamic tests and fuzzing to send crafted inputs through interfaces invoking quick_capture, monitoring for unexpected command execution or errors.
  • Policy enforcement: Introduce repository or CI policies that require security sign-off on changes touching command execution logic and network-exposed capture features.

Sources

SourceLink
github.comgithub.com/A-G-U-P-T-A/wireshark-mcp/
github.comgithub.com/A-G-U-P-T-A/wireshark-mcp/issues/1
vuldb.comvuldb.com/submit/807745
vuldb.comvuldb.com/vuln/360985
vuldb.comvuldb.com/vuln/360985/cti

Frequently asked

questions

Yes, when the quick_capture functionality is exposed over a network interface or integrated into remotely accessible services, an attacker can potentially exploit it by sending crafted inputs that influence command construction.

The attacker must be able to interact with the component or API that ultimately calls quick_capture with user-controlled parameters. No local shell access is required if the capture feature is reachable over HTTP, RPC, or similar channels.

Refactor command execution to avoid shell interpretation, pass arguments as structured lists to subprocess APIs, and strictly validate or allowlist all parameters that reach the command layer. This reduces the risk of injected control characters and unexpected command chaining.

Establish internal guidelines that treat all process-spawning code as security-sensitive, enforce code review and static analysis checks for subprocess usage, and design APIs so untrusted inputs are validated against well-defined schemas and constrained sets of values before they ever influence OS commands.

Find out what's already
exploitable in your codebase.