GitHub advisory · PyPI
KiCad MCP Pro: Variant export tools write outside KICAD_MCP_WORKSPACE_ROOT via unvalidated variant and output_name arguments
Description
The three variant export tools build their output path by joining an unvalidated tool argument onto the output directory, so the write lands wherever that argument points. KICAD_MCP_WORKSPACE_ROOT does not contain it.
Both variant and output_name work. variant has a suffix appended (_bom.csv, _gerber), while output_name has none, so with output_name the caller controls the entire final path component.
It overwrote a pre-existing file outside the workspace root, wrote to an absolute path outside it, and created directories outside it with no KiCad installed at all.
This is the same class as GHSA-h93v-ccrj-58fw, which was fixed in 4.15.1, in a module that fix did not touch. PR #1720 changed only src/kicad_mcp/project/creation.py and two test files, and added no shared guard, so the pattern survives in 4.20.0.
Tested on:
kicad-mcp-pro 4.20.0 from PyPI (latest). Everything below ran against the installed wheel; the checkout only supplied line numbers, which match.Anyone who can call these MCP tools can write and overwrite files outside the configured workspace root. That is the attacker model your own advisory for GHSA-h93v-ccrj-58fw describes, including an agent steered by prompt injection from a datasheet, a component description or a project file.
Attacker requirements:
default profile. I enumerated tools_for_profile at runtime: they appear in agent_full, builder, critic, expert, full, high_speed, power, schematic, schematic_authoring, schematic_only and simulation. Your .env.example:48 documents KICAD_MCP_PROFILE=full, and server.py:2388-2399 materialises the…Manual fix · PyPI
pip install --upgrade "kicad-mcp-pro>=4.20.1"Sources