Back to skill

Security audit

美甲制作过程视频

Security checks for vulnerabilities and agentic risk

Overview

This nail-art video skill mostly does what it says, but its helper script can send the user's WeryAI API key and prompts to arbitrary configured endpoints.

Review this before installing. Only use it in an environment you control, keep WERYAI_BASE_URL and WERYAI_MODELS_BASE_URL unset unless you are deliberately testing with trusted endpoints, and treat WERYAI_API_KEY as a sensitive credential that may be sent over the network when the skill runs.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/video_gen.js:19
Finding

Arbitrary API Endpoint Overrides Can Exfiltrate WeryAI Credentials and Generation Data

Content
View full analysis

Vulnerability Details

File Location: scripts/video_gen.js, lines 19–91
Vulnerability Type: Unrestricted authenticated endpoint configuration
Risk Level: Medium

Vulnerable Code

js
const BASE_URL = (process.env.WERYAI_BASE_URL || 'https://api.weryai.com').replace(/\/$/, '');
const MODELS_BASE_URL = (process.env.WERYAI_MODELS_BASE_URL || 'https://api-growth-agent.weryai.com').replace(
  /\/$/,
  '',
);
const MODELS_API_PATH = '/growthai/v1/video/models';
js
async function httpJson(method, fullUrl, body, apiKey) {
  const headers = {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  };
  const controller = new AbortController();
  const timer = setTimeout(() => controller.abort(), 30_000);
  try {
    const res = await fetch(fullUrl, {
      method,
      headers,
      body: body != null ? JSON.stringify(body) : undefined,
      signal: controller.signal,
    });
    clearTimeout(timer);
    let data;
    try {
      data = await res.json();
    } catch {
      data = { status: res.status, msg: `Non-JSON response (HTTP ${res.status})` };
    }
    return { httpStatus: res.status, ...data };
  } catch (err) {
    clearTimeout(timer);
    if (err.name === 'AbortError') {
      throw new Error(`Request timeout: ${method} ${fullUrl}`);
    }
    throw err;
  }
}

async function apiRequest(method, path, body, apiKey) {
  return httpJson(method, BASE_URL + path, body, apiKey);
}

async function fetchModelsRegistry(apiKey) {
  return httpJson('GET', MODELS_BASE_URL + MODELS_API_PATH, null, apiKey);
}

Technical Analysis

The script allows WERYAI_BASE_URL and WERYAI_MODELS_BASE_URL to define arbitrary API origins. These values are used without validating their scheme, hostname, port, or authority components.

Every request made through httpJson() includes the user's WERYAI_API_KEY in an ` ...[truncated 2568 chars]

Remediation
View remediation

Remediation Suggestions

  1. Enforce HTTPS

    • Parse configured endpoints with the standard URL class.
    • Reject every URL whose protocol is not exactly https:.
  2. Allowlist trusted destinations

    • Permit only the documented hosts:
      • api.weryai.com for generation and status requests.
      • api-growth-agent.weryai.com for the model registry.
    • Reject userinfo, unexpected ports, IP literals, and unapproved subdomains.
  3. Avoid unrestricted production endpoint overrides

    • Remove the override variables if custom endpoints are not required.
    • If development overrides are necessary, require an explicit development-only flag and a separate test credential.
    • Do not send a production WeryAI credential to custom origins.
  4. Harden redirect handling

    • Prefer redirect: 'manual' for authenticated requests.
    • If redirects must be supported, validate every redirect target against the same HTTPS and hostname allowlist before issuing another authenticated request.
  5. Separate credentials by service

    • If custom model registries or proxy services are legitimate requirements, use dedicated, narrowly scoped credentials rather than automatically forwarding WERYAI_API_KEY.
  6. Fail closed before constructing authorization headers

    • Validate the complete destination URL before creating or attaching the bearer header.
    • Return a clear configuration error when validation fails.

A hardened validation pattern could follow this structure:

js
function trustedEndpoint(rawUrl, allowedHostname) {
  const parsed = new URL(rawUrl);

  if (parsed.protocol !== 'https:') {
    throw new Error('API endpoint must use HTTPS.');
  }
  if (parsed.hostname !== allowedHostname) {
    throw new Error(`Untrusted API hostname: ${parsed.hostname}`);
  }
  if (parsed.username || parsed.password || parsed.port) {
    throw new Error('API endpoint must not contain useri
...[truncated 357 chars]
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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 (3)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**依赖**:本目录 `scripts/video_gen.js` + 运行环境需设置 `WERYAI_API_KEY` + Node.js 18+。不依赖其他 Cursor 技能。

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill explicitly references execution of a Node.js script and requires an API key, implying access to environment variables and outbound network calls, but it does not declare any tool scope such as permissions or allowed-tools. This creates an over-privileged and opaque execution model where a caller or host may not be able to enforce least privilege, increasing the risk of unintended secret access or external data exfiltration if the backing script is modified or abused.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The top-level doc comment that describes commands, examples, and environment variables is written in Chinese, while other user-facing output is in English. This imposes a specific language for core usage guidance without any opt-in or indication that the tool is region-specific, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.