{"id":"CVE-2026-43901","aliases":["CVE-2026-43901","GHSA-3r68-x3xc-rxpg","PYSEC-2026-3426"],"related":[],"kind":"vulnerability","state":"published","title":"Wireshark MCP: Arbitrary file write via export_objects when WIRESHARK_MCP_ALLOWED_DIRS is not configured","summary":"Wireshark MCP is an MCP Server that turns tshark into a structured analysis interface, then layers in optional Wireshark suite utilities. In 1.1.5 and earlier, 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Wireshark MCP is an MCP Server that turns tshark into a structured analysis interface, then layers in optional Wireshark suite utilities. In 1.1.5 and earlier, 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.","source":"cvelist"},{"lang":"en","text":"## Description\n\n### Impact\n\n`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**.\n\nThe 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.\n\n**Affected code** (`src/wireshark_mcp/tshark/client.py:531-543`):\n\n```python\n\noutput_validation = self._validate_output_path(dest_dir)\n\n# _validate_output_path only enforces the sandbox when _allowed_dirs is set.\n\n# Default: _allowed_dirs = None → no restriction.\n\nos.makedirs(dest_dir, exist_ok=True)   # creates arbitrary directories\n\ncmd = [..., \"--export-objects\", f\"{protocol},{dest_dir}\"]\n\n```\n\n### Attack Scenario\n\nAn 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:\n\n```bash\n\ndest_dir=/home/user/.ssh/\n\n```\n\n`tshark` then extracts and writes the HTTP object to that path, granting the attacker SSH access.\n\nThe same technique can target:\n\n- `/etc/cron.d/`\n\n- Writable web roots\n\n- Other sensitive filesystem locations\n\n### Additional Affected Operations\n\nThe same missing sandbox affects:\n\n- `merge_pcap_files`\n\n- `editcap_trim`\n\n- `editcap_split`\n\n- `editcap_time_shift`\n\n- `editcap_deduplicate`\n\n- `text2pcap_import`\n\n### Proof of Concept\n\nConfirmed on **wireshark-mcp v1.1.5** with **tshark 4.6.4**.\n\nA crafted pcap’s HTTP object was successfully written to an arbitrary filesystem path when:\n\n```python\n\n_allowed_dirs = None\n\n```\n\n---\n\n## Patches\n\nNot yet patched.\n\nA fix should make the path sandbox **mandatory** for all file-write operations rather than optional:\n\n```python\n\n# Reject all write operations when no sandbox is configured\n\nif not self._allowed_dirs:\n\n    return json.dumps({\n\n        \"success\": False,\n\n        \"error\": {\n\n            \"type\": \"SecurityError\",\n\n            \"message\": \"Set WIRESHARK_MCP_ALLOWED_DIRS before using file-write operations\"\n\n        }\n\n    })\n\n```\n\n---\n\n## Workarounds\n\nSet `WIRESHARK_MCP_ALLOWED_DIRS` to a restricted safe directory before starting the server:\n\n```bash\n\nexport WIRESHARK_MCP_ALLOWED_DIRS=/tmp/wireshark_mcp_safe\n\n```\n\nThis activates the existing sandbox and blocks writes outside the allowed path.\n\n---\n\n## Resources\n\n- Vulnerable code:\n\n  - `src/wireshark_mcp/tshark/client.py` lines 521–543\n\n  - `src/wireshark_mcp/tshark/client.py` lines 685–839\n\n- CWE-22: Improper Limitation of a Pathname to a Restricted Directory\n\n- CWE-73: External Control of File Name or Path","format":"markdown","source":"ghsa"},{"lang":"es","text":"Wireshark MCP es un servidor MCP que convierte tshark en una interfaz de análisis estructurado, y luego incorpora utilidades opcionales de la suite Wireshark. En 1.1.5 y versiones anteriores, wireshark-mcp expone una herramienta MCP wireshark_export_objects que acepta un parámetro dest_dir controlado por el atacante y lo pasa al indicador --export-objects de tshark sin ninguna restricción de ruta obligatoria. La sandbox de ruta (_allowed_dirs) es None por defecto y solo se activa cuando la variable de entorno WIRESHARK_MCP_ALLOWED_DIRS se establece explícitamente. En una instalación por defecto, cualquier directorio en el sistema de archivos puede ser utilizado como destino de exportación.","source":"nvd"}],"published":"2026-05-05T20:15:12.000Z","modified":"2026-10-26T18:10:00.173Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"<= 1.1.5","status":"affected"}],"vendor":"bx33661","product":"Wireshark-MCP","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"1.1.5"}],"ecosystem":"PyPI","package":"wireshark-mcp","purl":"pkg:pypi/wireshark-mcp","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"1.1.5"}],"vendor":"bx33661","product":"wireshark_mcp","cpe":"cpe:2.3:a:bx33661:wireshark_mcp:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"1.1.5"}],"ecosystem":"PyPI","package":"wireshark-mcp","purl":"pkg:pypi/wireshark-mcp","source":"pysec"}],"references":[{"url":"https://github.com/bx33661/Wireshark-MCP/security/advisories/GHSA-3r68-x3xc-rxpg","tags":["exploit","mitigation","patch","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-43901","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/bx33661/Wireshark-MCP","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/wireshark-mcp","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-3r68-x3xc-rxpg","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-05-13T14:28:15.407Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-43901","url":"https://www.cve.org/CVERecord?id=CVE-2026-43901","licence":"CVE Terms of Use","modified":"2026-05-13T14:38:55.840Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3r68-x3xc-rxpg","url":"https://github.com/advisories/GHSA-3r68-x3xc-rxpg","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:07.322Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-43901","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-43901","licence":"Public domain","modified":"2026-10-26T18:10:00.173Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3426","url":"https://osv.dev/vulnerability/PYSEC-2026-3426","licence":"CC-BY-4.0","modified":"2026-07-13T16:33:05.760Z"}],"updatedAt":"2026-11-25T22:59:21.310Z","epss":{"score":0.00311,"percentile":0.25815,"date":"2026-12-01T12:00:22.000Z"}}