Back to skill

Security audit

中国商标查询 Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but it can send a user's platform token to an arbitrary configured host, including plaintext HTTP when enabled, while performing billable account actions.

Review before installing. Use only a token you are willing to grant to this platform, set CHINA_TM_PLATFORM_BASE_URL to https://tm.zhengquai.com, do not enable ALLOW_HTTP except isolated local testing with non-production credentials, and confirm point costs before search, detail, or export actions. Also treat the trial-points documentation as inconsistent until the publisher clarifies it.

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/cli.mjs:323
Finding
Bearer Token Can Be Sent to an Arbitrary Host or over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `scripts/cli.mjs:323-352` and `scripts/cli.mjs:568-599` **Vulnerability Type**: Unrestricted credential destination and optional plaintext transmission **Risk Level**: Medium ### Vulnerable Code ```js function readEnv(lang) { const m_ = msg(lang); const baseUrl = process.env.CHINA_TM_PLATFORM_BASE_URL; const token = process.env.CHINA_TM_USER_TOKEN; const timeoutMsRaw = process.env.CHINA_TM_TIMEOUT_MS; const channel = process.env.CHINA_TM_SKILL_CHANNEL || DEFAULT_CHANNEL; const allowHttp = process.env.ALLOW_HTTP === 'true'; if (!baseUrl) { throw createSkillError('ENV_MISSING', m_.envMissingBase); } if (!token) { throw createSkillError('ENV_MISSING', m_.envMissingToken); } const timeoutMs = parsePositiveInteger(timeoutMsRaw, DEFAULT_TIMEOUT_MS, 'CHINA_TM_TIMEOUT_MS', lang); const normalizedBaseUrl = baseUrl.replace(/\/+$/, ''); if (!/^https:\/\//i.test(normalizedBaseUrl)) { if (!allowHttp) { throw createSkillError('HTTPS_REQUIRED', m_.httpsRequired); } // baseUrl 完全由使用者控制,而每个请求都会带上 Bearer token; // 明文降级至少要让使用者在 stderr 上看见一次。 process.stderr.write(`${m_.allowHttpWarning}\n`); } return { baseUrl: normalizedBaseUrl, token, timeoutMs, channel, lang, requestId: `cli_${randomUUID().replace(/-/g, '')}` }; } ``` ```js async function apiRequest(env, method, path, body) { const m_ = msg(env.lang || 'zh'); const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), env.timeoutMs); const headers = { 'Accept': 'application/json', 'Authorization': `Bearer ${env.token}`, 'X-OC-Request-Id': env.requestId }; if (body !== undefined) { headers['Content-Type'] = 'application/json'; } const requestInit = { method, headers, signal: controller.signal }; if (body !== undefined) { requestInit.body = JSON.stringify(body); } let response; let ...[truncated 3117 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Pin the production API origin** - Use `https://tm.zhengquai.com` as an internal constant rather than accepting an unrestricted production base URL. - Parse the destination with `new URL()` and compare its complete origin against an explicit allowlist. - Reject unexpected hostnames, ports, protocols, embedded credentials, and malformed URLs. 2. **Remove unrestricted plaintext transport** - Remove `ALLOW_HTTP` from production builds. - If plaintext HTTP is required for tests, permit it only for loopback addresses such as `127.0.0.1`, `::1`, and `localhost`. - Require separate, non-production test credentials for development endpoints. 3. **Separate production and development configuration** - Place custom endpoints behind an explicit development mode that is disabled by default. - Display a blocking confirmation or fail closed when a production-format `tmu_` credential is paired with a development endpoint. - Do not rely on a warning as the sole credential protection. 4. **Validate redirects** - Disable automatic redirects or validate every redirect destination before following it. - Never forward the authorization header to an origin that has not been explicitly approved. 5. **Add regression tests** - Verify that arbitrary HTTPS hosts are rejected. - Verify that non-loopback HTTP endpoints are rejected even when a development option is enabled. - Verify that alternate ports, embedded URL credentials, deceptive subdomains, and malformed origins are rejected. - Continue verifying that tokens never appear in stdout, stderr, or error objects. A hardened validation pattern could use an exact origin comparison: ```js const PRODUCTION_ORIGIN = 'https://tm.zhengquai.com'; function validateBaseUrl(rawBaseUrl) { const parsed = new URL(rawBaseUrl); if (parsed.origin !== PRODUCTION_ORIGIN) { throw createSkillError( 'PLATFORM_ORIGIN_INVALID', `Platform origin must b ...[truncated 239 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (21)

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The contract instructs clients to use a bearer token from an environment variable but does not clearly label it as a sensitive secret or warn against logging, sharing, or embedding it. In an agent/CLI integration context, this increases the risk of accidental credential exposure through debug output, screenshots, shell history, repositories, or misconfigured tooling, which could let an attacker invoke billed APIs and access account-scoped data.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
This markdown file documents operations that affect user billing and credits, including searches, detail retrieval, and export creation. Although costs are stated in the endpoint descriptions, there is no explicit warning or caution section advising users that invoking these operations will spend points and may impact their account balance.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
All user-facing natural-language content in the file is presented exclusively in Chinese, and there is no indication that the skill supports other languages or that Chinese is a justified regional requirement. Per the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The English and Chinese trial-points sections materially contradict each other: English says 10 points expiring in 30 days, while Chinese says 100 points expiring in 90 days. In a billing and entitlement document, conflicting language can mislead users, create disputes, and cause inconsistent enforcement across locales; while not a code-execution issue, it is a real trust, compliance, and consumer-protection vulnerability.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The document provides compliance instructions exclusively in English and Chinese, with no indication that users may select another language or that these are merely example translations. Under the policy, forcing specific languages without user opt-in can be a natural-language locale violation unless the restriction is clearly justified.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill instructs the host to invoke a local Node CLI and interact with a remote API, which implies network access and likely environment-based secret handling, but it does not declare any explicit tool scope such as allowed tools or permissions. This creates an authorization ambiguity: a host may grant broader-than-necessary capabilities, increasing the risk of unintended network access, secret exposure, or unsafe execution assumptions.

Natural-Language Policy Violations

Medium
Confidence
86% confidence
Finding
The entire skill description and prescribed interaction flow are written only in Chinese, and there is no indication that users may choose another language or that the Chinese-only requirement is an explicit opt-in. Under the policy, forcing a specific language without user choice can be a natural-language policy violation unless the locale restriction is clearly documented and justified.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The natural-language instruction begins with "Use $chinese_trademark_search_skill..." in English, while the skill name and description are Chinese-facing. This indicates a language preference being imposed by the skill rather than offering the user a choice or documenting a justified locale constraint.

Natural-Language Policy Violations

Low
Confidence
90% confidence
Finding
The API contract is written entirely in Chinese and presents all user-facing messages, field labels, and workflow guidance only in Chinese. Under the language/locale policy rule, this is a natural-language locale constraint without any visible opt-in, alternative locale, or justification that the skill is region-specific.

Intent-Code Divergence

Low
Confidence
98% confidence
Finding
Line L463 says the Chinese `steps` and `trialNotice` mean new organizations receive 10 trial points valid for 30 days, but the actual Chinese `trialNotice` at L459 states 100 trial points valid for 90 days. This is an active contradiction in the documentation, not merely an omission, and could mislead users about billing and onboarding terms.

Natural-Language Policy Violations

Low
Confidence
87% confidence
Finding
This line states that the `steps` and `trialNotice` fields are returned by the platform in Chinese, which imposes a specific language on users. The file does not indicate any user choice, opt-in, or justified locale restriction for this behavior.

Missing User Warnings

Low
Confidence
91% confidence
Finding
This markdown file includes example requests to export query results as a file, which can affect user data handling on the system. The examples mention cost confirmation but do not warn that an export will create a file or describe storage/privacy implications.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
SQP-3 covers language or locale policy violations when a skill forces a specific language without user opt-in. This file is entirely bilingual in English and Chinese, but it does not indicate that users may select a preferred language or obtain the notice in another locale, which can be read as imposing fixed languages.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
The document states that the skill provides Chinese trademark search results and directs users to Chinese trademark authorities, which indicates a fixed language/locale context. While this may be functionally related to the skill, the file does not explicitly offer a user language/locale choice or document the constraint as a justified region-specific limitation.

Natural-Language Policy Violations

Low
Confidence
79% confidence
Finding
The document states that points are purchased at '1 CNY = 5 points' and presents CNY as the base purchase currency. While approximate USD/EUR references are provided, there is no explicit user choice of billing currency or explanation that the service is China-specific, which can be a natural-language locale policy concern.

Scope Creep

Low
Category
Excessive Agency
Content
### Applicability

This Skill and the associated platform services are subject to export control and economic sanctions laws and regulations, including but not limited to:

- **United States Export Administration Regulations (EAR)**, administered by the Bureau of Industry and Security (BIS)
- **United States Office of Foreign Assets Control (OFAC)** sanctions programs
Confidence
70% confidence
Finding
Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Scope Creep

Low
Category
Excessive Agency
Content
### Applicability

This Skill and the associated platform services are subject to export control and economic sanctions laws and regulations, including but not limited to:

- **United States Export Administration Regulations (EAR)**, administered by the Bureau of Industry and Security (BIS)
- **United States Office of Foreign Assets Control (OFAC)** sanctions programs
Confidence
70% confidence
Finding
Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Scope Creep

Low
Category
Excessive Agency
Content
### Applicability

This Skill and the associated platform services are subject to export control and economic sanctions laws and regulations, including but not limited to:

- **United States Export Administration Regulations (EAR)**, administered by the Bureau of Industry and Security (BIS)
- **United States Office of Foreign Assets Control (OFAC)** sanctions programs
Confidence
70% confidence
Finding
Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Natural-Language Policy Violations

Low
Confidence
76% confidence
Finding
The package description explicitly scopes the skill to 'Chinese trademarks,' which is a locale-specific constraint expressed in natural language. In this file there is no accompanying statement that this is optional, user-selected, or justified as a region-specific compliance/business requirement.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The file initializes the current language to 'zh', and later language resolution also falls back to Chinese unless the user explicitly passes --lang en. This imposes a specific language by default rather than offering a neutral prompt or explicit opt-in, which matches the locale-policy concern described for natural-language policy violations.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
The natural-language strings in the tests show the CLI emits Chinese messages by default and only switches to English when the user passes `--lang en`. This suggests a language-default policy choice embedded in the skill behavior without evidence here of user choice or justification, which may violate language/locale neutrality requirements.

Static analysis

Detected: suspicious.dangerous_exec, suspicious.env_credential_access, suspicious.exposed_secret_literal

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/cli.test.mjs:54

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/cli.mjs:323

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
API_CONTRACT_EN.md:68

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
API_CONTRACT.md:68