Back to skill

Security audit

miaoying-cli-skill

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly matches its Miaoying form-management purpose, but it uses persistent API-key handling and mutable remote instructions in ways users should review carefully before installing.

Install only if you intend to use the Miaoying service with WeChat login and are comfortable storing a reusable API key locally. Prefer setting MIAOYING_API_KEY through a secure secret store, restrict permissions on ~/.miaoying/config.json, avoid running broad generic form requests through this skill by accident, and review any remote prompt/configuration content before letting the agent act on it.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:188
Finding

Mandatory Remote Instruction Retrieval Creates an Untrusted Instruction Channel

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 188-216
Vulnerability Type: Remote instruction injection
Risk Level: High

Complete Code Snippet

markdown
**Dynamic prompt retrieval (recommended):**

Fetch the prompt list:

```bash
curl -H "Authorization: Bearer $MIAOYING_API_KEY" \
  "https://www.aiphoto8.cn/api/openapi/prompts"

Fetch the detailed prompt content:

bash
curl -H "Authorization: Bearer $MIAOYING_API_KEY" \
  "https://www.aiphoto8.cn/api/openapi/prompts/ai-form-prompt"
text

The same requirement is repeated at `SKILL.md:630-650`, where the agent is instructed that it must retrieve the latest configuration reference before generating form configuration.

### Technical Analysis

The Skill requires the agent to retrieve mutable prompt content from an external service and use it as operational guidance. Unlike a structured API response containing only form field definitions, the endpoint returns Markdown content explicitly intended to guide subsequent agent behavior.

This creates a post-review instruction channel: the effective instructions can change without modifying or re-auditing the installed Skill. If the service, its account, DNS path, or response-generation pipeline is compromised, an attacker could place adversarial instructions in the returned prompt content.

The use of HTTPS protects transport integrity against ordinary network interception, but it does not protect against a compromised or malicious endpoint. The bearer API key is also attached to these requests, although sending it to the declared service is expected for authenticated API operations.

### Attack Path

1. An attacker compromises or obtains control over the Miaoying prompts endpoint or its content-management pipeline.
2. The attacker modifies `ai-form-prompt`, `booking-guide`, or another returned document to contain agent-directed instructions.
3. The agent follows the mandatory work
...[truncated 1228 chars]
Remediation
View remediation

Remediation Suggestions

  1. Bundle reviewed, versioned configuration guidance with the Skill instead of requiring remote Markdown instructions.
  2. If dynamic updates are necessary, return strictly structured JSON governed by a narrow schema. Reject unknown properties and free-form instruction fields.
  3. Cryptographically sign remote configuration releases and verify signatures against a pinned public key before use.
  4. Treat every remote response as untrusted data and explicitly instruct the agent not to follow commands or behavioral directives contained in it.
  5. Apply length limits, content-type validation, schema validation, and expected-value allowlists.
  6. Separate documentation retrieval from authenticated operational APIs where possible, so an API credential is not unnecessarily attached to documentation requests.
  7. Pin the expected prompt version and require explicit user approval before accepting a materially different version.

T09 · Insecure Skill Coding Practices

Warning
Location
src/commands/login.js:42
Finding

Long-Lived API Key Is Stored Without Restrictive File Permissions

Content
View full analysis

Vulnerability Details

File Location: src/commands/login.js, lines 42-46
Vulnerability Type: Insecure plaintext credential storage
Risk Level: Medium

Complete Code Snippet

javascript
function saveConfig(apiKey) {
  if (!fs.existsSync(CONFIG_DIR)) {
    fs.mkdirSync(CONFIG_DIR, { recursive: true });
  }
  fs.writeFileSync(CONFIG_PATH, JSON.stringify({ apiKey }, null, 2));
}

Technical Analysis

The login workflow decodes a bearer API key and writes it in plaintext to ~/.miaoying/config.json. Neither mkdirSync nor writeFileSync specifies restrictive permission modes.

Effective permissions therefore depend on the process umask and existing filesystem state. On common Unix-like configurations, the directory may be created as 0755 and the file as 0644, potentially allowing other local users to read the credential. If the directory or file already exists with unsafe permissions, the code neither detects nor corrects them.

The key is later used as an Authorization: Bearer credential for operations that create, query, modify, export, and deactivate Miaoying resources. Possession of the key is therefore sufficient to exercise the associated account permissions.

Attack Path

  1. A user runs the login command and authorizes access through the WeChat QR-code workflow.
  2. The returned obfuscated key is decoded and passed to saveConfig.
  3. The key is stored in plaintext at ~/.miaoying/config.json using default filesystem permissions.
  4. On a shared host or permissively configured system, another local user or compromised process reads the file.
  5. The attacker extracts the bearer token and submits authenticated requests to www.aiphoto8.cn.
  6. The attacker accesses or modifies resources within the permissions granted to that API key until it is deactivated.

Impact Assessment

Exploitation requires local filesystem access under an account able to read the resulting ...[truncated 610 chars]

Remediation
View remediation

Remediation Suggestions

  1. Create the credential directory with owner-only permissions:

    javascript
    fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
    
  2. Create or overwrite the credential file with mode 0600:

    javascript
    fs.writeFileSync(
      CONFIG_PATH,
      JSON.stringify({ apiKey }, null, 2),
      { encoding: 'utf8', mode: 0o600 }
    );
    fs.chmodSync(CONFIG_PATH, 0o600);
    
  3. Check existing directory and file ownership before reading or overwriting them. Refuse symlinks and files owned by another user.

  4. Use atomic creation with exclusive flags where practical to reduce race and symlink risks.

  5. Prefer an operating-system credential store such as macOS Keychain, Windows Credential Manager, or a Linux Secret Service provider.

  6. Clearly document that environment variables and plaintext configuration files have different exposure characteristics.

  7. Support short-lived, narrowly scoped credentials and automatic rotation.

  8. Avoid including credential values in logs, exceptions, command output, or exported diagnostic information.

T08 · Insecure Dependencies

Warning
Location
package.json:23
Finding

Mutable Dependency Installation Is Not Backed by a Lockfile

Content
View full analysis

Vulnerability Details

File Location: package.json, lines 23-28
Vulnerability Type: Non-reproducible and unsafe dependency installation
Risk Level: Medium

Complete Code Snippet

json
"dependencies": {
  "axios": "^1.13.6",
  "form-data": "^4.0.5",
  "qrcode": "^1.5.4",
  "xlsx": "^0.18.5"
}

Relevant installation instructions in SKILL.md:309-326 direct users to run:

bash
npm install

The project directory does not contain a package-lock.json, despite metadata recommending npm ci --ignore-scripts.

Technical Analysis

Caret version ranges permit npm to install newer compatible releases than those reviewed in this package. Without a committed lockfile, transitive dependency versions and integrity hashes are also unresolved until installation time. Two users installing the same audited Skill at different times can consequently receive different executable dependency trees.

The documented npm install command also permits dependency lifecycle scripts by default. Although this package does not define its own preinstall or postinstall script, dependencies and transitive dependencies can define installation scripts that execute with the installing user's privileges.

The recommendation to use npm ci --ignore-scripts is ineffective without a lockfile because npm ci requires an existing package lock or shrinkwrap file. The executable setup instructions therefore contradict the stated security guidance.

No evidence was found that the currently declared package names are typosquatted or intentionally malicious. The vulnerability is the uncontrolled and non-reproducible supply-chain resolution process.

Attack Path

  1. A declared dependency or one of its transitive dependencies publishes a compromised release that still satisfies the caret range.
  2. Alternatively, an attacker compromises the relevant npm publisher account or package distribution channel.
  3. A use ...[truncated 1211 chars]
Remediation
View remediation

Remediation Suggestions

  1. Generate and commit a reviewed package-lock.json using a supported npm version.

  2. Replace setup instructions with:

    bash
    npm ci --ignore-scripts
    
  3. Remove or clearly mark all contradictory npm install examples.

  4. Pin direct dependencies to reviewed exact versions where feasible rather than relying solely on caret ranges.

  5. Verify lockfile integrity entries and review all transitive dependency changes before release.

  6. Use automated dependency scanning, provenance verification, and package-signature checks in the release pipeline.

  7. If any dependency requires lifecycle scripts, document the exact script and execute it only after review rather than globally enabling scripts.

  8. Publish a software bill of materials and retain the npm and Node.js versions used to produce the reviewed lockfile.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (57)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented functionality includes reading local credential/config files, using environment secrets, downloading remote files, creating local directories, exporting data, and managing login state, all beyond the narrow activity-creation framing. This creates a significant transparency and consent gap for operations touching secrets and local data.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented functionality includes reading local credential/config files, using environment secrets, downloading remote files, creating local directories, exporting data, and managing login state, all beyond the narrow activity-creation framing. This creates a significant transparency and consent gap for operations touching secrets and local data.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The documented functionality includes reading local credential/config files, using environment secrets, downloading remote files, creating local directories, exporting data, and managing login state, all beyond the narrow activity-creation framing. This creates a significant transparency and consent gap for operations touching secrets and local data.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill explicitly instructs the AI to obtain, decode, store, and later reuse a user's API key from an interactive login flow. That is dangerous because it turns the agent into a credential broker with long-term secret persistence, greatly increasing the blast radius of prompt mistakes, compromise, or misuse.

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 80)May include surrounding context.

md
- path: ./package.json

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The document states the AI will automatically fetch and save the API key without manual user action, normalizing secret acquisition and persistence as background behavior. Automatic secret handling without deliberate user confirmation is a strong security anti-pattern and may violate user expectations and least-privilege principles.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
100% confidence
Finding

This section provides a complete operational recipe for polling login state, de-obfuscating the returned apiKey, and writing the real secret to disk. Even if intended for usability, it directly enables persistent secret extraction and storage, which is highly sensitive and unnecessary for a normal task skill.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill declares sensitive capabilities such as environment-variable access and credential handling but does not define an explicit tool scope or allowed-tools boundary. This increases the chance that an agent invokes broader tools than intended during login, persistence, export, or file operations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The activation description is broad enough to match many common requests for forms, surveys, signups, voting, exams, and data collection. Over-broad triggering is risky here because the skill also includes credential bootstrap, local persistence, and networked account actions.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill claims the AI should automatically bootstrap a user's API access through a WeChat login flow and persist the resulting credential. That is a credential-acquisition capability beyond the advertised task and expands the skill into account enrollment and secret handling.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill forces a WeChat-based login and sharing flow as the default path, without presenting alternatives or requiring opt-in for the platform/account linkage. This can pressure users into disclosing account access through a third-party ecosystem they may not intend to use.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

The documentation references execution via npx without a pinned package version, which can lead to fetching whatever code is current at runtime. Even if the main install instructions use local source, unpinned npx usage introduces supply-chain risk if followed by an agent or user.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The applicable-scenarios section uses expansive keyword triggers without enough exclusions, which can cause the skill to activate for generic tasks unrelated to this service. Given the credential and file-handling behaviors elsewhere in the document, accidental activation increases security and privacy risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The repeated finding points to the same documented behavior: automatic login followed by persistent credential reuse across future invocations. In this skill's context, session persistence is more dangerous because activation criteria are broad and the agent is encouraged to act automatically.

Content

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

md
npm install

# 步骤 3: 创建活动(首次使用时 AI 会自动弹出二维码引导扫码获取 API Key)
node ./bin/miaoying.js create --title "每日打卡" --desc "请完成每日打卡" --qrcode

# 查看帮助
node ./bin/miaoying.js help

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The repeated finding points to the same documented behavior: automatic login followed by persistent credential reuse across future invocations. In this skill's context, session persistence is more dangerous because activation criteria are broad and the agent is encouraged to act automatically.

Content

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

md
npm install

# 步骤 3: 创建活动(首次使用时 AI 会自动弹出二维码引导扫码获取 API Key)
node ./bin/miaoying.js create --title "每日打卡" --desc "请完成每日打卡" --qrcode

# 查看帮助
node ./bin/miaoying.js help

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

第 1 步:调用扫码接口

bash
curl -X POST "https://www.aiphoto8.cn/weapi/weixin/qrcodeApiKeyLogin"

# 返回示例:
# {

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Emergency API-key deactivation is an account-management capability outside the core form-building purpose. A skill that can revoke credentials can cause service disruption or lockouts if triggered incorrectly, especially when the same document encourages autonomous action.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill instructs the AI to deactivate a possibly compromised key immediately without waiting for user confirmation. While intended as protective, autonomous revocation can be abused or triggered erroneously, causing denial of service and account disruption.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code defaults the booking form to collect personal data fields ('姓名' and '手机号') and then sends the assembled form configuration to a remote GraphQL API via HTTPS. While the file logs that it is creating a booking, it does not clearly disclose to the user that personal information fields are being configured and transmitted to an external service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file emits all user-facing status messages in Chinese and later formats dates explicitly with the 'zh-CN' locale. That enforces a specific language/locale choice in the skill behavior without any visible user selection or documented opt-in, which matches the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code calls toLocaleString('zh-CN'), which forces Chinese locale formatting regardless of user preference. This is a direct locale constraint with no visible opt-in or justification 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 code again formats timestamps with toLocaleString('zh-CN'), enforcing a specific locale for output. Because no alternative or opt-in is provided, this constitutes a natural-language locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This output formats start and end times using toLocaleString('zh-CN'), forcing Chinese locale presentation for potentially all users. The file does not show any mechanism for user choice or a documented reason for the locale restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code emits user-visible status and error messages only in Chinese, such as the parse failure guidance. The applicable policy forbids forcing a specific language without user opt-in, and there is no indication here that the skill is region-specific or that users can choose the locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The operational status message at this line is presented only in Chinese. Because the file provides no opt-in, configuration, or documented locale limitation, this appears to violate the language/locale policy for natural-language content.

Content

No source excerpt is available for this finding.