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.
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 surface | Blast radius | Concrete control |
|---|---|---|
Variant export variant argument | Arbitrary file overwrite outside workspace | Realpath containment check before write |
Variant export output_name argument | Full path component control, directory creation outside root | Reject absolute paths and .. segments, enforce root prefix |
| MCP profiles exposing variant tools | Agent steered by indirect prompt injection can trigger writes | Profile allowlisting, tool-call authorization |
| MCP server deployment | Local caller with tool access can write arbitrary files | Network 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.
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 CVE-2026-141546 advisory
Reader Q&A
Frequently Asked Questions
Which KiCad MCP Pro versions are affected by CVE-2026-141546?
What attacker requirements are needed to exploit this path traversal?
How can I verify the fix without upgrading immediately?
Bibliography & Verification
Primary Sources & References
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.
Keep Reading
Related Dispatches
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.