Back to skill

Security audit

Taro小程序开发技能

Security checks for vulnerabilities and agentic risk

Overview

This Taro mini-program skill is mostly a coherent project template, but its helper initialization script and setup instructions create avoidable local execution and supply-chain risk.

Review before installing. If you use it, pin the Taro CLI in the npx command, add a lockfile, validate or avoid arbitrary project names when running scripts/init_project.sh, and run setup in a normal non-privileged workspace. Treat the API examples as placeholders and verify backend endpoints, token storage, and privacy requirements before enabling real network calls.

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/init_project.sh:7
Finding
Project Name Injection Enables Arbitrary Command Execution and Filesystem Writes<![CDATA[ ## Vulnerability Details **File Location**: `scripts/init_project.sh`, lines 7–17 **Vulnerability Type**: Command injection and path traversal through an unvalidated project name **Risk Level**: High ### Vulnerable Code ```bash PROJECT_NAME=${1:-my-miniprogram} PROJECT_DIR="../${PROJECT_NAME}" echo "📦 正在创建项目: $PROJECT_NAME" # 复制模板 cp -r ../assets/project-template "$PROJECT_DIR" cd "$PROJECT_DIR" # 替换占位符 sed -i "s/{{projectName}}/$PROJECT_NAME/g" package.json taro.config.js config/index.js project.config.json app.config.js project.config.json 2>/dev/null || true ``` ### Technical Analysis The first command-line argument is accepted as `PROJECT_NAME` without validation or escaping. The same untrusted value is used in two security-sensitive contexts: 1. It becomes part of `PROJECT_DIR`, allowing path separators and `..` components to influence where the template is copied. 2. It is interpolated directly into a GNU `sed` program inside a double-quoted shell string. Shell quoting does not make the value safe for the `sed` language. An argument containing `/`, a newline, or other `sed` metacharacters can terminate the intended substitution and introduce additional `sed` commands. GNU `sed` supports the `e` command, which executes an operating-system command. For example, an attacker capable of controlling the script argument and preparing the required parent directory can use a value structurally equivalent to: ```bash $'safe/g\ne touch PWNED\n#' ``` This can transform the generated `sed` program into commands equivalent to: ```sed s/{{projectName}}/safe/g e touch PWNED #/g ``` The injected `e touch PWNED` command is then executed with the privileges of the user running the initialization script. The path construction is independently unsafe. Values containing `../` or path separators can direct `cp -r` outside the expected project-output location. Quoting prevents shell word splitting but does not prevent path traversal. The trailing `|| tr ...[truncated 1571 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Enforce a strict allowlist for project names before using the value: ```bash PROJECT_NAME=${1:-my-miniprogram} if [[ ! "$PROJECT_NAME" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$ ]]; then echo "Invalid project name" >&2 exit 1 fi if [[ "$PROJECT_NAME" == "." || "$PROJECT_NAME" == ".." ]]; then echo "Invalid project name" >&2 exit 1 fi ``` 2. Reject all path separators, traversal components, control characters, and newlines. 3. Resolve the destination to a canonical path and verify that it remains below an explicitly approved output directory. 4. Do not generate an executable `sed` program using untrusted text. Use a small Node.js or Python script that reads files as data and performs literal string replacement. 5. If `sed` must be retained, escape replacement metacharacters such as `\`, `/`, and `&`; strict input validation should still be applied. 6. Fail closed when replacement fails. Remove `2>/dev/null || true` and report partial initialization errors. 7. Refuse to overwrite existing destinations unless the user explicitly approves the operation. 8. Run the script with ordinary user privileges and in a restricted workspace, particularly in CI environments. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:17
Finding
Unpinned npx Package Is Downloaded and Executed During Initialization<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, line 17 **Vulnerability Type**: Unpinned remote dependency execution **Risk Level**: Medium ### Vulnerable Code ```bash npx @tarojs/cli init . --framework react --typescript ``` ### Technical Analysis The documented initialization procedure invokes `@tarojs/cli` through `npx` without specifying an exact version. If the package is not already available locally, `npx` can resolve it from the configured npm registry, download it, and execute its code immediately. Because no version is specified, the effective code can change after the Skill has been reviewed. A compromised package release, compromised registry account, malicious registry configuration, or unexpected incompatible release could therefore execute code on the developer’s system. This is inconsistent with the bundled template, which specifies `@tarojs/cli` version `3.6.39`. The project also contains no package lockfile in the audited structure, reducing reproducibility for the subsequent `npm install` operation. ### Attack Path 1. A user follows the initialization command in `SKILL.md`. 2. `npx` contacts the user’s configured npm registry when the requested CLI is not available locally. 3. The registry resolves whichever package version currently satisfies the unversioned request. 4. The package and its dependency graph are downloaded. 5. Package code is executed locally by `npx`. 6. If the resolved release or registry response is compromised, malicious code runs with the privileges of the invoking user. ### Impact Assessment A compromised dependency executed through `npx` could obtain the same local privileges as the developer or CI account. Potential impact includes: - Reading source code and accessible credentials. - Accessing npm tokens, environment variables, or CI secrets. - Modifying the generated application. - Altering build artifacts or dependency configuration. - Establishing additional malicious execution through ge ...[truncated 287 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin the CLI to the reviewed version: ```bash npx --yes @tarojs/cli@3.6.39 init . --framework react --typescript ``` 2. Prefer installing the exact CLI version as a development dependency and invoking it through an npm script. 3. Commit a reviewed lockfile so all direct and transitive dependency versions are reproducible. 4. Use `npm ci` rather than `npm install` in automated builds. 5. Configure a trusted npm registry and apply package-integrity and provenance controls where available. 6. Review dependency lifecycle scripts before installation and consider disabling them when they are unnecessary. 7. Periodically update the pinned version through a controlled dependency-review process rather than resolving the latest release at execution time. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (22)

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The component's user-facing strings, including validation messages, labels, placeholders, and button text, are all fixed in Chinese. This can violate a language/locale policy when the skill forces a specific language without user opt-in or documented region-specific scope.

Session Persistence

Medium
Category
Rogue Agent
Content
if (!title.trim()) { showToast({ title: '请填写任务标题', icon: 'none' }); return }
    if (!desc.trim()) { showToast({ title: '请填写任务描述', icon: 'none' }); return }
    if (!coin.trim() || isNaN(Number(coin))) { showToast({ title: '请填写正确的金币数量', icon: 'none' }); return }
    const stepList = steps.split('\n').filter(s => s.trim())
    this.setState({ submitting: true })
    try {
      // TODO: await publishTask({ title: title.trim(), desc: desc.trim(), coin: Number(coin), steps: stepList })
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.

Session Persistence

Medium
Category
Rogue Agent
Content
if (!title.trim()) { showToast({ title: '请填写任务标题', icon: 'none' }); return }
    if (!desc.trim()) { showToast({ title: '请填写任务描述', icon: 'none' }); return }
    if (!coin.trim() || isNaN(Number(coin))) { showToast({ title: '请填写正确的金币数量', icon: 'none' }); return }
    const stepList = steps.split('\n').filter(s => s.trim())
    this.setState({ submitting: true })
    try {
      // TODO: await publishTask({ title: title.trim(), desc: desc.trim(), coin: Number(coin), steps: stepList })
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.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The file is entirely written in Chinese and presents the specification as the required default, with no indication that users may choose another language or that the locale restriction is intentional for a region-specific audience. Under the policy, forced language constraints without opt-in can be a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The script's natural-language comments and terminal output are entirely in Chinese, which imposes a specific language choice on users without offering an alternative or explaining a locale-specific requirement. This matches the policy category for language or locale constraints without user opt-in.

Natural-Language Policy Violations

Low
Confidence
77% confidence
Finding
The natural-language description and headings are entirely in Chinese and target WeChat Mini Program development, but the file does not explicitly state that the skill is Chinese-language only or offer an alternative language. Under the policy, forcing a specific language without opt-in can be a locale/language policy issue.

Missing User Warnings

Low
Confidence
81% confidence
Finding
This markdown file includes request-layer setup and example login/user-info API calls, which imply transmission of user or system data to backend services. The section does not provide any user-facing warning about network access, data handling, or privacy considerations.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"@tarojs/runtime": "3.6.39",
    "@tarojs/taro": "3.6.39",
    "@tarojs/webpack5-runner": "3.6.39",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
Confidence
40% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Unverifiable Dependency: react has 2 known advisory(ies) (CVE-2013-7035 (Cross-Site Scripting in react); GHSA-hg79-j56m-fxgv (Cross-Site Scripting in react)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"@tarojs/taro": "3.6.39",
    "@tarojs/webpack5-runner": "3.6.39",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.24.0",
Confidence
40% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Unverifiable Dependency: react-dom has 1 known advisory(ies) (CVE-2018-6341 (Cross-Site Scripting in react-dom)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.24.0",
    "@tarojs/cli": "3.6.39",
    "@types/react": "^18.2.0",
    "babel-preset-taro": "3.6.39",
Confidence
40% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Unverifiable Dependency: @babel/core has 1 known advisory(ies) (CVE-2026-49356 (@babel/core: Arbitrary File Read via sourceMappingURL Comment)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"devDependencies": {
    "@babel/core": "^7.24.0",
    "@tarojs/cli": "3.6.39",
    "@types/react": "^18.2.0",
    "babel-preset-taro": "3.6.39",
    "typescript": "^5.0.0",
    "webpack": "4.46.0"
Confidence
40% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"@tarojs/cli": "3.6.39",
    "@types/react": "^18.2.0",
    "babel-preset-taro": "3.6.39",
    "typescript": "^5.0.0",
    "webpack": "4.46.0"
  }
}
Confidence
40% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The tab bar text literals are fixed to Chinese labels ('首页', '任务', '发布', '我的') with no indication of user opt-in, localization support, or documented region-specific scope. This can violate a language/locale policy when a skill forces a specific language experience by default.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The file's natural-language comments are entirely in Chinese, including usage and behavior descriptions, with no indication that this is a region-specific skill or that other language options are available. Under the policy, forcing a specific language without user opt-in or documented justification is a locale/language policy concern.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The only user-facing descriptive text is written in Chinese and does not provide any language alternative or opt-in. Under the stated policy, forcing a specific language without user choice or documented justification is a natural-language policy concern.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
The font-family declaration explicitly prioritizes Chinese locale fonts ("PingFang SC", "Microsoft YaHei") with no indication that this is optional or limited to a region-specific experience. This can reflect a language/locale policy constraint embedded in the skill assets without user opt-in or documented justification.

Missing User Warnings

Low
Confidence
87% confidence
Finding
This markdown file includes `wx.clearStorageSync()` as a usage example, which is a destructive operation that removes stored local data. The surrounding documentation provides no caution or disclosure about its impact, so users may copy it without realizing it clears all storage.

Missing User Warnings

Low
Confidence
89% confidence
Finding
This shell script copies a template directory and then edits multiple files in place, which changes the filesystem and project contents. While it prints progress and success messages, there is no prior warning, confirmation, or explanatory comment disclosing that it will create a new directory and rewrite files using sed.

Static analysis

No suspicious patterns detected.