Back to skill

Security audit

Textbook Virtual Simulator

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its stated simulator-generator purpose, but the generated web apps handle learner data and untrusted textbook content in ways that need careful review.

Install only if you are comfortable reviewing and hardening the generated app before deploying it. Avoid using sensitive, regulated, proprietary, or student-identifying materials until the templates sanitize untrusted content, remove or pin third-party dependencies, and make analytics/progress storage explicit and configurable.

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_webapp.py:27
Finding

Stored Cross-Site Scripting and JavaScript Injection in Generated Applications

Content
View full analysis
str: """Generate the HTML file.""" title = self.content.get('metadata', {}).get( 'title', '教材虚拟仿真系统' ) html_content = f''' {title} - 虚拟仿真系统 ``` The same value is inserted into visible HTML without HTML escaping: ```python

{title}

``` It is also placed into a generated JavaScript file and JavaScript string contexts: ```python def generate_javascript(self) -> str: """Generate JavaScript code.""" title = self.content.get('metadata', {}).get( 'title', '教材虚拟仿真系统' ) js_content = f'''// 教材虚拟仿真系统 - 主应用文件 // 生成时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} // 系统名称: {title} import SimulationScene from './scene.js'; import QuizComponent from './quiz.js'; import ProgressTracker from './progress.js'; import DataAnalyzer from './analytics.js'; class App {{ constructor() {{ this.scene = null; this.quiz = null; this.progress = null; this.a ...[truncated 5029 chars]
Remediation
View remediation
`, headings, and paragraphs. - HTML attribute encoding for attribute values. - JavaScript-safe serialization for JavaScript values. - Do not interpolate untrusted input into comments, template literals, or executable source code. 4. Store application data in a non-executable JSON element or separate JSON file. Parse it at runtime rather than embedding arbitrary input directly into JavaScript source. 5. Validate input against a strict schema: - Require expected primitive types. - Limit field lengths and array sizes. - Restrict enumerated values such as question type and recommendation priority. - Reject unexpected nested objects where strings are expected. 6. Add a restrictive Content Security Policy. At minimum, avoid `unsafe-inline`, restrict scripts to reviewed origins, and restrict outbound connections with `connect-src`. 7. Add automated tests using payloads that cover HTML text, attributes, script termination, template literals, event handlers, SVG, and malformed markup. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/generate_webapp.py:193
Finding

Unpinned Runtime Dependencies and On-Demand Package Execution

Content
View full analysis
``` The generated deployment documentation recommends invoking an unversioned npm package through `npx`: ```markdown 2. Or use a Node.js server: ```bash npx http-server -p 8000 ``` ``` The same unpinned Chart.js reference appears in the reusable web template: ```html ``` ### Technical Analysis The URL `https://cdn.jsdelivr.net/npm/chart.js` does not identify a fixed reviewed release. The effective JavaScript delivered to the generated application can therefore change independently of the audited project. No Subresource Integrity hash is supplied to make the browser reject modified content. The `npx http-server -p 8000` instruction may retrieve and execute a package from the npm registry when it is not already installed locally. Because no exact version is specified and no lockfile or integrity-controlled installation step is provided, the executed package is determined at use time rather than audit time. These patterns expand the trusted computing base to mutable CDN and package-registry resources. They create a supply-chain attack path if an upstream package, maintainer account, CDN, registry response, or future release is compromised. ### Attack Path #### Browser Dependency Path 1. A user generates and deploys the web application. 2. A visitor opens the generated page. 3. The browser requests the unversioned Chart.js resource from jsDelivr. 4. Th ...[truncated 1398 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (48)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

该代码块的主功能与描述明显不一致。描述强调的是一个较完整的“教材虚拟仿真系统生成器”,应具备将多种教材格式转换为仿真应用、生成3D场景和教学模拟系统等能力。但实际代码只处理一个JSON输入文件,并生成用于学习数据分析的JS模块,包括 ActionTracker、LearningMetrics、DataVisualization 和 FeedbackSystem。它确实涉及教育场景中的“数据分析”这一描述中的一个子项,但这只是整体声明能力中的局部,且代码完全没有实现多格式教材解析、仿真系统搭建、3D内容生成或教材可视化转换等核心功能。因此属于主目的和实际能力的实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

描述强调的是“教材虚拟仿真系统生成器”,尤其突出多教材格式转换能力以及生成交互式教育仿真应用的完整能力。代码确实与教育仿真 Web 应用生成有关,能输出一个包含 3D 场景区、测验、进度追踪和数据分析模块的可部署前端包,因此与声明存在部分重合。但从实际实现看,它只从一个 JSON 文件读取内容,然后写出固定模板的 HTML/CSS/JS 和启动脚本,属于静态 Web 应用模板生成/打包器。代码中没有 PDF 或纯文本教材解析、没有教材内容到 3D 场景或知识图谱的实际生成算法,也没有真正实现多仿真类型转换引擎。因此其实际能力明显弱于并部分偏离声明,属于描述与行为不完全一致的情况。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The description presents a broad '教材虚拟仿真系统生成器' that can transform various textbook formats into interactive educational simulation web applications with 3D scenes, interactive components, and analytics. The supplied code only implements one narrow part of that vision: generating JS code for several educational interaction components from a JSON file. It reads only JSON input, writes component files, and includes no PDF/text ingestion, no format conversion pipeline, no 3D rendering/scene generation, and no substantive analytics module. While the generated components are education-related and compatible with simulation-style applications, the actual code chunk materially underdelivers versus the declared scope and capabilities, so this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

声明描述的是一个面向终端生成的“虚拟仿真系统生成器”,核心能力应包括构建 Web 应用、生成 3D 内容、创建交互式教学模拟等。而提供的代码仅是离线解析器,负责检测文件格式、解析文本/PDF/JSON、抽取章节和若干语义字段,并输出 JSON。虽然输出字段中包含“3d_elements”“interactions”等名称,但这些只是从教材文本中通过关键词启发式提取的结构化占位信息,不等同于实际生成 3D 场景或交互仿真应用。因此代码行为与声明的主要用途存在明显且实质性的偏差。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

代码与声明存在明显范围不一致。声明描述的是一个较完整的教材虚拟仿真系统生成器,覆盖文本/PDF/JSON多格式教材输入,并能生成交互式教育仿真 Web 应用,包含3D场景、交互组件、数据分析、知识图谱等多类功能。而实际代码只是 scripts/scene_generator.py,一个单独的3D场景生成器:从JSON读取内容,生成 Three.js/Babylon.js 场景模板代码,提供基础对象创建、光照、相机、点击选择、全屏、重置和优化示例。它确实与“3D场景生成”这一子能力相符,也有基础交互,但没有看到文本/PDF解析、完整Web应用组装、数据分析、知识图谱或更广义教材仿真系统生成能力。因此该描述对代码能力有明显夸大,属于描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 53)May include surrounding context.

md
2. **创建交互组件** - 使用 `scripts/interactive_builder.py` 构建组件

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 121)May include surrounding context.

md
2. **创建交互组件** - 使用 `scripts/interactive_builder.py` 构建组件

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 54)May include surrounding context.

md
3. **实现数据分析** - 使用 `scripts/data_analyzer.py` 添加数据功能

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 129)May include surrounding context.

md
3. **实现数据分析** - 使用 `scripts/data_analyzer.py` 添加数据功能

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 55)May include surrounding context.

md
4. **组装Web应用** - 使用 `scripts/generate_webapp.py` 生成完整应用

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 137)May include surrounding context.

md
4. **组装Web应用** - 使用 `scripts/generate_webapp.py` 生成完整应用

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises and orchestrates scripts that read input materials and write generated application files, but it declares no explicit tool scope or permissions boundaries. In agent environments, this can lead to overbroad file access being implicitly granted, increasing the chance of unintended reads, overwrites, or misuse of local files during skill execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger conditions are broad enough to match many generic educational or visualization requests, which can cause the skill to activate when users did not intend to process materials or generate application artifacts. Overbroad routing increases the risk of unnecessary access to user-provided files and unintended generation actions in contexts that do not require this skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The skill processes uploaded teaching materials and generates deployable web application files, yet it gives no warning about file handling, content transformation, or output artifacts. Users may unknowingly provide sensitive copyrighted or internal materials and receive executable/deployable output without understanding the security and privacy implications.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill advertises analytics capability but does not warn that learner or usage data may be collected, processed, stored, or exported. In education contexts, such data can be sensitive and may implicate privacy, consent, and retention obligations, making silent analytics generation risky.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The document explicitly recommends collecting user behavior, system performance, error logs, and learning-effect data as a best practice, but does not pair that guidance with data minimization, consent, lawful basis, retention, or anonymization requirements in that section. In an education-focused simulator context, this can normalize over-collection of potentially sensitive learner telemetry, including minors' data, and lead downstream implementations to violate privacy expectations or regulatory obligations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The HTML template sets the document language to zh-CN, and the configuration later also fixes the UI language to zh-CN. Under SQP-3, forcing a specific language without user opt-in is a natural-language policy concern unless the restriction is explicitly justified as region-specific or users are offered a language choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The config example explicitly sets language: 'zh-CN', which indicates the skill/template defaults to a single language rather than offering a user choice. SQP-3 requires flagging language policy issues when a specific locale is imposed without opt-in or a clearly documented regional justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file includes configuration showing analytics enabled, action tracking, and progress saving, and the surrounding template also presents analytics dashboards and progress tracking. Because this is a markdown guidance file, SQP-2 applies when descriptions omit warnings about behaviors that may affect user privacy or user data, and no warning or disclosure is provided here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Natural-language strings throughout the file, including the top-level docstring, CLI help text, and generated UI messages, are written only in Chinese. The file provides no language selection or opt-in mechanism, which creates a locale policy issue for users expecting other languages.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The generated JavaScript persistently records user actions, session identifiers, page paths, quiz results, and learning metrics in browser localStorage without any consent flow, retention controls, or data-minimization safeguards. In an education context that may involve students, this creates privacy and compliance risk and makes behavioral data accessible to any script running on the same origin, including compromised third-party code or XSS payloads.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The CLI advertises module selection via --metrics and reports per-module enablement in the summary, suggesting scoped generation. However, save_analytics_script unconditionally concatenates all four components into the output, so the generated skill always includes user-action tracking, local persistence, visualization, and feedback features even when not requested.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The generated HTML sets lang="zh-CN", and the script consistently emits Chinese-only UI text and documentation throughout the generated app. This forces a specific language/locale on end users without opt-in, which matches the natural-language locale policy violation criteria.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generated HTML imports JavaScript, CSS, and fonts from public CDNs (unpkg, cdnjs, jsdelivr, Google Fonts). This exposes every generated app to third-party supply-chain compromise, content drift, privacy leakage, and breakage if those remote resources change or become unavailable. In a generator that transforms local教材 into deployable educational apps, silently introducing remote dependencies expands trust boundaries in a way operators may not expect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The generated app stores progress, quiz state, and analytics in localStorage without any retention controls, consent, or sensitivity checks. On shared devices or in educational environments, this can expose learner activity and scores to other local users or any script running in the same origin, especially if combined with the app's third-party script dependencies.

Content

No source excerpt is available for this finding.