Back to skill

Security audit

支持全球220+国家海关贸易数据,提供批量搜索工具,帮助外贸企业快速找到采购商和供应商。通过分析进出口记录,发现目标产品采购商、交易记录。支持企业查询、HS编码、产品查询。让外贸团队基于交易数据开发高价值B2B客户、掌握竞争对手交易动态。

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent with its customs-search purpose, but it handles API keys and paid API calls with weak safeguards that users should review before installing.

Install only if you trust this vendor API and are comfortable with the agent using a local UPKUAJING_API_KEY for paid calls. Prefer setting the key through a controlled environment or secret store instead of displaying ~/.upkuajing/.env, monitor account balance, and require explicit confirmation before any query, contact enrichment, recharge-order creation, or diagnostic report.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/company_list_search.py:107
Finding

Fee-Generating API Operations Lack Enforced User Confirmation

Content
View full analysis

Vulnerability Details

File Location: scripts/company_list_search.py:107-112
Additional Locations: scripts/trade_list_search.py:102-107, scripts/company_get_details.py:41-46, scripts/company_get_contact.py:43-48
Vulnerability Type: Missing authorization enforcement for fee-generating operations
Risk Level: Medium

Technical Analysis

SKILL.md:99-124 states that all API calls incur fees and requires the agent to disclose the expected usage, stop, and wait for explicit user confirmation in a separate message. The executable entry points do not enforce that requirement.

The company-list search begins its charged pagination loop immediately:

python
print(f"开始查询:目标获取 {args.query_count} 条数据...")

while total_retrieved < args.query_count:
    try:
        # 搜索当前批次
        response = search_company_list(params, current_cursor)

The trade-list search has the equivalent behavior:

python
print(f"开始查询:目标获取 {args.query_count} 条数据...")

while total_retrieved < args.query_count:
    try:
        # 搜索当前批次
        response = search_trade_list(params, current_cursor)

The company-details entry point validates only the batch-size limit before issuing the request:

python
company_ids = args.companyIds
if len(company_ids) > 20:
    print(f"错误:每次最多处理20条数据", file=sys.stderr)
    sys.exit(1)

response = get_company_details(company_ids)

The contact-retrieval entry point behaves identically:

python
company_ids = args.companyIds
if len(company_ids) > 20:
    print(f"错误:每次最多处理20条数据", file=sys.stderr)
    sys.exit(1)

response = get_contact_info(company_ids)

These calls reach make_request(), which loads the account API key and sends an authenticated request to the service. There is no confirmation parameter, short-lived approval token, interactive prompt, dry-run mode, or durable approval record bound to the requested operation.

Consequently, the documentation-only confirmation gate can be bypassed whenever a ...[truncated 1640 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require a non-default, verifiable approval artifact for every charged operation rather than relying only on instructions in SKILL.md.
  2. Generate approval tokens only after presenting the exact operation, account, parameters, maximum request count, and applicable pricing information to the user.
  3. Bind each token cryptographically or through protected local state to:
    • The specific endpoint.
    • A normalized hash of the request parameters.
    • The account identity.
    • The maximum number of API calls or company IDs.
    • A short expiration time.
    • A unique nonce to prevent replay.
  4. Reject execution when the approval token is absent, expired, replayed, or does not match the operation.
  5. For paginated searches, enforce the approved request ceiling inside the loop and stop before issuing any additional request.
  6. Add a dry-run mode that reports the expected request count without contacting a fee-generating endpoint.
  7. Apply the same enforcement to new searches, resumed tasks, company-detail retrieval, and contact retrieval.
  8. Add automated tests proving that direct script invocation without valid approval cannot reach make_request().
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 (46)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill appears to include update/version-check behavior involving local file reads/writes and outbound requests that are unrelated to the declared customs-search purpose. Hidden maintenance or telemetry behavior expands the attack surface and can create unexpected data flows or file-system interactions outside user intent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill appears to include update/version-check behavior involving local file reads/writes and outbound requests that are unrelated to the declared customs-search purpose. Hidden maintenance or telemetry behavior expands the attack surface and can create unexpected data flows or file-system interactions outside user intent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to include update/version-check behavior involving local file reads/writes and outbound requests that are unrelated to the declared customs-search purpose. Hidden maintenance or telemetry behavior expands the attack surface and can create unexpected data flows or file-system interactions outside user intent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to include update/version-check behavior involving local file reads/writes and outbound requests that are unrelated to the declared customs-search purpose. Hidden maintenance or telemetry behavior expands the attack surface and can create unexpected data flows or file-system interactions outside user intent.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

The instructions tell the agent to read a local .env file containing an API key and even show a command that would print the secret-bearing file. Skills should not direct agents to expose secret material from disk unless there is strict secret-handling logic, because this can leak credentials into logs, model context, or user-visible output.

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

API密钥与充值

使用此技能需要API密钥。API密钥保存在 ~/.upkuajing/.env 文件中:

bash
cat ~/.upkuajing/.env

文件内容示例:

text

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The skill directs checking for the API key in a local .env file and supports automated key creation and persistence to that file. Accessing and writing credentials from within a general-purpose skill increases the chance of secret exposure, unauthorized reuse, or insecure storage on shared systems.

Content

Scanner excerpt · SKILL.md (reported line 75)May include surrounding context.

md
### **未设置API密钥**
请先检查 `~/.upkuajing/.env` 文件是否有 UPKUAJING_API_KEY;
如果未设置 UPKUAJING_API_KEY API密钥,请提示并让用户选择:
1. 用户有,由用户提供(手动添加到 ~/.upkuajing/.env 文件)
2. 用户没有,你可使用接口进行申请(`auth.py --new_key`),申请到新密钥后,会自动保存到 ~/.upkuajing/.env
等待用户选择;

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Automatically applying for a new API key and saving it into ~/.upkuajing/.env creates a credential lifecycle inside the skill without strong safeguards described in the document. In the skill context, this is especially risky because the same workflow also includes paid actions and network calls, so compromise of the stored key could lead to account abuse or billing impact.

Content

Scanner excerpt · SKILL.md (reported line 76)May include surrounding context.

md
请先检查 `~/.upkuajing/.env` 文件是否有 UPKUAJING_API_KEY;
如果未设置 UPKUAJING_API_KEY API密钥,请提示并让用户选择:
1. 用户有,由用户提供(手动添加到 ~/.upkuajing/.env 文件)
2. 用户没有,你可使用接口进行申请(`auth.py --new_key`),申请到新密钥后,会自动保存到 ~/.upkuajing/.env
等待用户选择;

### **账户充值**

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/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 script stores a freshly issued API key in plaintext in a .env file under the user's home directory, which increases exposure to local compromise, accidental inclusion in backups, or leakage through other tooling that reads dotenv files. In this skill context, the credential grants access to the vendor platform, so compromise could enable unauthorized API use and account abuse.

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

On save failure, the script instructs the user to manually set the API key as an environment variable, continuing a pattern of informal secret handling without guardrails. While not an exploit by itself, this encourages potentially insecure credential management practices that can lead to leakage through shell history, process inspection, or misconfigured environments.

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

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

The skill declares access to environment variables and instructs reading/writing local files and making networked API calls, but does not declare any explicit tool scope or permission boundaries. That makes the skill harder to sandbox and review, and increases the chance that an agent executes sensitive actions beyond what a user reasonably expects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill explicitly supports fetching contact details such as email, phone, social media, and websites, but does not provide a clear privacy notice or usage constraints for handling personal or sensitive business contact data. In a lead-generation context, this increases risk of privacy violations, misuse, and non-compliant downstream outreach.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The document instructs agents to send exception context, request parameters, and response data to a remote error-reporting endpoint. Even though it mentions automatic masking of sensitive fields, it does not define what is masked, require data minimization, or warn that stack traces, request payloads, and responses may still contain user data, credentials, business records, or internal system details; this creates a real risk of unintended data exfiltration through telemetry.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

技能清单描述强调的是基于全球海关进出口记录挖掘进口商、出口商、采购商,并按产品品类和原产国筛选企业。但该文件的模块说明和实现包含 API 密钥申请、账户信息查询、充值订单创建、开放平台定价查询等认证/计费管理功能,这些属于平台账户运营而非海关贸易公司搜索本身。

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 subsequent user-facing help/messages are written only in Chinese, which imposes a specific language on users without any opt-in or alternative. Under the policy, language constraints should either be optional or clearly documented as a justified locale-specific limitation.

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:

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

new_rec_order() 调用 /agent/auth/pay/url 创建充值订单并返回支付地址,这是一项资金充值能力。对于一个宣称用于检索和筛选全球海关进出口企业的技能而言,支付下单并非实现搜索功能的显然必要细节,而是独立的账户商业化操作。

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest describes a skill for querying global customs import/export records and finding target companies. While calling a remote API is expected for that purpose, this helper also implements local credential discovery from process environment variables and ~/.upkuajing/.env, which is a separate local-access capability not stated in the skill description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module includes request/response logging to disk, and those logs can contain full request parameters and API responses. In a trade-data search context, that may persist sensitive business queries, returned company data, and potentially bearer-token-adjacent metadata on the local machine longer than users expect.

Content

No source excerpt is available for this finding.