Back to skill

Security audit

AI电商专家|TikTok Shop 图片视频全内容

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-aligned for IMIVA ecommerce content generation, but it should be reviewed because it runs a mutable npm package with a token and inherited environment access.

Install only if you trust the IMIVA npm package and are comfortable giving it an MCP token. Prefer a pinned reviewed package version, use a narrowly scoped and revocable token, avoid running it in an environment containing unrelated secrets, keep the API endpoint at the official HTTPS host, and invoke it only for explicit IMIVA ecommerce generation tasks.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/imiva_mcp.py:13
Finding

Mutable npm Package Is Downloaded and Executed at Runtime

Content
View full analysis

Vulnerability Details

File Location: scripts/imiva_mcp.py:13, 52-53; references/mcp-config.example.json:4-8; SKILL.md:110-115
Vulnerability Type: Runtime execution of an unpinned third-party dependency
Risk Level: High

Vulnerable Code

scripts/imiva_mcp.py:

python
PACKAGE = "@infimind/ecom-content-cli@latest"
python
proc = subprocess.Popen(
    [npx, "-y", PACKAGE],
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    text=True,
    bufsize=1,
    env=env,
)

references/mcp-config.example.json:

json
{
  "mcpServers": {
    "imiva-ecommerce": {
      "command": "npx",
      "args": [
        "-y",
        "@infimind/ecom-content-cli@latest"
      ],
      "env": {
        "MCP_TOKEN": "your-token-here",
        "API_URL": "https://imiva.ecpro.com"
      }
    }
  }
}

SKILL.md:

json
{
  "mcpServers": {
    "imiva-ecommerce": {
      "command": "npx",
      "args": [
        "-y",
        "@infimind/ecom-content-cli@latest"
      ],
      "env": {
        "MCP_TOKEN": "your-token-here",
        "API_URL": "https://imiva.ecpro.com"
      }
    }
  }
}

Technical Analysis

The helper launches npx with the -y option and the mutable package selector @latest. This permits npm to download and execute whichever package release is currently associated with the latest distribution tag. Consequently, the effective executable payload can change after this project has been reviewed.

The downloaded package runs with the privileges of the user executing the helper. It also receives a copied process environment containing MCP_TOKEN and API_URL. A compromised npm publisher account, malicious future package version, or registry compromise could therefore introduce arbitrary code without any corresponding change to this repository.

This is both remote ...[truncated 1419 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace @latest with an exact, reviewed package version, for example @infimind/ecom-content-cli@1.2.3.
  2. Install the dependency during a controlled build or deployment phase rather than downloading it on each invocation.
  3. Use a lockfile and verify npm integrity hashes. Enforce reproducible installation with npm ci.
  4. Verify package provenance, publisher identity, signatures, and release attestations before updating.
  5. Introduce an explicit dependency-update process that includes source review, malware scanning, and regression testing.
  6. Run the MCP package in a sandbox with restricted filesystem and network access.
  7. Supply only the environment variables required by the child process rather than copying the complete parent environment.
  8. Update SKILL.md, the example MCP configuration, and the Python constant together so all invocation paths use the same pinned version.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imiva_mcp.py:48
Finding

MCP Credential Can Be Forwarded to an Untrusted Configurable Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imiva_mcp.py:48-53
Vulnerability Type: Unvalidated service endpoint used by a token-bearing child process
Risk Level: Medium

Vulnerable Code

python
def invoke(method: str, params: dict | None = None) -> dict:
    npx, token = require_runtime()
    env = os.environ.copy()
    env["MCP_TOKEN"] = token
    env["API_URL"] = os.environ.get("IMIVA_API_URL", os.environ.get("API_URL", DEFAULT_API_URL))
    proc = subprocess.Popen(
        [npx, "-y", PACKAGE],

Technical Analysis

The helper retrieves the service URL from IMIVA_API_URL or API_URL and forwards it to the child process without validating the URL scheme, hostname, port, or origin. The same child environment contains the legitimate MCP_TOKEN.

A shell profile, CI configuration, process launcher, or other component capable of influencing environment variables can redirect the MCP package to an attacker-controlled endpoint. If the MCP package uses API_URL as documented and sends the token while connecting, the attacker can capture the credential. Allowing non-HTTPS values may also permit token exposure over an unencrypted connection.

This issue does not independently let an unauthenticated remote attacker change the environment. Exploitation requires influence over the user's execution environment or configuration.

Attack Path

  1. An attacker gains the ability to modify a shell profile, CI variable, .env-style launcher configuration, or process environment.
  2. The attacker sets IMIVA_API_URL or API_URL to an endpoint under their control, such as https://attacker.example.
  3. The user invokes list-tools or call through scripts/imiva_mcp.py.
  4. The helper launches the MCP package with both the attacker-selected API_URL and the legitimate MCP_TOKEN.
  5. If the package authenticates to the configured endpoint, the attacker's server receives the token.
  6. The a ...[truncated 530 chars]
Remediation
View remediation

Remediation Suggestions

  1. Default to the fixed official endpoint and reject overrides unless the user supplies an explicit, security-sensitive command-line option.
  2. Parse the URL and require HTTPS.
  3. Allowlist the expected hostname, imiva.ecpro.com, and reject embedded credentials, unexpected ports, fragments, and alternate origins.
  4. Never send a production token when a non-production or custom endpoint is selected. Require a separate token for explicitly approved custom endpoints.
  5. Warn clearly before connecting to any endpoint outside the allowlist.
  6. Apply least privilege and expiration to MCP tokens, and support prompt revocation and rotation.
  7. Avoid inheriting the complete parent environment. Construct a minimal environment containing only required runtime variables.
  8. Add automated tests verifying that HTTP URLs, deceptive subdomains, malformed URLs, and unapproved hosts are rejected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
90% confidence
Finding

Using os.environ.copy() forwards the entire parent environment to the npx-launched package, not just the MCP token and API URL. Because the child process is an external package fetched via npx, this broad environment exposure can unintentionally disclose unrelated secrets such as cloud credentials, CI tokens, or proxy settings if the package or its dependencies are compromised or overly permissive.

Content

Scanner excerpt · scripts/imiva_mcp.py (reported line 51)May include surrounding context.

python
def invoke(method: str, params: dict | None = None) -> dict:
    npx, token = require_runtime()
    env = os.environ.copy()
    env["MCP_TOKEN"] = token
    env["API_URL"] = os.environ.get("IMIVA_API_URL", os.environ.get("API_URL", DEFAULT_API_URL))
    proc = subprocess.Popen(

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill includes operational examples that invoke shell commands, read environment variables for secrets, and reference local files, but it does not declare any explicit tool restrictions such as allowed-tools or permissions. In an agent environment, that ambiguity can let the skill run with broader capabilities than intended, increasing the chance of unintended command execution, local file access, or secret exposure if the skill is auto-invoked.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The invocation text is very broad and covers generic ecommerce content, product images, listing, and social commerce workflows, which can cause the skill to trigger for many common requests outside a narrowly intended scope. Over-broad triggering is risky because it can route users into a skill that performs external tool actions or encourages shell/MCP operations without sufficiently explicit user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest sets language: zh-CN, and the description later says it is especially suitable for Chinese users, but the file does not offer a user language choice or clearly justify a mandatory locale restriction. Under the policy, forcing a specific language or locale without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code reads the MCP_TOKEN credential from the environment and then injects it into the subprocess environment for the launched MCP client. While this may be necessary for operation, the file provides no visible confirmation prompt or user-facing disclosure that a credential will be consumed and passed to another process.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/imiva_mcp.py (reported line 54)May include surrounding context.

python
env = os.environ.copy()
    env["MCP_TOKEN"] = token
    env["API_URL"] = os.environ.get("IMIVA_API_URL", os.environ.get("API_URL", DEFAULT_API_URL))
    proc = subprocess.Popen(
        [npx, "-y", PACKAGE],
        stdin=subprocess.PIPE,
        stdout=subprocess.PIPE,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The code spawns npx -y @infimind/ecom-content-cli@latest, which executes external code and is used to connect to the remote API URL configured in the environment. Although this is central to the tool's purpose, the file lacks any user-facing notice in comments, docstrings, or CLI help that running the command will execute an external package and communicate with a remote service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The line states that the skill is particularly suitable for Chinese users, which implies a locale preference, but it does not tell users they may choose another language or explain why the restriction is necessary. This can conflict with organizational language-choice policy when no opt-in is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

User-facing error strings and CLI descriptions in this file are written in Chinese only, which imposes a specific language on users regardless of preference. The policy allows locale constraints when documented and justified or when users can opt in, but no such choice or justification appears in this file.

Content

No source excerpt is available for this finding.