Back to skill

Security audit

Query import/export trade trend data — retrieve monthly trade volume trends within a specified time range, with cursor-based pagination for smooth data exploration. Delivers time-series trade intelligence to visualize trade flow patterns and seasonal fluctuations. Designed for trade analysts, supply chain managers and market researchers who need to track trade trajectory changes, monitor monthly volume variations and identify cyclical patterns for forecasting and strategic planning across 220+ countries and territories.

Security checks for vulnerabilities and agentic risk

Overview

This skill performs the advertised trade-data queries, but it also handles plaintext API keys, payment-related account flows, and an undisclosed version-check cache in ways users should review before installing.

Install only if you are comfortable with this skill storing an UpKuaJing API key in a plaintext home-directory file, making paid API calls after confirmation, creating top-up payment orders when requested, and sending confirmed error reports to the platform. Avoid printing the `.env` file contents; use a redacted presence check instead, restrict file permissions on `~/.upkuajing/.env`, and review the version-check behavior before use.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:37
Finding

API Key Exposure Through Documented Credential File Inspection

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 37–46
Vulnerability Type: Plaintext credential disclosure
Risk Level: Medium

Vulnerable Code

markdown
This skill requires an API key. The API key is stored in the `~/.upkuajing/.env` file:
```bash
cat ~/.upkuajing/.env

Example file content:

text
UPKUAJING_API_KEY=your_api_key_here

API Key Not Set

First check if the ~/.upkuajing/.env file has UPKUAJING_API_KEY;

text

### Technical Analysis

The documentation directs the Agent or user to print the complete contents of a credential file merely to determine whether an API key exists. This operation exposes the plaintext value of `UPKUAJING_API_KEY` to standard output.

Printing the file exceeds the minimum privileges necessary for the declared trade-query functionality. Key availability can be checked without disclosing its value. Output generated by the command may be retained in Agent context, chat transcripts, terminal scrollback, execution logs, screen recordings, or monitoring systems.

The associated parser in `scripts/common.py` also reads every assignment from the `.env` file even though the Skill only requires `UPKUAJING_API_KEY`. While it does not print those values itself, restricting parsing to the required key would further reduce exposure.

### Attack Path

1. A user or Agent follows the documented API-key setup workflow.
2. The command `cat ~/.upkuajing/.env` is executed.
3. The full plaintext API key appears in terminal or Agent output.
4. That output is retained in a transcript, log, or other observable channel.
5. A party with access to that channel obtains the key.
6. The exposed key is reused to make authenticated requests to the UpKuaJing API, including potentially billable requests or account-information operations.

### Impact Assessment

Successful exploitation exposes the privileges assigned to the affected UpKuaJing API key. An attacker may be able to:

- Submit authenticated API requests.
- 
...[truncated 400 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the instruction to execute cat ~/.upkuajing/.env.
  2. Let get_api_key() determine whether the key is available without displaying it.
  3. If a separate presence check is needed, return only a boolean or a redacted status message.
  4. Never place the plaintext key in Agent responses, command output, logs, or exception messages.
  5. Modify load_env_file() or replace it with a targeted reader that retrieves only UPKUAJING_API_KEY.
  6. Redact any accidental secret values using a fixed representation such as [REDACTED].
  7. Recommend rotating the API key if it has already been printed into a shared or persistent transcript.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/auth.py:61
Finding

API Key File Created Without Enforced Owner-Only Permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/auth.py, lines 61–74
Vulnerability Type: Insecure plaintext credential storage
Risk Level: Medium

Vulnerable Code

python
# 确保 ~/.upkuajing 目录存在
try:
    UPKUAJING_DIR.mkdir(parents=True, exist_ok=True)
except OSError as e:
    return {
        "success": False,
        "message": f"API密钥申请成功,但创建目录失败:{str(e)}。\n请手动创建目录 {UPKUAJING_DIR} 并设置环境变量 {API_KEY_ENV}。",
        "envFilePath": str(env_file)
    }

# 保存到 .env 文件
try:
    with open(env_file, 'w', encoding='utf-8') as f:
        f.write(f"{API_KEY_ENV}={api_key}\n")

Technical Analysis

A newly issued API key is written in plaintext to ~/.upkuajing/.env, but the code does not explicitly enforce restrictive permissions on either the directory or the file.

The effective permissions therefore depend on the process umask and any permissions already assigned to ~/.upkuajing. In a permissively configured environment, another local user or process may be able to read the file. The code also does not validate or repair permissions when the directory or file already exists.

Storing an API key is necessary for the authentication workflow, but allowing its confidentiality to depend entirely on environmental defaults is not necessary and violates secure secret-storage practice.

Attack Path

  1. A user runs python scripts/auth.py --new_key.
  2. The unauthenticated key-creation endpoint returns a new API key.
  3. The script creates ~/.upkuajing and writes the key to .env using inherited permissions.
  4. The host has a permissive umask or the target directory has pre-existing permissive permissions.
  5. Another local user or process reads ~/.upkuajing/.env.
  6. The attacker extracts UPKUAJING_API_KEY.
  7. The attacker uses the key for authenticated and potentially billable UpKuaJing API operations.

Impact Assessment

The accessible privileges are limited to those granted to the stolen API key, but may include:

  • Performing auth ...[truncated 455 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create ~/.upkuajing with owner-only permissions equivalent to 0700.
  2. Create the credential file atomically with permissions equivalent to 0600.
  3. Validate and correct permissions on existing directories and files before reading or writing credentials.
  4. Avoid relying solely on the process umask.
  5. Use a temporary file with restrictive permissions, flush and synchronize it, and atomically replace the destination to avoid partially written credentials.
  6. Where supported, prefer an operating-system credential manager or secret store over a plaintext .env file.
  7. Do not include any part of an existing key in returned messages; replace the prefix currently shown by existing_key[:10] with a fully redacted status.
  8. Document key rotation procedures for users who suspect local disclosure.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unbounded Third-Party Dependency Version

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, line 1
Vulnerability Type: Non-reproducible and insufficiently constrained dependency
Risk Level: Low

Vulnerable Code

text
httpx>=0.23.0

Technical Analysis

The dependency specification accepts any httpx release from version 0.23.0 onward, with no upper bound, exact version, lock file, or integrity hash. The documented setup procedure instructs users to install this file directly with pip.

As a result, installation behavior can change after the Skill has been reviewed. Future httpx releases and newly selected transitive dependency versions may be installed without further review. This creates non-reproducible builds and increases exposure to compromised, incompatible, or unexpectedly changed upstream packages.

No evidence was found that httpx itself is malicious. The issue is the unsafe dependency-management policy, not a confirmed malicious package.

Attack Path

  1. A user follows the documented installation command.
  2. The package resolver queries the configured Python package index.
  3. It selects a later httpx version and corresponding transitive dependencies allowed by >=0.23.0.
  4. A selected future release is compromised, malicious, or incompatible.
  5. The package executes in the Skill’s Python environment during installation or runtime.
  6. It gains the same operating-system permissions, environment access, and network capabilities as the user running the Skill.

Impact Assessment

A compromised dependency would execute with the privileges of the Skill process. Depending on the runtime environment, this could expose:

  • UPKUAJING_API_KEY from the process environment or credential file.
  • Files readable by the invoking user.
  • API request parameters and responses processed by the Skill.
  • Network access available to the Python process.

The current code review does not establish that such compromise has occurred. The concrete present impact is ...[truncated 72 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin httpx to a specifically reviewed version.
  2. Generate and commit a lock file containing resolved transitive dependency versions.
  3. Use package hashes and require hash verification during installation.
  4. Review dependency updates through a controlled process rather than accepting all future versions automatically.
  5. Configure automated vulnerability scanning for direct and transitive dependencies.
  6. Install packages only from trusted, explicitly configured indexes.
  7. Periodically update the pinned versions after compatibility and security testing.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (37)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to perform remote version checks, read local metadata, and maintain cache files under the user's home directory despite being described as a trade-data query tool. These hidden update/check behaviors create extra network and filesystem activity unrelated to the core function, increasing privacy and integrity risk and making behavior less predictable to users.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The skill appears to perform remote version checks, read local metadata, and maintain cache files under the user's home directory despite being described as a trade-data query tool. These hidden update/check behaviors create extra network and filesystem activity unrelated to the core function, increasing privacy and integrity risk and making behavior less predictable to users.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to perform remote version checks, read local metadata, and maintain cache files under the user's home directory despite being described as a trade-data query tool. These hidden update/check behaviors create extra network and filesystem activity unrelated to the core function, increasing privacy and integrity risk and making behavior less predictable to users.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to perform remote version checks, read local metadata, and maintain cache files under the user's home directory despite being described as a trade-data query tool. These hidden update/check behaviors create extra network and filesystem activity unrelated to the core function, increasing privacy and integrity risk and making behavior less predictable to users.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The skill explicitly instructs reading ~/.upkuajing/.env and even shows cat ~/.upkuajing/.env, which is direct access to local credentials. Encouraging plaintext secret retrieval from disk raises the risk of exposing API keys to logs, model context, users, or unrelated components.

Content

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

This skill requires an API key. The API key is stored in the ~/.upkuajing/.env file:

bash
cat ~/.upkuajing/.env

Example file content:

text

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

The workflow directs the system to inspect the local .env file for UPKUAJING_API_KEY and to support generating and automatically saving a new key there. This combines credential discovery, creation, and storage in a plaintext file, expanding the blast radius if the host, logs, or toolchain are compromised.

Content

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

md
### **API Key Not Set**
First check if the `~/.upkuajing/.env` file has UPKUAJING_API_KEY;
If UPKUAJING_API_KEY is not set, prompt the user to choose:
1. User has one: User provides it (manually add to ~/.upkuajing/.env file)
2. User doesn't have one: You can apply using the interface (`auth.py --new_key`), the new key will be automatically saved to ~/.upkuajing/.env
Wait for user selection;

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

The documented flow normalizes local secret-file inspection and automatic saving of newly issued API keys to ~/.upkuajing/.env. In the context of a skill that also has network and file capabilities, this creates a meaningful credential-handling risk because secrets may be read, written, or reused beyond the minimum needed for a simple trend query.

Content

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

md
First check if the `~/.upkuajing/.env` file has UPKUAJING_API_KEY;
If UPKUAJING_API_KEY is not set, prompt the user to choose:
1. User has one: User provides it (manually add to ~/.upkuajing/.env file)
2. User doesn't have one: You can apply using the interface (`auth.py --new_key`), the new key will be automatically saved to ~/.upkuajing/.env
Wait for user selection;

### **Account Top-up**

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This file implements API key provisioning, account inspection, recharge order creation, and pricing lookups, which are materially outside the declared purpose of a trade-trend query skill. In an agent-skill context, capability mismatch is dangerous because it can enable unexpected credential issuance, billing actions, and account operations that a user would not reasonably expect from the manifest, increasing the chance of deceptive or unauthorized behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code stores API credentials in a local .env file and exposes billing-related functions despite the skill being presented as an analytics/query tool. In this context, credential handling and recharge capabilities expand the attack surface significantly: secrets may be written insecurely, and payment/account actions could be triggered under false expectations about the skill’s purpose.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

This logic explicitly checks for and uses a .env file to manage API credentials. In an agent environment, interacting with plaintext secret files is dangerous because it normalizes local credential harvesting/storage patterns and may expose secrets to other processes, backups, logs, or users on the same system.

Content

Scanner excerpt · scripts/auth.py (reported line 18)May include surrounding context.

python
"""
    申请新的 API 密钥。
    """
    # 检查是否已存在 .env 文件和 API key
    env_file = UPKUAJING_ENV_FILE

    if env_file.exists():

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The code opens and reads the existing .env file contents to locate an API key. Reading raw secret files increases the risk of credential exposure and makes this skill capable of handling sensitive data unrelated to the declared trade-trend purpose, which is especially concerning in a mismatched-scope skill.

Content

Scanner excerpt · scripts/auth.py (reported line 22)May include surrounding context.

python
env_file = UPKUAJING_ENV_FILE

    if env_file.exists():
        # 读取现有的 .env 文件
        try:
            with open(env_file, 'r', encoding='utf-8') as f:
                content = f.read()

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

The script writes a newly issued API key directly into a .env file in plaintext. Persisting secrets this way can expose credentials through filesystem access, editor history, backups, or accidental inclusion in support bundles, and is particularly dangerous when packaged inside a skill whose main function is unrelated to credential administration.

Content

Scanner excerpt · scripts/auth.py (reported line 71)May include surrounding context.

python
"envFilePath": str(env_file)
        }

    # 保存到 .env 文件
    try:
        with open(env_file, 'w', encoding='utf-8') as f:
            f.write(f"{API_KEY_ENV}={api_key}\n")

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

The error path instructs manual environment-variable handling for the API key, reinforcing insecure secret-management practices. Although this line alone is not the primary sink, it contributes to workflows where users may expose secrets in shells, scripts, or logs without adequate safeguards.

Content

Scanner excerpt · scripts/auth.py (reported line 78)May include surrounding context.

python
except IOError as e:
        return {
            "success": False,
            "message": f"API密钥申请成功,但保存到 .env 文件失败:{str(e)}。\n请手动设置环境变量 {API_KEY_ENV}。",
            "envFilePath": str(env_file)
        }

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/common.py (reported line 19)May include surrounding context.

python
API_BASE_URL = "https://openapi.upkuajing.com"
API_KEY_ENV = "UPKUAJING_API_KEY"
UPKUAJING_DIR = Path.home() / '.upkuajing'
UPKUAJING_ENV_FILE = UPKUAJING_DIR / '.env'
UPKUAJING_LOGS_DIR = UPKUAJING_DIR / 'logs'

# 日志开关

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/common.py (reported line 63)May include surrounding context.

python
def load_env_file() -> Dict[str, str]:
    """
    从 ~/.upkuajing/.env 文件加载环境变量。

    Returns:
        环境变量字典

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/common.py (reported line 85)May include surrounding context.

python
def load_env_file() -> Dict[str, str]:
    """
    从 ~/.upkuajing/.env 文件加载环境变量。

    Returns:
        环境变量字典

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/common.py (reported line 90)May include surrounding context.

python
def load_env_file() -> Dict[str, str]:
    """
    从 ~/.upkuajing/.env 文件加载环境变量。

    Returns:
        环境变量字典

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest describes a skill for querying monthly import/export trade trend data with pagination, but this file implements exception reporting to a platform endpoint, including collecting request metadata and submitting it remotely. That operational behavior is unrelated to retrieving trade trend data and expands the skill beyond its declared user-facing purpose.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises executable behavior involving environment access, local file reads/writes, and network use, but does not declare an explicit tool scope or permission boundary. That makes it harder for reviewers and runtime policy systems to understand or constrain what the skill can access, increasing the chance of over-privileged execution and misuse.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The listed triggers include generic phrases such as "trade trend" and "monthly trade volume," which are broad enough to match ordinary analytical requests without clearly constraining when this specific skill should activate. The description does not provide exclusion conditions or a narrower invocation scope to reduce unintended activation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document explicitly instructs agents to submit request parameters, response payloads, and exception context to an external error-reporting endpoint, but it does not require user notice, consent, or strict minimization before transmitting potentially sensitive operational data. Although it mentions automatic masking of sensitive fields, that control is undefined and may be incomplete, creating a real privacy and data-leakage risk if request/response bodies or stack traces contain personal, commercial, or credential-related information.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring states that the script handles API key application and recharge, directly contradicting the advertised trade-trend purpose. This discrepancy is dangerous because it signals hidden or undeclared functionality, which is a strong indicator of deceptive packaging in agent ecosystems and makes users more likely to authorize actions they did not intend.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module docstring and all user-facing CLI/help strings are exclusively in Chinese, which indicates the skill is designed to operate in a fixed language. Under the policy, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · scripts/auth.py (reported line 41)May include surrounding context.

python
pass  # 如果读取失败,继续执行

    # 不需要认证申请新密钥
    response = make_request('/agent/auth/create', {}, require_auth=False)

    # 检查是否申请成功
    if response.get('code') != 0:

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · scripts/auth.py (reported line 41)May include surrounding context.

python
pass  # 如果读取失败,继续执行

    # 不需要认证申请新密钥
    response = make_request('/agent/auth/create', {}, require_auth=False)

    # 检查是否申请成功
    if response.get('code') != 0: