Back to skill

Security audit

Query analysis report overview data — retrieve supplier and buyer counts grouped by country for a specified HS code with cursor-based pagination. Provides aggregated trade activity distribution data to help trade analysts, market researchers and import-export professionals understand which countries are most active in trading a specific product, compare supplier versus buyer market presence and identify key target markets. Designed for comprehensive trade overview analysis, country-level trade activity assessment and strategic market entry planning across 220+ countries and territories.

Security checks for vulnerabilities and agentic risk

Overview

The skill’s core customs overview query is legitimate, but it needs Review because it handles API keys and payment-related actions in ways that are broader and less protected than users should expect.

Install only if you are comfortable giving the skill access to a paid UpKuaJing API account. Do not let the agent print ~/.upkuajing/.env, restrict that file to your user only, confirm every paid query or top-up action, and avoid sending sensitive request or response data in error reports.

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

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 37-43
Vulnerability Type: Plaintext secret disclosure through command output
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
text

### Technical Analysis

The instructions direct the Agent to display the entire contents of the credential file with `cat`. The Skill only needs to determine whether `UPKUAJING_API_KEY` exists and then use its value internally; exposing the value in command output is unnecessary.

Command output may be retained in Agent context, execution transcripts, terminal logs, monitoring systems, or debugging records. If the file later contains additional configuration secrets, the command will expose those values as well.

This exceeds minimum privilege because checking for the presence of one named credential does not require revealing the credential to the Agent response or user-facing output.

### Attack Path

1. A user or Agent follows the documented API-key setup procedure.
2. The Agent executes `cat ~/.upkuajing/.env`.
3. The plaintext API key appears in command output and potentially enters conversation or execution logs.
4. An attacker with access to those records extracts the key.
5. The attacker submits authenticated requests to the UpKuaJing API using the stolen Bearer token.

### Impact Assessment

A disclosed key could permit unauthorized requests under the victim's API identity. Based on the audited functionality, this may include consuming paid API balance, accessing associated account information, creating payment-order URLs, and submitting authenticated API queries or error reports.

This does not directly grant operating-system privileges, but it compromises the privileges assigned to the affected API credential.
Remediation
View remediation

Remediation Suggestions

  • Remove the instruction to run cat ~/.upkuajing/.env.
  • Check only whether the named variable exists, without printing its value.
  • Prefer a dedicated helper that returns a boolean or masked status.
  • Never place the complete key in Agent responses, command transcripts, exceptions, or logs.
  • If a diagnostic display is necessary, reveal only a minimal masked suffix and require explicit user approval.
  • Document that ~/.upkuajing/.env must contain only the expected service configuration and must not be copied into support reports.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/auth.py:63
Finding

API Key File Is Created Without Explicit Restrictive Permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/auth.py, lines 63-74
Vulnerability Type: Insecure plaintext credential storage permissions
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

The generated API key is stored in plaintext, but neither the directory nor the file is created with an explicit restrictive mode. Effective permissions therefore depend on the process umask and pre-existing filesystem state.

On a system with a permissive umask, the file may be readable by other local users. If ~/.upkuajing or .env already exists with unsafe permissions, the implementation does not detect or correct them. The code also does not explicitly reject a symbolic link at the target path before overwriting it.

Reading the named service credential is necessary for the Skill's authenticated API operations. Allowing other local principals to read that credential is not necessary and violates least-privilege credential handling.

Attack Path

  1. The Skill requests a new API key from the unauthenticated key-creation endpoint.
  2. The process runs with a permissive umask, or the destination directory already has broad permissions.
  3. The key is written to ~/.upkuajing/.env without explicitly enforcing owner-only access.
  4. Another local user or compromised process reads the file.
  5. The attacker reuses the key to make authenticated API requests under the victim's identity.

A related local attack may be possible if an attacker can pre-create the destination as a symb ...[truncated 574 chars]

Remediation
View remediation

Remediation Suggestions

  • Create ~/.upkuajing with owner-only permissions, equivalent to mode 0700.
  • Create the credential file atomically with mode 0600, rather than relying on the ambient umask.
  • Verify and correct permissions on existing directories and credential files before using them.
  • Reject symbolic links and ensure the resolved destination remains inside the intended user-owned directory.
  • Write the key to a securely created temporary file, flush it, set its permissions, and atomically rename it into place.
  • Consider using an operating-system credential store instead of a plaintext environment file.
  • Avoid exposing even partial credential values in status messages unless masking is strictly necessary.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unbounded Third-Party Dependency Version Reduces Supply-Chain Reproducibility

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, line 1
Related Location: SKILL.md, line 21
Vulnerability Type: Unbounded dependency resolution
Risk Level: Low

Vulnerable Code

text
httpx>=0.23.0

The documented installation command is:

bash
pip install -r requirements.txt

Technical Analysis

The lower-bound-only constraint permits pip to install any current or future httpx release. Consequently, separate installations of the same audited Skill may resolve to different dependency code, including versions that did not exist when the Skill was reviewed.

No evidence of typosquatting, dependency confusion, a custom package index, or a currently malicious httpx release was found. The risk arises from trusting unreviewed future versions and from the absence of integrity hashes, not from a confirmed compromise of the named package.

Because httpx handles authenticated network requests, an upstream compromise or unsafe future release could affect API request confidentiality and behavior.

Attack Path

  1. A future dependency version is compromised, malicious, or contains a security regression.
  2. A user installs the Skill dependencies using the documented pip command.
  3. Pip selects the affected version because it satisfies httpx>=0.23.0.
  4. The dependency executes in the Skill's Python process.
  5. It may access request data and authorization headers available to the HTTP client, subject to the behavior of the compromised code.

This path requires an upstream compromise, malicious release, or vulnerable future dependency version; the audited repository alone does not trigger it.

Impact Assessment

A compromised networking dependency would execute with the same operating-system privileges as the Skill process. It could potentially access the API key present in process memory, inspect query parameters and responses, alter requests, or communicat ...[truncated 183 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin httpx to an exact version that has been reviewed and tested.
  • Use a lock file or fully resolved requirements file with cryptographic hashes.
  • Install dependencies with hash verification, such as pip's --require-hashes mode.
  • Review transitive dependencies and pin their resolved versions as well.
  • Update pinned versions through a controlled dependency-review process.
  • Use an isolated virtual environment and a trusted package index.
  • Add automated vulnerability scanning for the locked dependency set.
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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (39)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Version-checking, reading local skill metadata, and maintaining cache files in the user's home directory are unrelated to the stated analytics task and introduce extra network and filesystem behaviors. While not inherently malicious, these side effects broaden the trust boundary and can expose local metadata or create persistence mechanisms users did not expect from a simple query skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Version-checking, reading local skill metadata, and maintaining cache files in the user's home directory are unrelated to the stated analytics task and introduce extra network and filesystem behaviors. While not inherently malicious, these side effects broaden the trust boundary and can expose local metadata or create persistence mechanisms users did not expect from a simple query skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Version-checking, reading local skill metadata, and maintaining cache files in the user's home directory are unrelated to the stated analytics task and introduce extra network and filesystem behaviors. While not inherently malicious, these side effects broaden the trust boundary and can expose local metadata or create persistence mechanisms users did not expect from a simple query skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Version-checking, reading local skill metadata, and maintaining cache files in the user's home directory are unrelated to the stated analytics task and introduce extra network and filesystem behaviors. While not inherently malicious, these side effects broaden the trust boundary and can expose local metadata or create persistence mechanisms users did not expect from a simple query skill.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The skill explicitly instructs reading ~/.upkuajing/.env, which is a credential file containing the API key. Direct access to local secret stores is highly sensitive because it can expose reusable credentials to the agent or any downstream logging/output path, enabling unauthorized API use or account abuse.

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

This workflow tells the agent to inspect a local .env file and then potentially create and save a new API key automatically into that file. Combining credential discovery with credential provisioning and storage increases the chance of secret mishandling, unauthorized key creation, or silent persistence of sensitive material on disk.

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

The instructions again normalize checking and modifying ~/.upkuajing/.env for credential management. Repeated guidance to access and persist secrets in a plain local file raises the risk of accidental disclosure, unsafe file permissions, and lateral misuse by other tools or processes on the host.

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

This file implements API key provisioning, account lookup, pricing, and payment-order creation, which are materially unrelated to a skill described as a country-statistics analysis tool. That mismatch expands the privilege and financial attack surface: a user invoking an analysis skill could unexpectedly trigger credential creation or billing-related operations.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
83% confidence
Finding

This code targets a .env file to inspect whether an API key already exists, indicating direct handling of credential storage. In the context of an analytics skill, embedding secret-discovery and secret-management logic increases the risk of credential exposure, accidental leakage, and over-broad access to local secrets.

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

Opening and reading the .env file to parse out an existing API key is credential-access behavior. This is risky because secrets may be exposed through logs, errors, debugging, or future code changes, and the capability is not justified by the skill's stated purpose.

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

The code writes a newly issued API key into a local .env file, creating persistent secret storage on disk. That is dangerous because plaintext local secret storage is commonly exposed via backups, misconfigured permissions, accidental commits, or other tools reading the file, and it is especially unjustified in a country-statistics analysis skill.

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

Creating recharge/payment orders is a financial capability that is unjustified for a read-oriented analysis-overview skill. In this context, hidden or unexpected billing logic is dangerous because it can cause unauthorized spend, abuse of linked accounts, 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'

# 日志开关

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

The file's implemented behavior does not match the declared skill purpose: instead of retrieving customs analysis overview statistics, it reports runtime data to a platform endpoint. In an agent ecosystem, this kind of hidden capability is dangerous because it can exfiltrate request metadata and context under a misleading skill manifest, undermining user trust and review controls.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This module adds behavior outside the declared purpose of a customs-analysis overview skill: it performs outbound network requests and writes local state for self-update tracking. Even if intended for maintenance, hidden auxiliary capabilities enlarge the trust boundary, create privacy/telemetry concerns, and provide an unexpected communication channel that could be abused if the API base URL or server is compromised.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill declares no explicit tool or permission scope even though its documented behavior includes reading credentials, writing files, and making networked API calls. Missing scope boundaries increases the chance that an agent invokes the skill with broader capabilities than users expect, weakening least-privilege protections and making accidental credential or filesystem access harder to govern.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest-style description lists triggers such as "analysis overview," "country statistics," and "report overview" without clear scope constraints or negative examples. These phrases are generic enough to overlap with many unrelated analytics requests, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The API explicitly supports uploading request parameters, response data, and exception context to a centralized error-report endpoint, which can easily include personal data, credentials, business data, or stack traces with secrets. Although the document states sensitive fields will be auto-masked, it does not define guarantees, scope, or required caller-side minimization, so operators may over-share data and create a privacy or secret-leakage channel.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring advertises authentication-management capabilities that contradict the skill's declared analysis-overview purpose. This inconsistency is a security concern because it signals hidden scope and can mislead reviewers and users about the actual actions the skill may perform.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and all user-facing CLI/help messages are written only in Chinese, which imposes a language choice on users without any opt-in or alternative locale. This matches the language/locale policy violation category because the file hard-codes one language for interaction.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code can request a new API key and persist it locally even though the skill is presented as an analysis query tool. That is dangerous because it silently turns a read-only analytics context into a credential-provisioning context, increasing the chance of unauthorized account creation, secret sprawl, and misuse of newly issued credentials.

Content

No source excerpt is available for this finding.