Back to skill

Security audit

cpn_modeling_tool

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent CPN modeling helper, but its generated HTML visualization can execute injected script if untrusted process text is embedded without safe escaping.

Review before installing. This skill appears intended for CPN/Petri-net modeling and does not contain backdoors or credential access, but generated HTML should not be opened on process descriptions from untrusted users unless the template is fixed to safely serialize JSON and prevent </script> injection.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
references/html-viz-template.md:110
Finding

Stored Script Injection Through Unsafe JSON Interpolation

Content
View full analysis
const data = __CPN_DATA__; document.getElementById('pid').textContent = data.project_id; ``` The Skill instructs the agent to replace `__CPN_DATA__` with a JSON object derived from the user's natural-language business description and then write the resulting HTML to `/tmp/.html`. No HTML script-context escaping or safe serialization requirement is imposed. ### Technical Analysis The JSON schema permits unrestricted string values for fields such as project IDs, place names, transition names, guards, annotations, subprojects, chains, and dependency descriptions. These values may originate from untrusted user input. JSON string escaping alone does not make data safe for direct insertion into an HTML `` sequence even when it appears inside what JavaScript would otherwise treat as a quoted string. Consequently, an attacker-controlled model value can terminate the original script element and introduce a new executable script. For example, a crafted business entity or project name could contain a value structurally equivalent to: ```text ``` If preserved in the generated JSON, direct placeholder replacement causes the browser to parse the attacker-controlled second script when the local HTML file is opened. The later use of `textContent` does not mitigate this vulnerability because execution occurs during HTML parsing, before the JSON value is accessed by application code. ### Attack Path 1. An attacker provides a business-process description containing a crafted project, state, action, role, or resource name with a `` ...[truncated 1397 chars]
Remediation
View remediation
SAFE_SERIALIZED_DATA ``` 2. **Apply HTML-safe JSON serialization.** At minimum, replace characters and sequences that can affect HTML parsing: - `<` with `\u003c` - `>` with `\u003e` - `&` with `\u0026` - U+2028 with `\u2028` - U+2029 with `\u2029` Escaping `<` prevents an attacker-controlled `` sequence from being interpreted as markup. 3. **Validate identifier fields.** Restrict machine identifiers such as `project_id`, place IDs, transition IDs, and arc IDs to a conservative allowlist, for example: ```text ^[A-Za-z0-9_-]+$ ``` Human-readable labels should remain separate from machine identifiers and must be safely encoded for their destination context. 4. **Add a restrictive Content Security Policy.** Move application JavaScript into a fixed local script file and disallow inline scripts where practical. A policy without `unsafe-inline` provides defense in depth against injected script elements. 5. **Add regression tests** covering malicious values in every user-derived string field, including: ```text < & U+2028 and U+2029 ``` Tests should generate the HTML, open or parse it with a browser-compatible test harness, and verify that no additional script element is created or executed. 6. **Document contextual output encoding requirements** in both `SKILL.md` and the HTML template instructions so implementations do not rely on ordinary JSON escaping as an HTML security boundary. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (19)

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger description is extremely broad, covering not only explicit CPN/Petri-net requests but also generic statements like 'help me draw a process' or any scenario involving sequential dependencies. This can cause the skill to activate for ordinary workflow, ordering, approval, or business-analysis requests, leading to unintended tool use, over-collection of structured process details, and behavior outside the user's likely expectations.

Content

No source excerpt is available for this finding.

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/cpn-xml-template.md (reported line 12)May include surrounding context.

md
<workspaceElements>
  <cpnet>

    <!-- ── 颜色集合(全局定义)── -->
    <globbox>
      <block id="ID1">
        <id>ColorSets</id>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/cpn-xml-template.md (reported line 12)May include surrounding context.

md
<workspaceElements>
  <cpnet>

    <!-- ── 颜色集合(全局定义)── -->
    <globbox>
      <block id="ID1">
        <id>ColorSets</id>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/cpn-xml-template.md (reported line 106)May include surrounding context.

md
<page id="PAGE2">
      <pageattr name="备餐阶段"/>

      <!-- DEP4: fusion_place — 与 PAGE1.P2 共享 token,库存充足才能备餐 -->
      <place id="P2_fusion">
        <posattr x="100" y="150"/>
        <text>订单_已接收</text>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/cpn-xml-template.md (reported line 106)May include surrounding context.

md
<page id="PAGE2">
      <pageattr name="备餐阶段"/>

      <!-- DEP4: fusion_place — 与 PAGE1.P2 共享 token,库存充足才能备餐 -->
      <place id="P2_fusion">
        <posattr x="100" y="150"/>
        <text>订单_已接收</text>

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The primary descriptive instruction is presented in Chinese and the document does not indicate that users may choose another language or that the skill is limited to a Chinese-speaking or region-specific context. This can violate language/locale policy because it implicitly constrains interaction language without explicit user opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill content is written to operate in Chinese and prescribes Chinese-language prompts and interaction patterns without checking the user's preferred language. This can override user expectations, reduce transparency around what the agent is doing, and increase the chance of misunderstanding during a multi-step elicitation flow that collects structured process information.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill instructs the agent to use a Write tool to create an HTML file under /tmp, which expands behavior from pure modeling guidance into filesystem side effects. Even though the file content is intended for visualization, writing agent-generated HTML to disk can create persistence, enable unexpected local file creation, and increase risk if the generated content later includes unsafe script or user-controlled data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The entire skill example and explanatory text are written in Chinese, and there is no indication that users may choose another language or that the file is intentionally limited to a Chinese-speaking or region-specific audience. Under the policy, a fixed language without user opt-in or clear justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/html-viz-template.md (reported line 164)May include surrounding context.

js
// ── 自动布局(最长路径算法,保证所有正向弧从左往右)──
const allNodes = [...data.places, ...data.transitions];
const spList = [...new Set(allNodes.map(n => n.subproject).filter(Boolean))];

// 资源库所:有初始 token,且同一变迁既消耗又归还(循环弧)
const resourcePlaceIds = new Set(

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/html-viz-template.md (reported line 218)May include surrounding context.

js
// ── 自动布局(最长路径算法,保证所有正向弧从左往右)──
const allNodes = [...data.places, ...data.transitions];
const spList = [...new Set(allNodes.map(n => n.subproject).filter(Boolean))];

// 资源库所:有初始 token,且同一变迁既消耗又归还(循环弧)
const resourcePlaceIds = new Set(

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/html-viz-template.md (reported line 234)May include surrounding context.

js
// ── 自动布局(最长路径算法,保证所有正向弧从左往右)──
const allNodes = [...data.places, ...data.transitions];
const spList = [...new Set(allNodes.map(n => n.subproject).filter(Boolean))];

// 资源库所:有初始 token,且同一变迁既消耗又归还(循环弧)
const resourcePlaceIds = new Set(

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/html-viz-template.md (reported line 446)May include surrounding context.

js
// ── 自动布局(最长路径算法,保证所有正向弧从左往右)──
const allNodes = [...data.places, ...data.transitions];
const spList = [...new Set(allNodes.map(n => n.subproject).filter(Boolean))];

// 资源库所:有初始 token,且同一变迁既消耗又归还(循环弧)
const resourcePlaceIds = new Set(

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/html-viz-template.md (reported line 455)May include surrounding context.

js
// ── 自动布局(最长路径算法,保证所有正向弧从左往右)──
const allNodes = [...data.places, ...data.transitions];
const spList = [...new Set(allNodes.map(n => n.subproject).filter(Boolean))];

// 资源库所:有初始 token,且同一变迁既消耗又归还(循环弧)
const resourcePlaceIds = new Set(

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This file contains user-facing natural-language instructions and examples exclusively in Chinese, including the title, section headings, and explanatory text. Under the language/locale policy, forcing a specific language without user opt-in can be a policy violation unless the locale restriction is explicitly justified, which is not stated here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

L003 documents a strict modeling constraint: for HTML generation, a guard_condition rule's predecessor must be a place ID. However, the actual guard_condition dependency in L077-L080 sets predecessor to 厨房链.出餐, which is a chain-qualified activity/transition-style reference rather than a place ID such as P5 or P4. This is an active contradiction between the file's documentation and its own example content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The template hard-codes lang="zh-CN", which imposes a specific language/locale on generated output. The document does not indicate that this is optional or user-selected, so it appears to violate the policy against forcing a locale without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file contains user-facing natural-language instructions and schema documentation only in Chinese. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains instructional content exclusively in Chinese and does not mention that the language is optional, selectable, or intended for a specific regional audience. Under the policy rule, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.