Back to skill

Security audit

Query US import transaction statistics — retrieve import records, container counts, and last-90-day data grouped by state or city dimensions, with cursor-based pagination. Provides granular US import intelligence with geographic breakdowns for targeted market analysis. Designed for export teams, logistics analysts and trade professionals targeting the US market who need to monitor US import activity, analyze container flow patterns, assess state-level and city-level import distribution and evaluate market entry strategies based on real US customs import data.

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its import-statistics purpose, but it handles API keys and payment-related account flows in ways users should review carefully before installing.

Install only if you are comfortable with a paid UpKuaJing workflow that stores an API key locally. Do not let the agent print `~/.upkuajing/.env`; prefer an environment variable or a protected secret store, verify local file permissions, review any top-up/payment URL before paying, and only approve error reports after removing sensitive query or response details.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:37
Finding

API Key Disclosure Through Secret File Output

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 37-46
Vulnerability Type: API key exposure through Agent instructions
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 Skill instructs the Agent to run `cat ~/.upkuajing/.env` to determine whether an API key is configured. This outputs the complete contents of a credential file, including the bearer token used for authenticated and billable API operations.

Reading the specific `UPKUAJING_API_KEY` is necessary for the declared functionality. Printing the entire file is not necessary and exceeds the minimum disclosure required for a presence check. Command output may be captured in Agent context, execution transcripts, terminal logs, debugging systems, or conversation history.

This also exposes any unrelated values that a user may have placed in the same `.env` file.

### Attack Path

1. A user invokes the Skill without explicitly supplying an API key through the process environment.
2. The Agent follows the documented setup instructions.
3. The Agent executes `cat ~/.upkuajing/.env`.
4. The complete bearer token is returned in command output and enters the Agent or execution transcript.
5. An actor with access to the transcript, logs, or captured context obtains the token.
6. The actor reuses the token against the UpKuaJing API for authenticated operations.

### Impact Assessment

A disclosed key may permit unauthorized paid customs-data queries, retrieval of associated account information, creation of payment orders, and other operations authorized for that API credential. The issue does not grant operating-system privile
...[truncated 109 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove the instruction to print the credential file.
  • Check only whether the expected variable is present and non-empty, without displaying its value.
  • Prefer supplying the key through a protected process environment or operating-system credential store.
  • Ensure command output never includes the full key or a key prefix.
  • Add documentation covering token revocation and rotation after suspected transcript or log exposure.
  • If file-based storage remains supported, read only the UPKUAJING_API_KEY entry and avoid processing or displaying unrelated entries.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/auth.py:73
Finding

API Key File Is Created Without Explicitly Restrictive Permissions

Content
View full analysis

Vulnerability Details

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

Vulnerable Code

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

Technical Analysis

The newly issued API key is stored in plaintext at ~/.upkuajing/.env. The file is created using the process's default permission behavior and no explicit restrictive mode is applied.

The effective permissions therefore depend on the user's operating-system configuration and process umask. Under a permissive umask, the file may be readable by other local accounts. The parent directory is likewise created without an explicit mode earlier in the same function.

File-based storage is reasonable as a fallback for this Skill, but a bearer credential should be created atomically with owner-only permissions rather than relying on environmental defaults.

Attack Path

  1. A user runs python scripts/auth.py --new_key.
  2. The Skill requests a new API key from /agent/auth/create.
  3. The returned key is written in plaintext to ~/.upkuajing/.env.
  4. A permissive umask results in the directory or file being accessible to another local account.
  5. That account reads the bearer credential.
  6. The credential is reused for authenticated and potentially billable UpKuaJing API operations.

Exploitation requires local file access and permissions that permit another account to read the generated file.

Impact Assessment

A successful attacker obtains the API-level authority of the stored bearer token. This may include paid API queries, account-information access, and payment-order creation. The vulnerability does not itself provide root privileges or arbitrary code execution; its scope is the compromised API account and any charges or data access allowed by the token.

Remediation
View remediation

Remediation Suggestions

  • Create ~/.upkuajing with owner-only permissions equivalent to 0700.
  • Create the credential file atomically with owner read/write permissions equivalent to 0600.
  • Validate existing directory and file permissions before reading or writing credentials, and warn or repair them when they are too permissive.
  • Avoid overwriting files through a path that could be replaced with a symbolic link; use secure exclusive creation and atomic replacement.
  • Prefer an operating-system credential store where available.
  • Do not display any portion of an existing key in status or error messages.
  • Document a secure key-rotation procedure for users who discover permissive historical permissions.
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

Remote update checks, local version-cache reads/writes, and metadata parsing are extra behaviors not disclosed by the user-facing purpose of the skill. Undisclosed network and filesystem activity increases the attack surface and can be abused for tracking, unexpected outbound requests, or persistence-related behaviors in a skill that appears to be just a statistics query tool.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Remote update checks, local version-cache reads/writes, and metadata parsing are extra behaviors not disclosed by the user-facing purpose of the skill. Undisclosed network and filesystem activity increases the attack surface and can be abused for tracking, unexpected outbound requests, or persistence-related behaviors in a skill that appears to be just a statistics query tool.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Remote update checks, local version-cache reads/writes, and metadata parsing are extra behaviors not disclosed by the user-facing purpose of the skill. Undisclosed network and filesystem activity increases the attack surface and can be abused for tracking, unexpected outbound requests, or persistence-related behaviors in a skill that appears to be just a statistics query tool.

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 cat ~/.upkuajing/.env, which exposes the entire credentials file instead of retrieving only the needed secret safely. Direct credential-file access is dangerous because it can leak API keys and any other secrets stored in the same file to the model, logs, or downstream tools.

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 check the .env file for a key and to support workflows where the user provides a key that gets stored locally. That combines credential collection, validation, and persistence in a skill whose stated purpose is data lookup, increasing the risk of secret exposure, unauthorized storage, and trust-boundary confusion.

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

Automatically saving newly created API keys into ~/.upkuajing/.env creates persistent local secret storage without discussing encryption, file permissions, rotation, or access controls. In context, this is especially risky because the skill is presented as a simple import-statistics tool, so users may not expect persistent credential management side effects.

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

The file implements API key issuance, account lookup, and recharge-related functions that are materially outside the declared purpose of a skill for querying US import statistics. This scope mismatch is dangerous because it expands the trust boundary: a user invoking a data-query skill may unknowingly trigger credential lifecycle and billing capabilities, increasing the chance of unauthorized account changes, hidden monetization, or abuse of local secrets.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
89% confidence
Finding

This code path handles a local .env file specifically to locate and inspect stored API credentials. Accessing and managing secrets in plaintext files is risky because those files are commonly exposed through weak filesystem permissions, backups, logs, or accidental commits, enabling credential theft.

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

The script opens and reads the .env file contents to search for an existing API key, which confirms direct handling of locally stored secrets. This increases exposure risk because secret material is loaded into process memory and could be leaked through debugging, error handling, or adjacent code changes.

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

The code writes the newly issued API key into a .env file, creating persistent plaintext storage of a credential on disk. Persistent secret storage without explicit hardening is dangerous because compromise of the local account, workspace, backups, or synchronization tools can immediately expose the key.

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

Recharge-order creation is unrelated to the stated analytics scope and introduces financial side effects into a skill that users would reasonably expect to be read-only. If exposed through an agent workflow, this could enable surprise billing flows, social engineering, or unauthorized initiation of 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/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/auth.py (reported line 78)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 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
98% confidence
Finding

The manifest describes a skill for querying US import transaction statistics, grouped by state or city with pagination. This file instead implements exception reporting to a platform endpoint, including request metadata and context, which is operational telemetry rather than import-data retrieval behavior.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill declares capabilities that involve environment access, local file reads/writes, and network use, but it does not define an explicit tool scope or permissions boundary. This creates an overprivileged execution model where a seemingly simple data-query skill can access credentials and the filesystem beyond what users would reasonably expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The description embeds trigger phrases such as "US import stats" and especially "American import records," which are natural-language requests broad enough to match general conversation rather than a tightly scoped invocation pattern. The file does not provide exclusion conditions or negative examples to clarify when the skill should not activate.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The API documentation explicitly allows sending request parameters, response payloads, and exception context to a centralized error-reporting endpoint. Even though it states that sensitive fields will be automatically redacted, there is no clear guarantee of comprehensive sanitization and no explicit warning to avoid including personal, confidential, or regulated data in stack traces and payloads. In the context of a customs/import statistics skill, request and response content may include commercially sensitive trade data or identifiers, making unintended disclosure to platform-side logging more dangerous.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring and all user-facing CLI/help/error messages are written only in Chinese, which imposes a specific language on users. Under the policy, locale or language constraints should either be optional for the user or clearly documented as region-specific and justified; this file does not provide such opt-in or justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code provisions a new API key and persists it locally in a .env-style file, which is beyond what is justified for a read-only import-statistics skill. Even if intended for setup convenience, embedding credential issuance and storage broadens attack surface and can expose secrets through local file disclosure, backup leakage, or unintended reuse by other processes.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
87% confidence
Finding

The explicit require_auth=False setting confirms that key creation is performed without authentication in the client logic. This broadens abuse potential by making credential issuance reachable from an unauthenticated path, which is inconsistent with a narrowly scoped analytics skill and undermines least-privilege expectations.

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

The explicit require_auth=False setting confirms that key creation is performed without authentication in the client logic. This broadens abuse potential by making credential issuance reachable from an unauthenticated path, which is inconsistent with a narrowly scoped analytics skill and undermines least-privilege expectations.

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

The request/response logging functions can persist full request parameters and full API responses to local log files. If enabled, this may capture sensitive commercial query data, returned records, or other user-derived content without redaction or an explicit user warning, increasing privacy and data-retention risk on shared systems.

Content

No source excerpt is available for this finding.