Skip to main content

KiCad MCP Pro Path Traversal CVE-2026-141546 Defense Teardown

Defensive teardown of KiCad MCP Pro variant export path traversal (CVE-2026-141546), affected versions, sandbox isolation, and guardrail verification code.

AI SECURITY Security Advisory
KiCad MCP Pro variant export path traversal threat radar card for CVE-2026-141546
KiCad MCP Pro variant export path traversal threat radar card for CVE-2026-141546 Source: radar.offseq.com
Field Note · The Short Version 3 min read

Upgrade KiCad MCP Pro to 4.20.1 or enforce realpath workspace containment on variant export tool arguments to block CVE-2026-141546 path traversal writes.

Key Numbers & Verified Specs

6 metrics
Metric / Spec Verified Finding Source
CVE identifier CVE-2026-141546 advisories.gitlab.com
Affected versions All versions before 4.20.1 advisories.gitlab.com
Fixed version 4.20.1 advisories.gitlab.com
CVSS 3.1 base score 5.0 Medium (AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:N) radar.offseq.com
Weakness class CWE-22 Improper Limitation of a Pathname to a Restricted Directory github.com
Guardrail p95 latency overhead Not measured in advisory; benchmark before production rollout advisories.gitlab.com
Jump to section (7) +

KiCad MCP Pro versions before 4.20.1 allow variant export tools to write outside KICAD_MCP_WORKSPACE_ROOT because the variant and output_name arguments are joined to the output directory without validation. This advisory teardown covers the failure mechanics, why naive filters miss the issue, a sandbox isolation architecture, runnable guardrail code, and verification steps.

Threat Model & Attack Surface Matrix

Affected profiles

Profiles exposing variant export tools include agent_full, builder, critic, expert, full, high_speed, power, schematic, schematic_authoring, schematic_only, and simulation.

Attack surfaceBlast radiusConcrete control
Variant export variant argumentArbitrary file overwrite outside workspaceRealpath containment check before write
Variant export output_name argumentFull path component control, directory creation outside rootReject absolute paths and .. segments, enforce root prefix
MCP profiles exposing variant toolsAgent steered by indirect prompt injection can trigger writesProfile allowlisting, tool-call authorization
MCP server deploymentLocal caller with tool access can write arbitrary filesNetwork isolation, least-privilege filesystem mounts

The advisory notes that variant receives a suffix (_bom.csv, _gerber) while output_name controls the entire final path component. Both can overwrite pre-existing files outside the workspace, write to absolute paths outside it, and create directories outside it with no KiCad installed. This is CWE-22, Improper Limitation of a Pathname to a Restricted Directory.

Why Naive Prompt Filters Fail

Prompt filters operate on natural-language input and cannot reliably catch structured tool arguments. An agent steered by indirect prompt injection from a datasheet, component description, or project file can emit a malicious output_name such as ../../etc/passwd or an absolute path like /tmp/malicious.cfg. Keyword filters looking for .. miss encoded variants, Unicode normalization tricks, and absolute paths that contain no traversal sequences. The root cause is missing server-side path containment, not user input language.

Defense-in-Depth & Sandbox Isolation Architecture

Upgrade to kicad-mcp-pro 4.20.1 immediately. Until then, enforce containment at the MCP transport layer. Run the MCP server inside a user namespace or container with a read-only filesystem outside KICAD_MCP_WORKSPACE_ROOT, and mount the workspace root as the only writable path. Drop capabilities such as CAP_DAC_OVERRIDE so the server process cannot follow symlinks to sensitive host files. Use an MCP proxy that authorizes tool calls by profile and logs every variant export invocation.

Runnable Guardrail Policy / Verification Code

Test cases for validate_export_path

  • Absolute path input must raise ValueError.
  • Path containing .. segment must raise ValueError.
  • Symlink escape outside workspace root must raise ValueError.
  • Relative path inside workspace root must return resolved path.
Python23 lines
import os
from pathlib import Path

WORKSPACE_ROOT = os.environ.get("KICAD_MCP_WORKSPACE_ROOT", "/workspace")
ROOT_REAL = os.path.realpath(WORKSPACE_ROOT)

def validate_export_path(candidate: str) -> str:
    """Return a safe absolute path inside the workspace root or raise."""
    if not candidate:
        raise ValueError("empty path argument")
    if os.path.isabs(candidate):
        raise ValueError("absolute paths are not allowed")
    if ".." in Path(candidate).parts:
        raise ValueError("parent directory segments are not allowed")
    joined = os.path.join(ROOT_REAL, candidate)
    resolved = os.path.realpath(joined)
    if resolved != ROOT_REAL and not resolved.startswith(ROOT_REAL + os.sep):
        raise ValueError("path escapes workspace root")
    return resolved

# Example: wrap variant export tool calls
# safe_path = validate_export_path(tool_args.get("output_name", ""))
# safe_path = validate_export_path(tool_args.get("variant", ""))

Run this check before every file write in tools/variants.py. Verify with python -m pytest tests/variants/ after applying the patch, and confirm pip show kicad-mcp-pro reports version 4.20.1 or higher.

Operational Tradeoffs & False-Positive Budget

Realpath validation adds measurable latency per path validation call under Linux container workloads; the advisory does not publish a benchmark, so measure p50 and p95 on your target hardware before production rollout. False positives occur when legitimate exports use symlinked output directories inside the workspace; resolve symlinks at deployment time and document allowed output names. Do not rely on prompt filtering alone. The fix does not address authentication gaps; combine it with MCP authorization and network segmentation.

KiCad MCP Pro variant export path traversal threat radar card
KiCad MCP Pro variant export path traversal threat radar card

KiCad MCP Pro CVE-2026-141546 advisory

GitHub Advisory GHSA-wfmg-598x-58c5

OffSeq Threat Radar record

Reader Q&A

Frequently Asked Questions

Which KiCad MCP Pro versions are affected by CVE-2026-141546?
All versions before 4.20.1 are affected. Version 4.20.1 contains the patch. The flaw persists in 4.20.0 because PR #1720 only touched src/kicad_mcp/project/creation.py and did not add a shared path guard for variant export tools.
What attacker requirements are needed to exploit this path traversal?
One MCP tool call with chosen variant or output_name arguments, access to a profile that exposes the variant export tools (agent_full, builder, critic, expert, full, high_speed, power, schematic, schematic_authoring, schematic_only, or simulation), and an active project. No KiCad GUI, IPC connection, second user, or authentication step is required.
How can I verify the fix without upgrading immediately?
Run the realpath containment checker below against every variant export output path before write. Confirm that os.path.realpath(candidate).startswith(os.path.realpath(KICAD_MCP_WORKSPACE_ROOT) + os.sep) or equals the root exactly, and reject any path that escapes.

Bibliography & Verification

Primary Sources & References

3 cited sources
  1. [01] advisories.gitlab.com pypi / kicad-mcp-pro / CVE-2026-141546
  2. [02] github.com advisories / GHSA-wfmg-598x-58c5
  3. [03] radar.offseq.com threat / kicad-mcp-pro-variant-export-tools-write-outside-kicadmcpworks…

Human × Agent Co-Work

Hamdi Soudani · in collaboration with Pyvren

Systems engineer & technical writer exploring AI infrastructure, security, and edge craft in daily collaboration with Pyvren.

Hamdi Soudani × Pyvren

Honest engineering stories — co-crafted with primary benchmarks & real code

Every dispatch blends hands-on engineering judgment with verified primary sources, reproducible configs, and clear tradeoffs.