T09 · Insecure Skill Coding Practices
- Location
scripts/nl_parser/script_generator.py:553- Finding
Arbitrary Python Code Injection in Generated Drawing Scripts
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This CAD skill is purpose-aligned, but it asks agents to execute generated Python from user-influenced drawing parameters without adequate validation or sandboxing.
Review before installing. Use this skill only in a sandboxed environment with no sensitive credentials or broad filesystem access, constrain outputs to a dedicated directory, and avoid passing untrusted filenames, output paths, or raw parameter dictionaries until generated-code execution is removed or strongly sandboxed.
scripts/nl_parser/script_generator.py:553Arbitrary Python Code Injection in Generated Drawing Scripts
scripts/core/renderer.py:77Unrestricted Output Paths Allow Path Traversal and Arbitrary File Placement
SKILL.md:186Unpinned Third-Party Dependencies Create a Mutable Supply-Chain Risk
User-controlled fields from natural-language extraction are interpolated directly into Python templates via template.format(**safe_params), and many placeholders are inserted into code positions or quoted string literals without escaping or type validation. An attacker can supply crafted values such as quotes, newlines, tuples, or Python expressions to break out of the intended structure and inject arbitrary Python statements that will run if the generated script is executed.
声明描述的是完整的CAD制图/编辑器能力,面向建筑、机械、电气、管道、结构等工程图生成与导出;而实际代码只是一个独立的测量辅助模块,没有任何与图纸生成、图元绘制、文件读写、DXF导出、预览渲染或自然语言解析相关的实现。虽然几何测量可作为CAD系统的支持性组件,但就该代码块本身而言,其主要行为与声明的核心用途存在明显差异,因此应判定为描述与行为不匹配。
The skill explicitly generates Python source from natural-language-derived intent and parameters, then executes it with exec. This creates a code-injection pathway where malformed or adversarial input, template compromise, or parser/generator bugs could lead to arbitrary code execution, filesystem access, or command execution under the agent's privileges.
The documentation omits any warning that the workflow may execute generated Python code and write files to disk. Users and integrators may therefore invoke the skill without understanding that it performs high-risk actions, reducing informed consent and increasing the likelihood of unsafe deployment in environments with sensitive data or excessive privileges.
This component is explicitly designed to translate natural language into executable Python source code and return that code as a string. In a CAD skill context, generating code rather than a constrained intermediate representation greatly increases the attack surface because any downstream execution step turns parser mistakes or unsafe template expansion into code-execution risk.
The skill documents file-reading and code-driven behavior but declares no explicit tool scope or permissions boundary. In an agent environment, this increases the chance that the skill is granted broader filesystem access than users or reviewers expect, which can enable unintended data exposure or misuse when combined with dynamic code generation.
The trigger vocabulary includes very broad terms such as generic CAD/drawing-related words, making accidental invocation more likely. Over-broad activation is dangerous here because the skill can proceed into code generation, file access, and output creation, increasing exposure to unsafe behavior from ordinary conversation context.
The activation rules allow use whenever the user mentions broad domains like architecture, mechanical, electrical, piping, or structural topics, even without a clear request to generate drawings. This broad scope increases the chance the skill runs in irrelevant contexts, which is more dangerous because the workflow includes dynamic script generation and execution.
The metadata description states this is a "CAD Editor NL意图模板库" and all listed natural-language intent patterns and examples are exclusively in Chinese. There is no indication of user language choice, opt-in, or a documented reason that the skill is intentionally limited to a Chinese locale, which can violate language/locale policy requirements.
This code file contains user-facing natural-language text exclusively in Chinese, including the module docstring and function documentation. Under the policy, forcing a specific language without offering a language choice or documenting a justified locale constraint is a natural-language policy violation.
The module docstring and class documentation are entirely in Chinese, including user-facing descriptions of the skill's purpose and behavior. If organizational policy requires not forcing a specific language without user opt-in, this natural-language choice can exclude users and constitutes a locale/language policy concern.
The docstrings and inline descriptive text in this file are all Chinese, which can impose a specific language on users or maintainers without opt-in. Under the policy, language constraints should either offer user choice or be clearly documented as justified for a specific locale.
The file’s user-facing natural-language content, including the module docstring and function/doc comments, is written exclusively in Chinese. Under the policy, forcing a specific language without user opt-in is a locale/language policy concern, and this file does not document any language choice or region-specific justification.
The natural-language strings in the module and function docstrings are exclusively Chinese (e.g. "DXF → PDF 导出" and "导出为 PDF 文件"), which indicates a fixed language choice without any visible opt-in or justification. Under the policy, forcing a specific language or locale without user choice is a natural-language policy violation.
The file’s user-facing natural language content, including module/class docstrings, comments, error messages, and method descriptions, is written exclusively in Chinese. Under the stated policy, forcing a specific language without offering user choice or documenting a justified region-specific scope is a natural-language policy violation.
This code includes natural-language strings such as the module description and later debug/warning text exclusively in Chinese, which can force a language/locale on users or operators. The policy allows locale constraints only when they are explicitly documented and justified or when users are offered a choice, neither of which appears here.
This code file contains natural-language descriptions, docstrings, and comments exclusively in Chinese, including the top-level module description and class workflow text. That effectively imposes a specific language on users or maintainers without any opt-in or documented locale limitation, which matches the language/locale policy violation criterion.
The module docstring is written entirely in Chinese and the generated annotation text later uses a fixed Chinese label, indicating the skill is designed to emit a specific language by default. There is no visible option for users to choose locale or any documentation that this is intentionally limited to a Chinese-specific environment.
The code constructs arrow_text using the Chinese character 上 and writes it into the drawing, which enforces a specific language in user-visible output. No configuration or parameter allows callers to select another language or suppress the locale-specific label.
The module docstring and class docstring are written entirely in Chinese, and subsequent docstrings/comments continue that language choice. This creates a locale/language policy concern because the skill content appears to require a specific language without offering any user choice or documenting that the skill is intentionally region-specific.
The docstring at L145-L146 states the function returns only the foundation outline and reinforcement entities. In reality, the code also generates concrete hatch fill and text annotations, while the hatch fill call at L179 is executed without being appended to the returned ents list, so the documented return intent does not match the implementation behavior.
The docstring at L223-L224 explicitly says the function creates a plan view plus a simplified section. However, the code only draws centered rectangles, hatch, axis lines, and size text in a single 2D plan representation, with no separate section geometry or section annotation present.
This file’s natural-language content, including the module docstring, class docstrings, and inline comments, is entirely in Chinese. Under the stated policy, forcing a specific language without user opt-in or a documented region-specific justification is a natural-language policy violation.
This markdown file presents all instructions and reference content exclusively in Chinese, which can constitute a language/locale policy issue when no user opt-in or justification is provided. The stated policy requires flagging cases where a skill forces a specific language without offering choice.
This markdown reference forces a specific language/locale for all instructions and examples, which can violate language-choice policy when no user opt-in or justification is provided. There is no indication anywhere in the file that Chinese is optional, selectable, or required for a region-specific purpose.
No suspicious patterns detected.