Back to skill

Security audit

Query national trade overview summary data — retrieve annual trade totals, quarterly trade volumes, and supplier/buyer counts by country pair for comprehensive trade analysis. Delivers macro-level trade intelligence with aggregated statistics across time periods. Designed for export teams, trade analysts and market researchers who need summarized country-level trade data, trade volume snapshots and partner ecosystem evaluation for strategic decision-making across 220+ countries and territories.

Security checks for vulnerabilities and agentic risk

Overview

The skill can perform the advertised trade-summary query, but it also exposes and persists API credentials, includes billing/top-up utilities, and runs an undisclosed version check.

Review this skill before installing. Use it only if you are comfortable with a paid UpKuaJing API workflow, and avoid running the documented `cat ~/.upkuajing/.env` command because it can expose your API key. Prefer setting the API key through a secure environment mechanism, check permissions on any saved `.env` file, and be aware that the scripts can create top-up payment URLs, report diagnostic data, and perform version checks against UpKuaJing.

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 Credential File Display Instruction

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:37-46
Vulnerability Type: Credential disclosure
Risk Level: Medium

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 Skill explicitly instructs the Agent to run `cat ~/.upkuajing/.env`. This prints the complete credential file rather than merely checking whether the required variable exists.

Reading the API key internally is necessary for authenticated requests, but displaying it is not required for the declared trade-summary functionality. Command output may become visible in terminal history, Agent context, conversation transcripts, execution logs, monitoring systems, or debugging records. The file could also contain additional variables beyond `UPKUAJING_API_KEY`, all of which would be exposed by the command.

### Attack Path

1. A user or Agent follows the documented API-key setup workflow.
2. The Agent executes `cat ~/.upkuajing/.env`.
3. The complete API key is emitted into the command output and potentially retained in Agent or platform logs.
4. A party with access to those outputs retrieves the exposed key.
5. The party reuses the key in the `Authorization: Bearer` header when calling UpKuaJing APIs.
6. The compromised credential can then be used until it is revoked or replaced.

### Impact Assessment

An attacker obtaining the key could perform authenticated operations permitted by the UpKuaJing account, including paid customs-data requests, retrieval of account information, error-report submission, and creation of top-up payment orders. This does not directly grant operating-system privileges, but it can cause billing abuse, account-data exposure, and unauthorized
...[truncated 45 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove the instruction to display the credential file.
  • Check only whether the required variable is present and non-empty, without printing its value.
  • Prefer checking the process environment before accessing a file.
  • If a file check is necessary, use a command or helper that returns only a Boolean status.
  • Prevent API keys from being included in Agent responses, logs, exception messages, and command transcripts.
  • Document credential rotation procedures in case a key is accidentally exposed.
  • Ensure the file parser retrieves only UPKUAJING_API_KEY rather than exposing or propagating unrelated entries.

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:61-74
Vulnerability Type: Insecure credential storage permissions
Risk Level: Medium

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

The generated API key is written with Python's standard open(..., 'w') operation, and the parent directory is created without an explicit permission mode. For a newly created file, effective permissions depend on the process umask; existing file permissions are retained when the file is truncated and rewritten.

Consequently, the implementation does not guarantee that ~/.upkuajing/.env is readable only by its owner. On systems with permissive umask settings, shared home directories, incorrect pre-existing permissions, or multiple local users, the credential may be accessible to another account.

The code also does not validate whether the credential path is a regular file or a symbolic link before writing it. Although exploitation would normally require existing local access to the user's home directory, validating the destination would provide stronger protection against unsafe file replacement.

Attack Path

  1. The user invokes python scripts/auth.py --new_key.
  2. The platform returns a new API key.
  3. The script creates ~/.upkuajing and writes ~/.upkuajing/.env using process-default permissions.
  4. A permissive umask or insecure pre-existing file mode leaves the credential readable by another local account.
  5. The local attacker reads the API key.
  6. The attacker authenticates to the UpKuaJing API and p ...[truncated 421 chars]
Remediation
View remediation

Remediation Suggestions

  • Create ~/.upkuajing with owner-only permissions (0700) and verify the mode if the directory already exists.
  • Create the credential file atomically with mode 0600, such as by using os.open with O_CREAT, O_EXCL, and an explicit mode.
  • Apply os.chmod(env_file, 0o600) after safely opening or replacing the file, including for pre-existing files.
  • Write to a securely created temporary file in the same directory, set its permissions, flush and synchronize it, and atomically replace the destination.
  • Reject unsafe destination types such as symbolic links and verify that the final path is a regular file owned by the current user.
  • Prefer an operating-system credential manager or secret store where available.
  • Avoid exposing any portion of the existing key in status messages; even the current ten-character prefix should be removed.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unbounded Third-Party Dependency Allows Unreviewed Future Releases

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1; installation is instructed at SKILL.md:19
Vulnerability Type: Unpinned dependency and non-reproducible installation
Risk Level: Low

text
httpx>=0.23.0

The dependency is installed through the following documented instruction:

bash
pip install -r requirements.txt

Technical Analysis

The lower-bound-only version constraint permits any current or future httpx release satisfying >=0.23.0, as well as resolver-selected transitive dependencies. There is no upper bound, reviewed lock file, or package hash verification.

This does not prove that the current dependency is malicious. However, it makes installation non-reproducible and allows code that was not part of the audited package set to be downloaded and imported. A compromised upstream release, compromised transitive package, or incompatible future update could alter network, TLS, or runtime behavior.

Attack Path

  1. The user follows the documented setup instructions.
  2. pip resolves the newest available dependency versions satisfying the broad constraint.
  3. A future compromised or otherwise unsafe package release is selected.
  4. The package is installed into the user's Python environment.
  5. Package code executes during import or subsequent Skill operation with the user's privileges.
  6. Depending on the upstream compromise, the code could access local files, environment variables, and the API key or modify outgoing requests.

Impact Assessment

A successful supply-chain compromise could execute code with the privileges of the user running the installation or Skill. This could expose UPKUAJING_API_KEY, read user-accessible files, tamper with API requests, or affect other applications sharing the Python environment. The observed project does not itself contain such a payload; the risk arises from accepting unreviewed future dependency versions.

Remediation
View remediation

Remediation Suggestions

  • Pin httpx to a reviewed exact version rather than using only a lower bound.
  • Generate and commit a lock file containing all transitive dependency versions.
  • Use package hashes and install with pip --require-hashes.
  • Regularly update dependencies through a controlled review and testing process.
  • Run vulnerability and provenance checks against the locked dependency set.
  • Install the Skill in an isolated virtual environment rather than a shared system or user Python environment.
  • Define a supported Python version and test upgrades before changing the lock file.
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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (35)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The finding indicates the skill may perform version/update checks, outbound requests unrelated to trade data, and local cache writes in the user's home directory, which are outside the declared trade-summary purpose. Even if intended for maintenance, undisclosed update/network behavior expands attack surface and enables unexpected data exfiltration or persistence.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The finding indicates the skill may perform version/update checks, outbound requests unrelated to trade data, and local cache writes in the user's home directory, which are outside the declared trade-summary purpose. Even if intended for maintenance, undisclosed update/network behavior expands attack surface and enables unexpected data exfiltration or persistence.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The finding indicates the skill may perform version/update checks, outbound requests unrelated to trade data, and local cache writes in the user's home directory, which are outside the declared trade-summary purpose. Even if intended for maintenance, undisclosed update/network behavior expands attack surface and enables unexpected data exfiltration or persistence.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The skill instructs reading ~/.upkuajing/.env directly and even shows a command to print its contents. Displaying or broadly reading a credentials file is dangerous because it can expose API keys to the model, logs, terminal history, or any downstream component handling command output.

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

This section directs the agent to inspect a local .env file for UPKUAJING_API_KEY and potentially branch into credential-handling flows. A trade-summary skill does not need unrestricted local secret-file access, and this design normalizes agent interaction with stored credentials in a way that can lead to accidental disclosure or abuse.

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

The skill not only accesses local credential storage but also supports obtaining a new API key and automatically saving it to ~/.upkuajing/.env. Combining secret provisioning with automatic local persistence increases the chance of unsafe storage, unauthorized reuse by other processes, and confusion about where sensitive credentials are being written.

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

This file implements authentication and billing management for API key creation, account info, and recharge orders, which is materially unrelated to the declared trade-overview-summary skill purpose. In a narrowly scoped analytics skill, hidden auth/billing capabilities expand the trust boundary and can surprise users with credential handling or payment-related actions.

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

The code reads an existing .env file to access stored API key material. While this appears intended for local state management rather than exfiltration, reading plain-text credentials from a predictable file increases the chance of accidental exposure, misuse by adjacent code, or leakage through logs and backups.

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

The code writes a newly issued API key directly to a .env file in plain text. Plain-text credential persistence is dangerous because local compromise, backups, accidental sharing, or permissive file permissions can expose a usable secret that grants API access.

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

This line itself only returns the env file path in an error response, but in the context of local credential storage it may disclose where secrets are expected to reside. Path disclosure is a minor issue compared with the broader risk of writing secrets to a predictable plain-text location.

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

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code can create recharge/payment orders via '/agent/auth/pay/url', a financial capability not justified by the skill's stated read-only trade analytics purpose. Even if it only returns a payment URL, this introduces monetization and payment workflow behavior that could be triggered unexpectedly by users or higher-level agents.

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'

# 日志开关

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill declares broad capabilities to read environment variables, access local files, write files, and make network calls, but it does not constrain those capabilities through an explicit tool-scope or permissions declaration. In practice, this increases the blast radius of any misuse or prompt-injection because the agent may access credentials and the filesystem beyond what a simple trade-summary query should need.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The document instructs callers to send raw request parameters, response data, and error context to an error-reporting endpoint, while only briefly noting that sensitive fields are automatically masked. In a trade-data skill context, these payloads can still contain business-sensitive information, identifiers, or stack traces that exceed masking coverage, creating a real risk of unintended data disclosure into centralized logs or telemetry systems.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring explicitly states that it manages authentication, API key application, and recharge functions, which conflicts with the declared trade-overview-summary purpose. This mismatch is dangerous because users and orchestrators may trust the manifest while the code contains materially different, higher-risk capabilities.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file provisions a new API key and stores it locally in a .env file, which exceeds the minimum capability expected for a trade-summary skill. While credential bootstrapping may be operationally useful, bundling secret issuance and local persistence into an unrelated analytics skill increases exposure of sensitive tokens and broadens the attack surface.

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:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The recharge-order function performs a payment-related network action without any inline user warning, interactive confirmation, or friction step. In agent contexts, seemingly small financial side effects are risky because they may be invoked automatically or without the end user understanding that a billing workflow has started.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module docstring and all user-facing CLI descriptions/errors are written only in Chinese, indicating a fixed language/locale for the skill experience. The file does not offer language selection or explain that the skill is intentionally limited to a Chinese-speaking or region-specific environment, which matches the language-policy concern for natural-language content.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest describes a read-oriented trade summary skill for retrieving annual totals, quarterly volume, and supplier/buyer counts by country pair. This code instead collects invocation metadata and context and sends an error report to '/agent/skill/error/report', which is an operational telemetry capability not justified by the declared business purpose.

Content

No source excerpt is available for this finding.