Back to skill

Security audit

Leafer Js

Security checks for vulnerabilities and agentic risk

Overview

This LeaferJS documentation skill is coherent and purpose-aligned, with ordinary development examples and no evidence of hidden malicious behavior.

Before installing or using it, expect Chinese LeaferJS guidance and review generated code carefully. Run npm create or install commands only in a clean project as an unprivileged user, avoid sudo, consider pinning package versions instead of @latest, and add undo/confirmation or disclosure when adapting examples that delete, export, download, or autosave user content.

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

T08 · Insecure Dependencies

Warning
Location
SKILL.md:377
Finding

Mutable Project Generator Executes Unreviewed Third-Party Code

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:377-389
Vulnerability Type: Supply-chain risk from mutable package resolution and execution
Risk Level: Medium

Vulnerable Code:

bash
# Create a Vue + Leafer project
npm create leafer@latest my-vue-app -- --template vue

# Create a React + Leafer project
npm create leafer@latest my-react-app -- --template react

# Create a plain Leafer project
npm create leafer@latest my-app

# Use pnpm
pnpm create leafer@latest my-app

# Initialize Leafer in an existing project
npm create leafer@latest -- --init

Technical Analysis

The documented npm create and pnpm create commands resolve the mutable latest tag and execute code supplied by the downloaded project-generator package. Because latest can point to a different release after the Skill has been reviewed, the effective executable payload is not reproducible or bounded to an audited version.

Project generation legitimately requires running tooling, but using a mutable version exceeds the minimum trust necessary. An exact, reviewed version would provide the same declared functionality while reducing exposure to compromised maintainers, registry accounts, releases, or transitive dependencies.

This is a supply-chain weakness rather than evidence that the current Leafer generator is malicious.

Attack Path

  1. An attacker compromises the generator's registry account, release process, maintainer environment, or dependency chain.
  2. The attacker publishes a malicious package version and causes the latest tag to resolve to it.
  3. A user follows the Skill's initialization instructions.
  4. The package manager downloads the mutable release and runs its generator code.
  5. The malicious code executes with the invoking user's permissions and can access resources available to that process.

Impact Assessment

Successful exploitation could provide arbitrary code execution under the ...[truncated 757 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace every mutable @latest reference with an exact generator version that has been reviewed, for example:

    bash
    npm create leafer@2.1.0 my-app
    

    The actual pinned version should be verified against the package's published versions and official documentation before use.

  2. Clearly state that project-generator commands download and execute third-party code with the current user's permissions.

  3. Recommend inspecting package metadata, provenance, maintainers, release history, and lifecycle scripts before execution:

    bash
    npm view create-leafer version dist.integrity repository maintainers
    
  4. Run generators as an unprivileged user in a clean directory or disposable container, without production secrets or unnecessary credentials in the environment.

  5. After generation, review changes to dependency manifests, lockfiles, package scripts, CI configuration, and generated source before committing or building the project.

  6. Retain lockfiles and integrity metadata for subsequent dependency installation, and use deterministic installation commands such as npm ci where applicable.

  7. Avoid running package-manager generators with sudo, administrator rights, or access to sensitive workspaces.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (25)

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 · SKILL.md (reported line 118)May include surrounding context.

CDN Script 引入:

html
<!-- 生产环境 -->
<script src="https://unpkg.com/leafer-ui@2.1.0/dist/web.min.js"></script>
<!-- 开发环境 -->
<script src="https://unpkg.com/leafer-ui@2.1.0/dist/web.js"></script>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
### [事件系统](references/events.md)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
### [实用示例](references/examples.md)

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/environment.md (reported line 641)May include surrounding context.

text

```xml
<!-- pages/index/index.wxml -->
<canvas
    id="leafer"
    type="2d"

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill description is written entirely in Chinese and instructs immediate use without indicating language flexibility or locale constraints. In multi-user environments, this can cause the agent to respond in an unintended language, degrading reliability and potentially obscuring important safety or technical guidance for users who expect another language.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger conditions are overly broad, including generic terms like 可视化、UI 布局、图形编辑器 and an instruction to invoke the skill even when the user does not explicitly mention the skill. This can cause the agent to activate this skill in unrelated contexts, increasing the chance of incorrect tool selection, prompt hijacking surface, or leakage of irrelevant instructions into other tasks.

Content

No source excerpt is available for this finding.

Context Window Stuffing

Medium
Category
Memory Poisoning
Confidence
85% confidence
Finding

Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Content

Scanner excerpt · references/custom.md (reported line 85)May include surrounding context.

md
else context.lineTo(px, py)
        }
        context.closePath()
        context.fillStyle = this.fill
        context.fill()
        
        if (this.stroke) {

Context Window Stuffing

Medium
Category
Memory Poisoning
Confidence
85% confidence
Finding

Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Content

Scanner excerpt · references/custom.md (reported line 276)May include surrounding context.

md
else context.lineTo(px, py)
        }
        context.closePath()
        context.fillStyle = this.fill
        context.fill()
        
        if (this.stroke) {

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This file is entirely written in Chinese beginning with the title, and nowhere indicates that the skill supports other languages or that Chinese is a required regional/compliance constraint. Under the policy, forcing a specific language without user opt-in is a natural-language locale 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/editor.md (reported line 191)May include surrounding context.

editor.closeGroup()

// 当前打开的组列表 editor.openedGroupList

text

### 层级操作

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains example code that deletes selected elements immediately on tap via item.remove() and clears the selection, but the surrounding documentation provides no warning that the action is destructive or irreversible. Under the markdown-file criteria, destructive behaviors that may affect user data should be disclosed to the user.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The shortcut example binds Delete/Backspace to immediate removal of selected elements with no accompanying warning in the markdown that user content can be deleted instantly. For markdown skill documentation, destructive behaviors should be clearly disclosed because they can affect user data or work product.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The file’s natural-language content consistently forces a single language/locale for all instructions and examples. Under the stated policy, language restrictions should either offer user choice or clearly document a justified region- or audience-specific constraint, neither of which appears here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example binds a tap handler that removes all currently selected items via item.remove() and clears the selection immediately afterward. In this markdown file there is no accompanying warning, confirmation step, or note that the action permanently deletes user content, so readers could copy a destructive pattern without user disclosure.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest describes a skill for creating, developing, and debugging LeaferJS canvas applications, which aligns with UI extension examples. However, this section expands into application state persistence using localStorage auto-save/load, which is not mentioned in the manifest description and goes beyond pure canvas/UI customization guidance.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file includes code that exports application data and writes it to browser localStorage on an interval, which persists user data. While there is a console log after saving, the surrounding skill description does not warn users that enabling autoSave stores their data locally and repeatedly.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest positions the skill as support for a canvas graphics engine and LeaferJS application development. This example causes the runtime to fetch image resources from arbitrary src values, introducing network/resource loading behavior that is not explicitly reflected in the stated scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file presents the skill guidance exclusively in Chinese, starting from the title and introduction, with no indication that the user can choose another language. Under the natural-language policy rules, forcing a specific language without user opt-in is a locale-policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

该 markdown 文件的自然语言说明全部为中文,标题、正文和注释均未向用户提供语言/locale 选择,也未说明这是仅面向中文用户的区域性文档。根据规则,未经用户选择而固定单一语言属于语言/locale 政策风险。

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file includes a keyboard-shortcut example where pressing Delete or Backspace immediately removes the selected element. The surrounding documentation presents the behavior as normal usage but does not warn that the action is destructive or may remove user content, which matches the markdown-specific missing-warning criterion for data-affecting behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file presents all instructions and examples in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking audience. That can violate a language/locale policy when skills are expected to avoid forcing a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file contains user-facing instructional content in a single language, which can constitute a language/locale policy issue when no opt-in or justification is provided. There is no indication that the skill is region-specific or that alternate language support is unavailable by design.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The export example creates a downloadable blob and programmatically clicks a link to save canvas content as export.png. The documentation does not disclose that invoking this flow writes user-generated content to a local file, which is a data-affecting action covered by the missing-warning rule for markdown files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This example exports the canvas to PNG and immediately starts a download when the button is tapped. The surrounding markdown does not warn that user content is being written to a local file, so the documentation omits disclosure for a system/data-affecting behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

该 markdown 文件包含面向用户的自然语言说明,标题和绝大多数正文均固定为中文。根据语言/locale 政策,若技能面向一般用户却强制单一语言且没有提供选择或明确说明,属于自然语言策略问题。

Content

No source excerpt is available for this finding.