Back to skill

Security audit

AI科研全流程助理

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent academic assistant, but its HTML report generator has concrete stored JavaScript injection risks and loads a remote chart script when reports are opened.

Install only if you are comfortable with a Chinese-focused academic assistant that writes local HTML reports. Treat generated reports as active web pages: avoid opening reports built from untrusted or adversarial input, and prefer a patched version that validates module names, safely embeds JSON, avoids inline scripts, and vendors or integrity-pins Chart.js.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_report.py:62
Finding

Stored HTML and JavaScript Injection Through Unvalidated Module Identifiers

Content
View full analysis
{info["icon"]} {info["name"]}' return tabs_html def make_module_content(data, modules): """生成所有模块内容""" all_html = "" for i, m in enumerate(modules): module_data = data.get(m, {}) active = "active" if i == 0 else "" content = render_module(m, module_data) all_html += f'
{content}
' return all_html ``` The module list is also inserted into the report metadata without output encoding: ```python def build_full_html(title, subject, modules, tab_nav, tab_contents, timestamp): """构建完整HTML页面""" mod_list = ", ".join([MODULE_NAMES.get(m, {}).get("name", m) for m in modules]) return f''' 科研助理报告 - {escape(title)} ``` ```html
分析模块: {mod_list} | 生成时间: {timestamp}
``` ### Technical Analysis The `modules` array comes from caller-supplied JSON: ```python modules = data.get("modules", []) ``` Each module identifier is interpolated directly into three distinct browser contexts: 1. An inline JavaScript event-handler argument in `onclick`. 2. An HTML `id` attribute. 3. HTML body content through the fallback module name and `mod_list`. No allowlist validation or context-appropriate encoding is applied. Although known module identifi ...[truncated 2030 chars]
Remediation
View remediation
' f'{escape(info["icon"])} {escape(info["name"])}' ) ``` 3. Escape every value according to its output context. For HTML attributes, use: ```python escape(value, quote=True) ``` 4. Generate safe DOM identifiers independently rather than deriving them from input, or permit only a narrow identifier pattern such as: ```python re.fullmatch(r"[a-z0-9_]+", m) ``` 5. Bind tab behavior using `addEventListener()` and retrieve the validated module from `event.currentTarget.dataset.module`. 6. Add regression tests with quote characters, event-handler fragments, closing tags, and unknown module names. Confirm that malformed or unsupported identifiers are rejected rather than rendered. 7. Add a restrictive Content Security Policy that disallows inline scripts. This is defense in depth and should not replace input validation and safe output construction. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_report.py:240
Finding

Stored Script Injection Through Unsafe JSON Embedding in Inline Script Elements

Content
View full analysis
''' ``` The same pattern occurs in the research-topic chart: ```python labels = json.dumps(list(dims.keys())) values = json.dumps(list(dims.values())) html += f'''

🎯 选题六维评估

Remediation
View remediation
", "\\u003e") .replace("&", "\\u0026") ) ``` 3. A safer structure is: ```html ``` The static application code should then read `textContent` and call `JSON.parse()`. 4. Alternatively, construct the report DOM through a templating library that provides explicit HTML and JavaScript-context escaping. 5. Validate chart input: - Require score keys to be short plain-text labels. - Require values to be finite numbers. - Enforce reasonable bounds on label count and label length. 6. Consolidate chart generation into a single safe helper so all current and future chart renderers use the same encoding controls. 7. Add tests containing ``, HTML tags, quotes, Unicode separators, and malformed numeric values. Verify that no injected element appears in the generated DOM. 8. Deploy a restrictive Content Security Policy without `unsafe-inline` as defense in depth. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/generate_report.py:59
Finding

Third-Party JavaScript Loaded Without Subresource Integrity

Content
View full analysis
' ``` ### Technical Analysis Every generated report loads and executes Chart.js from the jsDelivr CDN when the report is opened. Although the dependency version is pinned to `4.4.0`, the script tag does not contain a Subresource Integrity hash. Without integrity enforcement, the browser trusts whatever JavaScript is returned for that URL. A compromise or malicious modification affecting the CDN, package publication, delivery path, or referenced resource could cause unauthorized code to execute in every opened report. This also means generated reports are not fully self-contained. Opening a report can make an external request that reveals metadata such as the viewer's IP address, access time, user agent, and referrer information, subject to browser behavior and policy. ### Attack Path 1. The generator creates a report containing the remote Chart.js script tag. 2. A victim opens the report while network access is available. 3. The browser requests the JavaScript resource from `cdn.jsdelivr.net`. 4. If the returned resource or its delivery path has been compromised, the browser receives attacker-controlled JavaScript. 5. Because no integrity hash is present, the browser accepts and executes the modified resource. 6. The malicious dependency runs in the generated report's browser context. This attack requires compromise or manipulation of the remote dependency or delivery channel; it is not directly triggerable solely through ordinary report JSON. ### Impact Assessment A compromised remote script could: - Read and modify the entire generated report. - Exfiltrate sensitive research content available in t ...[truncated 425 chars]
Remediation
View remediation
``` The hash must be calculated or copied from a trusted authoritative source and verified against the exact distributed file. 3. Document that opening a generated report performs a request to jsDelivr and may disclose network metadata. 4. Apply a Content Security Policy limiting scripts to the precise approved source. If Chart.js is bundled locally, prefer: ```html ``` 5. Establish a dependency-update process that verifies checksums, reviews release notes, and tests the exact vendored artifact before upgrades. 6. Consider embedding the reviewed library directly only if report portability is required and the resulting file size is acceptable. ]]>
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 (11)

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The trigger_words list includes highly generic phrases like paper writing, data analysis, experiment design, and citation formatting, with no constraints or confirmation step. Because these phrases overlap heavily with normal conversation, the skill may hijack a wide range of unrelated requests and then perform expansive actions such as web-driven research workflows or report generation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documents file-writing behavior by instructing invocation of a local report-generation script that writes output files, but it declares no explicit tool scope or permissions boundary. This creates a mismatch between advertised capabilities and enforcement, increasing the chance of unintended file writes or overly broad execution if the hosting agent auto-grants filesystem access.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language description and trigger guidance are presented primarily in Chinese, but the file does not explicitly offer users a language or locale option despite also listing English trigger terms. This can amount to a language policy issue because the skill appears to impose a default language experience without user opt-in or an explicit multilingual choice.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level trigger phrases are broad academic terms that are commonly present in ordinary user requests, which can cause the skill to activate when the user did not intend to invoke it. Unintended invocation is risky here because the skill can route into multi-step workflows and produce files, amplifying the effect of a mistaken trigger.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file presents all user-facing guidance in a single language, which can constitute a language/locale policy violation when no user opt-in or alternative is provided. Nothing in the file indicates that the skill is intentionally region-specific or that users can choose another language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code and its generated report are explicitly presented in Chinese, and the HTML document is later fixed to lang="zh-CN", indicating a forced language/locale. The policy requires either user choice, opt-in, or a clearly justified region-specific constraint, none of which is present in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The generated HTML sets <html lang="zh-CN">, which hard-codes a specific locale for all outputs. There is no surrounding logic or documentation indicating that users can select another locale or that this restriction is justified by a region-specific purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The usage example presents the trigger and interaction entirely in Chinese ("科研助手,帮我做以下工作:") with no indication that other languages are supported or that the skill is intentionally limited to Chinese-speaking users. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The markdown file is entirely presented in Chinese and does not indicate that language selection is optional or limited to a justified region-specific use case. Under the language/locale policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document title and instructional content are presented in Chinese, which imposes a specific language choice on users without indicating any language option or opt-in. This matches the policy category for language or locale constraints expressed in natural-language content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The entire document is written in Chinese and provides no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale restriction is clearly justified.

Content

No source excerpt is available for this finding.