Back to skill

Security audit

Query import/export trade trends analysis — retrieve monthly import and export trend data for a specified HS code over recent months. Returns both export and import data with monthly breakdowns including trade counts, quantities, weights, amounts, buyer counts and seller counts. Designed for trade analysts, supply chain managers and market researchers who need to analyze trade trends for specific products over time, understand seasonal patterns, compare export versus import activity and monitor market dynamics across global customs data covering 220+ countries and territories.

Security checks for vulnerabilities and agentic risk

Overview

The trade-trend feature is legitimate, but the skill needs review because it handles API keys, account/payment flows, error reporting, and version caching with weak disclosure and credential-safety practices.

Review this skill before installing. Use an environment variable or a protected secret store instead of printing or sharing ~/.upkuajing/.env, ensure any local key file is owner-only readable, confirm every paid query or top-up action yourself, and avoid sending request or response details in error reports unless you have checked them for sensitive business data.

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 disclosure through documented credential-file output

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 37-40
Vulnerability Type: Exposure of authentication credentials through terminal output
Risk Level: Medium

Vulnerable Code Snippet

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

### Technical Analysis

The documented command prints the complete contents of the credential file to standard output. The Skill only needs to determine whether `UPKUAJING_API_KEY` exists and then use its value internally; displaying the value is unnecessary.

The output may become part of an Agent conversation, terminal history, execution logs, screen recording, or support transcript. Moreover, the command exposes every value in the file, not only the UpKuaJing API key.

### Attack Path

1. A user or Agent follows the setup instructions.
2. The command `cat ~/.upkuajing/.env` is executed.
3. The API key is printed into an observable or retained output channel.
4. A party with access to that channel obtains the credential.
5. The exposed key is reused to make authenticated and potentially billable requests to the UpKuaJing API.

### Impact Assessment

An attacker who obtains the key may act within the authorization scope assigned to that UpKuaJing credential. This can include consuming paid API services, retrieving associated account information, creating top-up payment orders, or exhausting the account balance. This does not provide operating-system privilege escalation, but it compromises the external service account represented by the key.
Remediation
View remediation

Remediation Suggestions

  • Remove the command that prints the complete credential file.
  • Prefer the existing internal get_api_key() mechanism, which can check the environment and designated file without displaying the secret.
  • If a setup check is required, use a presence-only check that returns only whether the variable is configured.
  • Explicitly instruct Agents and users never to print, echo, log, or include the API key in conversation output.
  • Redact credentials from diagnostic output and support reports.
  • Recommend rotating any key that has already appeared in logs, transcripts, screenshots, or terminal output.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/auth.py:63
Finding

API key file is created without explicitly restrictive permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/auth.py, lines 63-74
Vulnerability Type: Insecure local storage permissions for a plaintext credential
Risk Level: Medium

Vulnerable Code Snippet

python
UPKUAJING_DIR.mkdir(parents=True, exist_ok=True)
python
with open(env_file, 'w', encoding='utf-8') as f:
    f.write(f"{API_KEY_ENV}={api_key}\n")

Technical Analysis

The directory and credential file are created without explicit security modes. Their effective permissions therefore depend on the process umask and any permissions already assigned to ~/.upkuajing.

On a system with a permissive umask, the directory may be searchable and the .env file may be readable by other local users. Opening an existing file in write mode also does not ensure that previously permissive permissions are tightened. The file contains a reusable plaintext Bearer credential.

Credential persistence is necessary for the declared authentication flow, but storing the secret without enforcing owner-only access exceeds the minimum exposure required.

Attack Path

  1. A user runs python scripts/auth.py --new_key.
  2. The Skill creates ~/.upkuajing and writes the API key to ~/.upkuajing/.env.
  3. The inherited umask or existing filesystem permissions leave the directory or file accessible to another local principal.
  4. That principal reads the plaintext API key.
  5. The stolen credential is used to submit authenticated and potentially billable API requests.

Impact Assessment

The obtainable privilege is the external API authority granted to the compromised key. An attacker may consume paid API operations and access account-related functions available through the credential. The issue does not grant higher operating-system privileges by itself and requires local filesystem access under conditions where permissions permit reading the file.

Remediation
View remediation

Remediation Suggestions

  • Create ~/.upkuajing with owner-only permissions, equivalent to mode 0700.
  • Create the credential file atomically with owner-only permissions, equivalent to mode 0600.
  • Explicitly apply mode 0600 to an existing credential file before or after replacing its contents.
  • Use a temporary file in the same protected directory, set its permissions, flush it, and atomically replace the destination.
  • Refuse to use the credential file if it is owned by another user or has unsafe group/world permissions.
  • Prefer a platform credential manager or secret store where available.
  • Avoid overwriting unrelated values in an existing .env file when rotating the API key.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unbounded dependency version permits unreviewed future releases

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, line 1
Vulnerability Type: Unbounded third-party dependency and non-reproducible installation
Risk Level: Low

Vulnerable Code Snippet

text
httpx>=0.23.0

Technical Analysis

The dependency declaration specifies only a minimum version and permits any future httpx release. Consequently, installations performed with pip install -r requirements.txt are not reproducible and may retrieve a release that was never tested or reviewed with this Skill.

The package name is legitimate, and no dependency confusion or malicious package was observed in the audited project. The risk arises from implicitly trusting all future releases and their transitive dependency resolutions.

Attack Path

  1. A user follows the Skill instructions and installs the requirements.
  2. The package resolver selects the newest release satisfying the unbounded constraint.
  3. A future compromised, incompatible, or otherwise unsafe release is downloaded from the configured package index.
  4. Package installation or subsequent import executes behavior from that unreviewed release in the user's Python environment.
  5. The resulting code receives the same local process access as the Skill, potentially including access to the API key when requests are made.

Impact Assessment

A compromised dependency would execute with the privileges of the user running the installation or Skill. Its potential scope could include reading process environment variables, accessing user-readable files such as ~/.upkuajing/.env, altering API traffic, or modifying files writable by that user. No such malicious behavior was found in the reviewed source; this finding concerns preventable supply-chain exposure.

Remediation
View remediation

Remediation Suggestions

  • Pin httpx to a specifically reviewed version or use a narrowly bounded compatible range.
  • Generate and commit a lock file containing exact direct and transitive dependency versions.
  • Require package hashes during installation, such as through a hash-locked requirements file.
  • Regularly update dependencies through a controlled review and testing process rather than automatically accepting every future release.
  • Use a trusted package index and isolate installation in a dedicated virtual environment.
  • Add automated vulnerability and integrity scanning for resolved dependencies.
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 (36)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Version checks, cache reads/writes, and metadata inspection are capabilities outside the stated trend-analysis purpose. While not inherently malicious, undisclosed network and filesystem behavior creates unnecessary data exposure and can surprise users expecting a simple query-only skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Version checks, cache reads/writes, and metadata inspection are capabilities outside the stated trend-analysis purpose. While not inherently malicious, undisclosed network and filesystem behavior creates unnecessary data exposure and can surprise users expecting a simple query-only skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Version checks, cache reads/writes, and metadata inspection are capabilities outside the stated trend-analysis purpose. While not inherently malicious, undisclosed network and filesystem behavior creates unnecessary data exposure and can surprise users expecting a simple query-only skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Version checks, cache reads/writes, and metadata inspection are capabilities outside the stated trend-analysis purpose. While not inherently malicious, undisclosed network and filesystem behavior creates unnecessary data exposure and can surprise users expecting a simple query-only skill.

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 via cat, which exposes stored API credentials from a local secrets file. Direct credential retrieval is highly sensitive and can lead to account compromise, unauthorized API usage, and downstream billing abuse if the value is surfaced or logged.

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
95% confidence
Finding

This section directs the workflow to inspect a local .env file and potentially handle user-supplied credentials for storage. Encouraging an agent to interact with raw secret material in local files increases the risk of accidental disclosure, overwrite, or persistence of sensitive credentials in insecure locations.

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
95% confidence
Finding

Automatically saving newly created API keys into ~/.upkuajing/.env combines secret issuance with local file persistence, which broadens exposure if the host is shared, logs are collected, or file permissions are weak. In the context of a nominally simple analysis skill, this makes the skill substantially more dangerous because it crosses into credential lifecycle management.

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
98% confidence
Finding

The file implements API-key issuance, account inspection, recharge order creation, and pricing lookup, which is materially different from the declared skill purpose of trade-trend analysis. This mismatch expands the skill's capability into credential and billing operations, increasing the risk of unexpected data exposure or unauthorized financial/account actions if the skill is invoked or trusted for a narrower purpose.

Content

No source excerpt is available for this finding.

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/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
60% confidence
Finding

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

Content

Scanner excerpt · scripts/auth.py (reported line 22)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
60% confidence
Finding

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

Content

Scanner excerpt · scripts/auth.py (reported line 78)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
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
"""
    申请新的 API 密钥。
    """
    # 检查是否已存在 .env 文件和 API key
    env_file = UPKUAJING_ENV_FILE

    if env_file.exists():

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
"""
    申请新的 API 密钥。
    """
    # 检查是否已存在 .env 文件和 API key
    env_file = UPKUAJING_ENV_FILE

    if env_file.exists():

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
"""
    申请新的 API 密钥。
    """
    # 检查是否已存在 .env 文件和 API key
    env_file = UPKUAJING_ENV_FILE

    if env_file.exists():

Credential Access

High
Category
Privilege Escalation
Confidence
86% confidence
Finding

The script writes a newly issued API key in plaintext to a .env file under the user's home configuration directory. Plaintext secret storage can expose credentials to other local users, backups, logs, or malware if file permissions are weak or the environment file is later consumed insecurely.

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")

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script includes recharge-order creation and pricing APIs unrelated to monthly import/export trend analysis. Financial and account monetization functionality in a data-analysis skill increases attack surface and can enable unintended purchases, account manipulation, or social-engineering style misuse under the guise of analytics.

Content

No source excerpt is available for this finding.

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'

# 日志开关

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This script's implemented behavior does not match the declared skill purpose of customs trade trend analysis; instead it reports Agent/Skill exceptions to a platform endpoint. In an agent ecosystem, such capability mismatch is dangerous because it can provide an undisclosed data-exfiltration or telemetry path that operators and users would not expect from the manifest, especially since the payload includes request metadata and arbitrary context.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares no explicit tool or permission boundaries even though it instructs the agent to read local files, use environment secrets, write credential files, and make network requests. Missing scope restrictions increases the chance of overbroad execution and makes it harder to contain misuse or prompt-induced abuse.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrases are broad enough that the skill may activate for loosely related trade-analysis requests. In a skill that can access credentials, local files, and paid APIs, accidental invocation raises the risk of unintended sensitive actions or charges.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation explicitly instructs sending request parameters, response payloads, and exception context to a platform error-reporting endpoint. Although it notes that sensitive fields are 'automatically desensitized,' it does not define the masking guarantees or require user/operator notice before transmitting potentially sensitive business data, which creates a real privacy and data-sharing risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring and all user-facing CLI descriptions/messages are written only in Chinese, which effectively forces a specific language for interaction. The file does not offer a language choice, fallback, or any justification that this skill is intentionally limited to a Chinese-speaking or region-specific audience.

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:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The file’s user-facing natural language is entirely in Chinese, including the module description and all printed error/help messages. For a general-purpose skill utility, this imposes a specific language/locale without any opt-in or documented regional constraint, which matches the policy-violation category.

Content

No source excerpt is available for this finding.