Summary
FreeCAD's BIM Workbench evaluates untrusted data from SVG template files when creating TechDraw pages. If a user opens a malicious template, arbitrary Python code may execute with the privileges of the FreeCAD process.
Affected context
The vulnerability occurs in FreeCAD versions from 0.19 through 1.1.1 when the BIM Workbench processes SVG templates for TechDraw pages. Risk depends on a user importing or opening a template that contains data reaching the vulnerable evaluation logic.
Exploit preconditions
- Attack surface: FreeCAD's BIM Workbench and TechDraw template processing
- Required access: Ability to provide or cause a user to open a malicious SVG template
- Trigger point: Creation of a TechDraw page from the SVG template
- Why exploitation is possible: Untrusted template data reaches an
eval()call, allowing embedded expressions to be interpreted as Python code
Why this happens
The underlying bug is the evaluation of untrusted SVG template data as executable Python expressions. This insecure pattern treats file content as code rather than as constrained presentation data, mapping to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code. The absence of a strict data-only parsing boundary allows crafted template content to influence interpreter behavior.
Potential impact
- Arbitrary Python code may execute in the FreeCAD process
- Local files or project data could be read, modified, or deleted
- The user's desktop session could be compromised
- Malicious code could affect connected systems or shared project assets
General mitigation guidance
Mitigation generally focuses on removing dynamic evaluation from template processing and reducing trust in imported document content.
Common defensive patterns include:
- Replacing
eval()with data-only parsing and explicit, allowlisted template substitutions - Treating SVG templates as untrusted input until validated
- Enforcing strict schemas and rejecting unexpected expressions or directives
- Separating rendering data from executable application logic
- Running desktop modeling workflows with least-privilege operating system accounts
- Restricting access to sensitive files and connected services from the application process
- Applying the vendor's security fix or an equivalent code-level remediation
How teams detect issues like this
Detection approaches can include:
- Static analysis rules identifying
eval()or equivalent dynamic execution APIs on file-derived data - Code review checks for template engines that interpolate or execute expressions
- Tests using untrusted SVG fixtures containing unexpected directives or expression syntax
- Repository policies that prohibit dynamic evaluation of imported document content
- Monitoring application behavior for unusual child processes, file access, or network activity after template imports
Automated security scanning and code review tools may help identify similar unsafe evaluation paths.

