Back to skill

Security audit

teaching-knowledge-visualizer

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent teaching-visualization helper, but one referenced format contract tells generated HTML pages to dynamically evaluate configurable math expressions in a way that could run unwanted browser JavaScript.

Review generated HTML before classroom use, especially interactive function pages. Avoid feeding untrusted pasted or web-retrieved material into function-expression fields until the expression evaluator is replaced with a real math parser or strict AST interpreter, and ask the publisher to scrub internal provenance metadata from pedagogy.md.

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
data-format.md:527
Finding
Unsafe Dynamic Evaluation of Configurable Mathematical Expressions## Vulnerability Details **File Location**: `data-format.md:527` **Vulnerability Type**: Arbitrary JavaScript execution through an insufficient expression whitelist **Risk Level**: High ### Vulnerable Code Segment ```text curves[].expr new Function [0-9a-zA-Z_+\-*/(). ,Math] ``` The contract instructs generated pages to evaluate `curves[].expr` using `new Function` after checking it against the displayed character whitelist. Supporting requirements at lines 555 and 620 rely on the same whitelist as the primary expression-security control. ### Technical Analysis The whitelist permits every uppercase and lowercase letter, digits, periods, parentheses, commas, underscores, and arithmetic operators. It therefore does not restrict expressions to numeric literals, approved parameters, and specific `Math` methods. Dangerous global identifiers and method chains can satisfy this character policy. For example: ```js eval(location.hash.slice(1)) ``` Every character in this expression is permitted by the documented whitelist. When compiled with `new Function`, global browser objects and functions remain accessible unless the evaluator explicitly shadows or blocks them. HTML escaping does not mitigate this issue because the attack occurs in JavaScript expression evaluation rather than HTML parsing. This behavior conflicts with the Skill's stated security model, under which teacher-provided and retrieved content must remain inert data. ### Attack Path 1. An attacker places a malicious expression in teacher-supplied or retrieved content that is converted into `curves[].expr`. 2. The expression uses only characters accepted by the documented whitelist. 3. The generated interactive HTML embeds the expression in `PLOT_CONFIG`. 4. The page validates the expression using the insufficient character policy. 5. The rendering engine passes the expression to `new Function`. 6. The resulting function resolves accessible browser ...[truncated 921 chars]
Remediation
## Remediation Suggestions 1. Remove all use of `new Function`, `eval`, and equivalent dynamic JavaScript compilation. 2. Parse expressions with a dedicated mathematical grammar that supports only: - Finite numeric literals. - Explicitly declared parameter names. - The independent variable `x`. - Approved arithmetic operators. - An explicit list of mathematical functions such as `sin`, `cos`, `log`, and `sqrt`. 3. Evaluate the parsed abstract syntax tree with a custom interpreter rather than JavaScript execution. 4. Reject: - Unknown identifiers. - Arbitrary property access. - Computed properties. - Constructors and prototypes. - Assignment and sequence expressions. - Global browser objects and functions. 5. Validate parameter keys against a restrictive identifier pattern and reject names that collide with globals or reserved words. 6. Add negative security tests for payloads involving `eval`, `Function`, `constructor`, `location`, `document`, `window`, and chained property access. 7. Treat validation failure as a hard rendering failure and record only a generic diagnostic without evaluating the expression.

other

Note
Location
pedagogy.md:2
Finding
Internal Provenance and Workflow Metadata Exposed in Distributed Reference File## Vulnerability Details **File Location**: `pedagogy.md:2-8` **Vulnerability Type**: Internal metadata disclosure **Risk Level**: Low ### Vulnerable Code Segment ```yaml AIGC: Label: "1" ContentProducer: 001191110102MACQD9K64018705 ProduceID: 1488116170636185_0-data_volume/.../skill-drafts/teaching-knowledge-visualizer/references/pedagogy.md ReservedCode1: "" ContentPropagator: 001191110102MACQD9K64028705 PropagateID: 1488116170636185#1788421505551 ReservedCode2: "" ``` The source contains full internal path segments between `data_volume` and `skill-drafts`; they are abbreviated above to keep all report text in English. ### Technical Analysis The YAML header exposes producer and propagator identifiers, generation identifiers, and an internal source path describing storage and draft-workflow structure. None of this metadata is required for the teaching-visualization functionality. Although the values are not credentials, publishing internal identifiers and repository or storage conventions unnecessarily increases reconnaissance exposure. Such identifiers may also permit correlation between artifacts produced by the same internal entities or workflow. ### Attack Path 1. A recipient obtains or installs the Skill package. 2. The recipient opens `pedagogy.md`. 3. The YAML header directly exposes internal identifiers and source-path structure. 4. An attacker correlates these values with other leaked artifacts or uses the path conventions to improve organizational reconnaissance. ### Impact Assessment The issue discloses limited internal provenance information, including: - Producer and propagator identifiers. - Internal generation and propagation identifiers. - Storage and workflow naming conventions. - The original draft location of the reference file. No authentication secret, private key, credential, or direct privilege-escalation path was identified. The primary im ...[truncated 56 chars]
Remediation
## Remediation Suggestions 1. Remove the entire internal provenance header before public or third-party distribution. 2. If provenance is required, retain only non-sensitive public fields such as a generic generator label and publication version. 3. Do not include internal storage paths, organization-specific identifiers, conversation locations, or draft-workflow names. 4. Add a packaging-stage metadata scrubber that checks Markdown front matter for internal paths and identifiers. 5. Review previously distributed artifacts for the same producer, propagator, and path metadata.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Vague Triggers

Medium
Confidence
87% confidence
Finding
The skill description includes very broad trigger phrases such as '知识可视化', '梳理知识结构', and '画概念图/思维导图/流程图/时间轴/对比表', which overlap with common teacher requests and can cause accidental invocation outside the intended narrow context. While this is not code execution or data exfiltration, over-broad activation increases attack surface by making the skill run on unrelated prompts and can route user content into a complex HTML-generation workflow unnecessarily.

Static analysis

No suspicious patterns detected.