Back to skill

Security audit

Query trade area distribution analysis for HS codes — retrieve trade distribution data by country/region for a specified HS code, with exporter/importer type and recent months filters. Provides trade counts, amounts, buyer counts and seller counts per country for comprehensive geographic market analysis across global customs data covering 220+ countries and territories. Designed for trade analysts, market researchers and import-export professionals who need to understand which countries trade a specific product, analyze regional distribution patterns and compare exporter vs importer country activity for strategic market planning.

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches a paid customs trade analysis tool, but its credential handling, billing support, and under-disclosed maintenance behavior deserve review before installation.

Review this skill before installing if you are uncomfortable with a paid API integration that can create payment URLs, inspect account balance, and store an API key locally. Do not print or paste ~/.upkuajing/.env into chats or logs, restrict the file permissions yourself if you use it, and confirm exactly what will be sent before approving any error report or billing-related action.

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
scripts/auth.py:67
Finding

API Credential File Is Created Without Explicit Restrictive Permissions

Content
View full analysis

Vulnerability Details

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

python
# Ensure ~/.upkuajing directory exists
try:
    UPKUAJING_DIR.mkdir(parents=True, exist_ok=True)
except OSError as e:
    return {
        "success": False,
        "message": f"API key application succeeded, but directory creation failed: {str(e)}."
    }

# Save to .env file
try:
    with open(env_file, 'w', encoding='utf-8') as f:
        f.write(f"{API_KEY_ENV}={api_key}\n")

Technical Analysis

The script stores a bearer API credential in ~/.upkuajing/.env, but it does not explicitly enforce restrictive permissions on either the directory or the file. The effective permissions therefore depend on the process umask and the state of any pre-existing path.

On a system with a permissive umask, the file may be readable by other local users. The code also does not verify whether the destination is a symbolic link, whether an existing file is owned by the current user, or whether its permissions are safe before overwriting it.

Reading and storing the dedicated API key is relevant to the skill's authenticated API functionality. The issue is not that the credential is accessed, but that its storage is insufficiently hardened.

Attack Path

  1. A user invokes python scripts/auth.py --new_key.
  2. The platform returns a new API key.
  3. The script creates or overwrites ~/.upkuajing/.env using permissions inherited from the environment.
  4. On a permissively configured multi-user system, another local user reads the file and extracts UPKUAJING_API_KEY.
  5. The attacker reuses the bearer key against the UpKuaJing API.

A local attacker who can manipulate the target path may also attempt a symbolic-link attack before file creation, causing the write to target another user-writable file. The practical scope of that variant remains limit ...[truncated 454 chars]

Remediation
View remediation

Remediation Suggestions

  • Create ~/.upkuajing with mode 0700 and verify that it is owned by the current user.
  • Create the credential file atomically with mode 0600, for example by using os.open with O_CREAT | O_EXCL | O_WRONLY and an explicit mode.
  • If the file already exists, verify its ownership, type, and permissions before opening it.
  • Reject symbolic links by using platform-appropriate no-follow options and validating the resolved destination.
  • Write through a securely created temporary file in the same directory, flush it, and atomically replace the destination.
  • Correct unsafe permissions on existing credential files or fail with a clear warning.
  • Prefer a platform credential manager or keyring where available.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:37
Finding

Documentation Instructs the Agent to Print the Plaintext Credential File

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 37-40
Vulnerability Type: Accidental secret disclosure through command output
Risk Level: Medium

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 credential file to standard output. Because the file is specifically documented as containing `UPKUAJING_API_KEY`, following the instruction can expose the plaintext bearer credential in an agent transcript, terminal history capture, tool output, CI log, screen-sharing session, or other monitoring system.

The skill needs to determine whether the credential exists and must read it internally when authenticating. It does not need to display the secret value. The instruction therefore exceeds the minimum disclosure necessary for the declared functionality.

The implementation in `scripts/common.py` performs a more narrowly scoped lookup of the named key, but the documentation still encourages an unsafe manual inspection workflow.

### Attack Path

1. The skill is loaded while configuring or troubleshooting authentication.
2. The agent or user follows the documented `cat ~/.upkuajing/.env` command.
3. The complete API key is emitted into observable command output.
4. A party with access to the transcript, logs, recording, or shared terminal obtains the key.
5. The exposed bearer credential is reused to make authenticated vendor API calls.

### Impact Assessment

An exposed credential may permit unauthorized paid API queries and access to account-related API operations supported by the key. The disclosure affects the UpKuaJing API account rather than directly granting local operating-system privileges. Financial impact is possible because the documentation states that query calls incur fees.
Remediation
View remediation

Remediation Suggestions

  • Remove the command that prints the complete .env file.
  • Replace it with a presence-only check that reports whether UPKUAJING_API_KEY is configured without displaying its value.
  • If partial identification is necessary, reveal only a short, explicitly redacted fingerprint and avoid placing it in persistent logs.
  • Instruct users never to paste API keys into conversations, tool output, issue reports, or screenshots.
  • Add output redaction for strings matching the API-key format where transcripts or diagnostic logs may capture command output.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Dependency Installation Is Not Reproducibly Pinned or Hash-Verified

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, line 1
Related Installation Instruction: SKILL.md, line 20
Vulnerability Type: Unbounded dependency resolution and supply-chain exposure
Risk Level: Medium

text
httpx>=0.23.0

The project directs users to install this requirement with:

bash
pip install -r requirements.txt

Technical Analysis

The lower-bound-only constraint permits any future httpx release satisfying the requirement. No lock file or package hashes are supplied. Consequently, installations performed at different times can resolve to materially different dependency and transitive-dependency versions.

This is not evidence that httpx is malicious, typo-squatted, or currently compromised. The risk arises because the installation process automatically trusts future compatible releases and their dependency graph without reproducible version or artifact verification.

Attack Path

  1. A user follows the documented dependency installation command.
  2. The package installer resolves the newest available release satisfying httpx>=0.23.0, along with its transitive dependencies.
  3. A future compromised, malicious, or unexpectedly incompatible artifact satisfies the broad constraint.
  4. The artifact is downloaded from the configured package index and installed.
  5. Package installation or subsequent import executes the affected dependency code with the privileges of the user running the skill.

This path is conditional on compromise of an accepted package artifact, dependency account, package index, or resolution environment; no such compromise was established during this static audit.

Impact Assessment

A compromised dependency could execute code under the installing or runtime user's existing privileges. Depending on those privileges, it could access local files, environment variables, the stored API credential, and network resources. The curren ...[truncated 182 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin httpx to a reviewed exact version rather than accepting all future versions.
  • Generate and commit a lock file that also fixes all transitive dependency versions.
  • Include cryptographic hashes and install with hash enforcement, such as pip's --require-hashes.
  • Review and update pinned dependencies through a controlled process with vulnerability scanning and release-note inspection.
  • Install dependencies inside an isolated virtual environment without administrative privileges.
  • Use a trusted package index and prevent unreviewed fallback to alternate indexes.
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 (39)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to support version checking, local metadata inspection, and cache file management in addition to trade analysis. These undeclared maintenance behaviors increase attack surface by introducing extra file and network actions that are not necessary for the core task and may bypass user expectations.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to support version checking, local metadata inspection, and cache file management in addition to trade analysis. These undeclared maintenance behaviors increase attack surface by introducing extra file and network actions that are not necessary for the core task and may bypass user expectations.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to support version checking, local metadata inspection, and cache file management in addition to trade analysis. These undeclared maintenance behaviors increase attack surface by introducing extra file and network actions that are not necessary for the core task and may bypass user expectations.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The skill instructs reading the local credential file directly with cat ~/.upkuajing/.env, which exposes secret material in plaintext. Any workflow that displays or parses the full env file risks leaking API keys to logs, transcripts, downstream tools, or an overly broad agent context.

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 agent to inspect and potentially populate a local secrets file for the user. Handling credential presence checks and secret onboarding inside a general-purpose analytics skill increases the chance of secret exfiltration, accidental overwrite, or misuse of user-provided keys.

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 a newly issued API key into ~/.upkuajing/.env couples account provisioning with local secret persistence in plaintext. In the context of a skill advertised as trade analysis, this is especially risky because users may not anticipate credential generation and storage 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
98% confidence
Finding

The file implements account management, API key issuance, balance lookup, and payment/recharge flows, which do not match the declared skill purpose of regional trade analysis by HS code. This mismatch is dangerous because users or orchestrators may invoke the skill expecting data analysis while instead enabling credential provisioning and financial actions, expanding the attack surface and creating trust-boundary confusion.

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

The code writes a newly issued API key into a local .env file, creating plaintext credential storage on disk. This is dangerous because local files may be readable by other processes, accidentally committed, backed up insecurely, or exposed through misconfigured permissions.

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

This code creates a recharge order/payment URL even though the skill is described as trade-area analysis. Unrelated payment capability is risky because it can initiate monetization or social-engineering workflows under a misleading skill identity, increasing the chance of unauthorized or confusing financial 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'

# 日志开关

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest says this skill retrieves trade distribution data by country or region for a specified HS code, but this file implements exception reporting to a platform endpoint and auto-populates skill metadata. Sending operational telemetry about agent failures is a distinct behavior from trade-area query or analytics and is not an obvious implementation detail of returning regional customs analysis data.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill declares executable behavior involving environment access, local file reads/writes, and network use, but does not declare a restrictive tool scope. That creates an over-privileged integration surface where an agent may invoke sensitive capabilities without clear policy boundaries or user expectations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description lists triggers such as "area distribution" and "regional analysis," which are generic analytical phrases not uniquely tied to HS-code customs data. Because no exclusion conditions or tighter activation constraints are provided, these phrases could cause unintended invocation for unrelated geography or analytics requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file presents all user-facing instructions and API documentation exclusively in Chinese, and it does not offer an alternative language option or state that the skill is intentionally limited to a Chinese-speaking or region-specific audience. That can violate a language/locale policy requiring user choice or explicit justification for a forced locale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document instructs agents to report raw request parameters, response data, and error context to a centralized API, while only asserting that sensitive fields are 'automatically desensitized' without defining scope, guarantees, or user-facing handling requirements. In this skill context, those fields can easily contain trade queries, account-linked metadata, identifiers, or stack traces with secrets, so the guidance creates a real risk of over-collection and unintended disclosure through telemetry.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill provisions new API keys and stores credentials locally despite being presented as a trade analysis tool. This is dangerous because hidden credential lifecycle management in an unrelated skill can mislead users, create unnecessary secret exposure, and permit persistence beyond the expected analytical function.

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

The function returns a payment/recharge URL with no visible confirmation, risk acknowledgment, or transaction details in this script. That is dangerous because callers may trigger a financial workflow without sufficient user awareness, especially given the skill's misleading non-billing description.

Content

No source excerpt is available for this finding.