Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

CVE-2026-141546: CVE-2026-141546: Path Traversal and Arbitrary File Write in KiCad MCP Pro Variant Export Tools

CVE-2026-141546: Path Traversal and Arbitrary File Write in KiCad MCP Pro Variant Export Tools Vulnerability ID: CVE-2026-141546 CVSS Score: 5.0 Published: 2026-12-03 CVE-2026-141546 (GHSA-wfmg-598x-58c5) is a path

CVE-2026-141546: Path Traversal and Arbitrary File Write in KiCad MCP Pro Variant Export Tools

Vulnerability ID: CVE-2026-141546
CVSS Score: 5.0
Published: 2026-12-03

CVE-2026-141546 (GHSA-wfmg-598x-58c5) is a path traversal vulnerability (CWE-22) in KiCad MCP Pro prior to version 4.20.1. Three variant export tools in src/kicad_mcp/tools/variants.py construct target output paths by joining unvalidated user-supplied arguments directly onto the validated output directory using Python's pathlib.Path concatenation operator. A caller invoking these tools with path traversal sequences or absolute file paths can bypass the KICAD_MCP_WORKSPACE_ROOT confinement boundary to create directories and write or overwrite arbitrary files on the host filesystem.

TL;DR

KiCad MCP Pro versions prior to 4.20.1 fail to validate the 'variant' and 'output_name' parameters in three variant export tools after verifying the workspace root. An attacker or untrusted AI agent with access to a schematic-capable profile and an active project can use relative path traversal or absolute paths to write files and create directories outside KICAD_MCP_WORKSPACE_ROOT. Upgrading to version 4.20.1 remediates the flaw.

⚠️ Exploit Status: POC

Technical Details

  • CVE ID: CVE-2026-141546 (GHSA-wfmg-598x-58c5)
  • Weakness Class: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
  • CVSS v3.1 Score: 5.0 Medium (CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:N)
  • Affected Component: src/kicad_mcp/tools/variants.py (variant_export_bom, variant_export_schematic, variant_export_manufacturing_package)
  • Attack Vector: Local / MCP Tool Invocation with crafted 'variant' or 'output_name' arguments
  • Primary Impact: Arbitrary File Write / Overwrite and Directory Creation outside KICAD_MCP_WORKSPACE_ROOT
  • Exploit Status: Proof-of-Concept (Regression tests in PR #1806)
  • Patched Version: 4.20.1 (Commit 1ddb8ce1d3a8a67d4670f947a582d07c9ba29130)

Affected Systems

  • KiCad MCP Pro (PyPI: kicad-mcp-pro)
  • KiCad MCP Pro (npm: kicad-mcp-pro)
  • kicad-mcp-pro (PyPI): < 4.20.1 (Fixed in: 4.20.1)
  • kicad-mcp-pro (npm): < 4.20.1 (Fixed in: 4.20.1)

Code Analysis

Commit: 1ddb8ce

fix(security): constrain variant export artifact paths (#1806)

def _safe_variant_export_path(output_dir: Path, variant: str, filename: str) -> Path:
    """Keep variant-generated artifacts within their designated output directory."""
    for value in (variant, filename):
        if (
            not value
            or value in {".", ".."}
            or any(char in value for char in ("/", "\\", ":", "\x00"))
        ):
            raise ValueError("Variant export names must be single filename components.")
    return resolve_under(output_dir, filename, allow_absolute=False)

Exploit Details

  • GitHub: Regression test suite in tests/unit/test_variant_export_path_safety.py demonstrating path traversal and absolute path breakout payloads.

Mitigation Strategies

  • Upgrade KiCad MCP Pro to version 4.20.1 or newer across all Python (PyPI) and Node.js (npm) deployments.
  • Use the default MCP tool profile rather than schematic-capable profiles unless variant export functionality is strictly necessary.
  • Run the MCP server process inside a container or OS-level sandbox with bind mounts restricting filesystem write access exclusively to KICAD_MCP_WORKSPACE_ROOT.

Remediation Steps:

  1. Update the Python package by running: pip install --upgrade 'kicad-mcp-pro>=4.20.1'
  2. Clear cached uv environments if using uvx: uv cache clean kicad-mcp-pro && uvx [email protected]
  3. Update the npm wrapper package if installed via Node.js: npm install [email protected]
  4. Restart any active MCP client sessions (such as Claude Code, Claude Desktop, or Gemini CLI) to load the patched 4.20.1 server binary.

References

Read the full report for CVE-2026-141546 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.