Back to skill

Security audit

乌龟图流程技能

Security checks for vulnerabilities and agentic risk

Overview

This diagram-generation skill appears purpose-aligned, but its script can write output paths too broadly and can embed unescaped user text into active SVG files.

Review before installing. Use this only with trusted diagram content, avoid opening generated SVGs from untrusted inputs in a privileged browser context, and write outputs only to explicit safe filenames in a controlled directory. The publisher should escape SVG text and constrain output paths before broad use.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/process_turtle.py:112
Finding

Unescaped configuration values permit active SVG/XML injection

Content
View full analysis
str: return f'''{text}''' def _node(self, x: int, y: int, name: str, node_type: str = 'process', color: str = None) -> str: w, h = self.STYLES['node_width'], self.STYLES['node_height'] r = self.STYLES['radius'] if color is None: color = self.COLORS['node'].get(node_type, self.COLORS['node']['process']) if node_type == 'start' or node_type == 'end': return f''' {name}''' elif node_type == 'decision': s = self.STYLES['decision_size'] points = f"{x},{y-s//2} {x+s//2},{y} {x},{y+s//2} {x-s//2},{y}" return f''' {name}''' else: return f''' {name}'' ...[truncated 3350 chars]
Remediation
View remediation
str: return escape(str(value), { '"': """, "'": "'", }) ``` Apply this function consistently to: - `config.title` - `node.name` - `node.category` and lane names - `edge.label` - Any future user-controlled attribute or text value 2. Prefer an XML construction library such as `xml.etree.ElementTree` rather than assembling SVG through formatted strings. Assign untrusted content through element `.text` fields so the serializer performs escaping. 3. Validate configuration values before generation. Enforce expected types, reasonable length limits, and allowed values for fields such as node type and turtle category. 4. If generated SVGs are served by a web application, apply defense in depth: - Serve them with `Content-Type: image/svg+xml`. - Use `Content-Disposition: attachment` when inline display is unnecessary. - Apply a restrictive Content Security Policy. - Serve untrusted SVGs from an isolated origin without sensitive cookies. - Consider sanitizing SVG output or converting it to a non-active raster format before publication. 5. Add regression tests using benign metacharacters and malicious payloads: ```text A & B ``` Verify that these values appear only as escaped text and cannot create new SVG elements. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/process_turtle.py:522
Finding

Unrestricted output name permits path traversal and arbitrary SVG file overwrite

Content
View full analysis
Remediation
View remediation
Path: base = Path(output_dir).resolve() # Treat the supplied value as a filename, not a path. name = Path(requested_name).name name = re.sub(r"[^A-Za-z0-9._-]+", "_", name).strip("._") if not name: name = "diagram" destination = (base / f"{name}.svg").resolve() if destination.parent != base: raise ValueError("Output path escapes the allowed directory") return destination ``` 2. Reject absolute paths, `..` components, directory separators, null bytes, and platform-specific path prefixes in user-controlled output names. 3. Do not derive a filesystem path directly from `config.title`. Keep the human-readable title separate from a sanitized filename. 4. Create the output directory with restrictive permissions and ensure the process runs with least privilege. 5. Prevent silent replacement of existing files. Use exclusive creation when overwriting is not intended: ```python with open(destination, "x", encoding="utf-8") as f: f.write(content) ``` Alternatively, require explicit user confirmation or an `--overwrite` flag. 6. Apply the same containment checks to the PNG destination produced by `save_png`. 7. Add tests covering: - `../outside` - `../../public/asset` - Absolute Unix paths - Windows drive and UNC paths - Existing destination files - Symlinks inside the output directory that point outside it ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs reading user-provided config files and writing SVG/PNG outputs, but it does not declare any tool scope such as permissions or allowed-tools. That creates an authorization ambiguity: an agent may perform file reads/writes beyond what is minimally required, increasing the risk of unintended workspace access or unsafe file creation if paths are not constrained elsewhere.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

该技能整体名称、说明、示例和操作指引均固定为中文表述,但未说明这是面向特定中文用户群体的区域性技能,也未提供语言选择或根据用户语言切换的说明。按规则,这可能构成语言/locale 策略上的自然语言约束问题。

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases include broad natural-language requests like '画流程图' and '可视化XX流程', which can overlap with ordinary conversation and cause accidental activation. Mis-triggering a file-writing skill can lead to unintended processing of user content, unnecessary file generation, or chaining into script execution without sufficiently explicit user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and user-facing descriptions indicate the skill is designed around a single language/locale. Because the file does not offer user opt-in or explain that the tool is intended only for a Chinese-speaking context, it creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The argparse description and help text are presented only in Chinese, and the script does not provide any mechanism for the user to select another language. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file title and all instructional content are written exclusively in Chinese, with no indication that the user may choose another language or that the template is intentionally restricted to a Chinese-speaking context. Under the language/locale policy, a forced locale without opt-in or justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.