NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Other MCP servers and tools

CVE-2026-43901: wireshark-mcp vulnerable to arbitrary file write via export_objects when WIRESHARK_MCP_ALLOWED_DIRS is not configured

mediumCVSS 3.1 6.8GHSA-3r68-x3xc-rxpg

wireshark-mcp 1.1.5 and earlier can write files to any directory when WIRESHARK_MCP_ALLOWED_DIRS is not set, which is the default. A pcap containing a prompt injection can steer an AI agent into exporting an HTTP object into ~/.ssh or /etc/cron.d. No patched version exists. Set WIRESHARK_MCP_ALLOWED_DIRS now.

Published May 5, 2026 · Updated May 13, 2026 · Analysis Oct 28, 2026

What an attacker can do

The wireshark_export_objects tool takes a dest_dir argument and passes it to tshark's --export-objects flag. In src/wireshark_mcp/tshark/client.py, _validate_output_path only enforces the sandbox when _allowed_dirs is set, and it is None by default. So in a default install, os.makedirs creates the directory and tshark writes into it, wherever it points.

The attack runs through the packet capture. An attacker plants a crafted HTTP response in a pcap, for example with Content-Disposition: filename=authorized_keys, and adds prompt injection text in the payload. When the agent analyzes the capture, the injection tells it to call wireshark_export_objects with dest_dir=/home/user/.ssh/. tshark then extracts the object under the attacker's chosen name, which can give the attacker SSH access. Other targets named by the advisory are /etc/cron.d and writable web roots.

The same missing sandbox affects merge_pcap_files, editcap_trim, editcap_split, editcap_time_shift, editcap_deduplicate and text2pcap_import. The researcher confirmed a write to an arbitrary path on wireshark-mcp 1.1.5 with tshark 4.6.4. The CVSS vector marks attack complexity high and user interaction required, since someone must open the pcap with the agent.

Who is affected

The pip package wireshark-mcp at 1.1.5 and earlier, in any setup where WIRESHARK_MCP_ALLOWED_DIRS is unset. Setups that set it use the existing sandbox. Check the version and the variable:

pip show wireshark-mcp

Then look at the environment of the process that starts the server for WIRESHARK_MCP_ALLOWED_DIRS.

wireshark-mcp

Ecosystem
PyPI
Affected
<= 1.1.5
Fixed in
No patched version yet
Check
pip show wireshark-mcp

How to fix it

There is no patched version. The advisory says "Not yet patched" and proposes making the sandbox mandatory, so file-write operations fail when no allowed directory is set. Until a release exists, use the workaround from the advisory: set WIRESHARK_MCP_ALLOWED_DIRS to a restricted directory before you start the server.

export WIRESHARK_MCP_ALLOWED_DIRS=/tmp/wireshark_mcp_safe

This turns on the existing sandbox and blocks writes outside that path. Also avoid analyzing captures from untrusted sources with an agent that has file-write tools.

How to tell if you were hit

Look in ~/.ssh/authorized_keys, /etc/cron.d, and web roots for files you did not create, with attention to modification times that match an analysis session. Review MCP tool-call logs for wireshark_export_objects, merge_pcap_files or editcap calls whose destination is outside your work directory. Check for tshark processes started with --export-objects and an unexpected path. Beam records agent MCP tool calls and file access, so the call and the file written would appear in an agent's history.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Description

Impact

wireshark-mcp exposes a wireshark_export_objects MCP tool that accepts an attacker-controlled dest_dir parameter and passes it to tshark's --export-objects flag with no mandatory path restriction.

The path sandbox (_allowed_dirs) is None by default and only activates when the environment variable WIRESHARK_MCP_ALLOWED_DIRS is explicitly set. In a default installation, any directory on the filesystem can be used as the export destination.

Affected code (src/wireshark_mcp/tshark/client.py:531-543):


output_validation = self._validate_output_path(dest_dir)

# _validate_output_path only enforces the sandbox when _allowed_dirs is set.

# Default: _allowed_dirs = None → no restriction.

os.makedirs(dest_dir, exist_ok=True)   # creates arbitrary directories

cmd = [..., "--export-objects", f"{protocol},{dest_dir}"]

Attack Scenario

An attacker embeds a crafted HTTP response in a pcap file (e.g. Content-Disposition: filename=authorized_keys). Via prompt injection in the pcap payload, an AI model using this MCP server is manipulated into calling wireshark_export_objects with:


dest_dir=/home/user/.ssh/

tshark then extracts and writes the HTTP object to that path, granting the attacker SSH access.

The same technique can target:

  • /etc/cron.d/
  • Writable web roots
  • Other sensitive filesystem locations

Additional Affected Operations

The same missing sandbox affects:

  • merge_pcap_files
  • editcap_trim
  • editcap_split
  • editcap_time_shift
  • editcap_deduplicate
  • text2pcap_import

Proof of Concept

Confirmed on wireshark-mcp v1.1.5 with tshark 4.6.4.

A crafted pcap’s HTTP object was successfully written to an arbitrary filesystem path when:


_allowed_dirs = None

---

Patches

Not yet patched.

A fix should make the path sandbox mandatory for all file-write operations rather than optional:


# Reject all write operations when no sandbox is configured

if not self._allowed_dirs:

    return json.dumps({

        "success": False,

        "error": {

            "type": "SecurityError",

            "message": "Set WIRESHARK_MCP_ALLOWED_DIRS before using file-write operations"

        }

    })

---

Workarounds

Set WIRESHARK_MCP_ALLOWED_DIRS to a restricted safe directory before starting the server:


export WIRESHARK_MCP_ALLOWED_DIRS=/tmp/wireshark_mcp_safe

This activates the existing sandbox and blocks writes outside the allowed path.

---

Resources

  • Vulnerable code:
  • src/wireshark_mcp/tshark/client.py lines 521–543
  • src/wireshark_mcp/tshark/client.py lines 685–839
  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory
  • CWE-73: External Control of File Name or Path

Credited to bx33661.

Questions

Is wireshark-mcp 1.1.5 affected by CVE-2026-43901?

Yes, when WIRESHARK_MCP_ALLOWED_DIRS is not set, which is the default. No fixed version exists yet.

How does an attacker trigger it?

They hide prompt injection text and a crafted HTTP object in a pcap. When the agent analyzes the capture, it is steered to export the object into a chosen directory.

Does setting WIRESHARK_MCP_ALLOWED_DIRS fully protect me?

The advisory says it activates the existing sandbox and blocks writes outside the allowed path. It lists no other mitigation.

Are other tools affected?

Yes. merge_pcap_files, the editcap tools and text2pcap_import share the missing sandbox.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Other MCP servers and tools vulnerabilities

All Other MCP servers and tools entries