Back to skill

Security audit

谷歌专利检索

Security checks for vulnerabilities and agentic risk

Overview

This patent-search skill has a real search function, but it also handles phone login, API keys, payments, persistent local files, and automatic feedback in ways users should review carefully before installing.

Install only if you trust LinkFox with your patent queries, account details, phone-based login flow, payment operations, and feedback data. Avoid using it for confidential patent strategy unless endpoint variables are controlled, local output paths are safe, caching is acceptable, and API keys are stored in a proper secret manager rather than shell startup files.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/google_patent_search.py:37
Finding

Environment-controlled API endpoints can redirect credentials and personal data

Content
View full analysis
str: """Gateway base URL: env LINKFOX_TOOL_GATEWAY first, otherwise production.""" return (os.environ.get("LINKFOX_TOOL_GATEWAY") or "https://tool-gateway.linkfox.com").rstrip("/") def call_api(params): api_url = get_api_url() api_key = get_api_key() data = json.dumps(params).encode("utf-8") headers = { "Authorization": api_key, "Content-Type": "application/json", "User-Agent": "LinkFox-Skill/2.0", "SESSION_ID": os.environ.get("SESSION_ID", ""), "MESSAGE_ID": os.environ.get("MESSAGE_ID", ""), "MODE_ID": os.environ.get("MODE_ID", ""), "APP_NAME": os.environ.get("APP_NAME", ""), } req = Request(api_url, data=data, headers=headers, method="POST") with urlopen(req, timeout=150) as response: return json.loads(response.read().decode("utf-8")) ``` The onboarding script similarly accepts unrestricted endpoint overrides: ```python def _agent_base() -> str: return _env_base( "LINKFOX_AGENT_API_URL", "https://tool-gateway.linkfox.com", "LINKFOX_TOOL_GATEWAY", ) def _login_base() -> str: return _env_base("LINKFOX_LOGIN_API_URL", "https://api.linkfox.com") def _agent_user_base() -> str: return _env_base( "LINKFOX_AGENT_USER_API_URL", "https://agent-api.linkfox.com", ) ``` Sensitive data is subsequently sent to those endpoints: ```python resp = _login_post("/user/v3/web/login", { "type": "sms", "method": "login", "systemId": "LinkFoxAgent", "data": { "areaCode": "+86", "authPhone": phone, "authCode": code, "sourceChannel": channel or "skill", }, }) resp = _ht ...[truncated 2561 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/google_patent_search.py:248
Finding

Unvalidated session identifier permits output-path traversal

Content
View full analysis
str: """Prefer env SESSION_ID; otherwise generate HHMMSS-random.""" env = os.environ.get("SESSION_ID") if env: return env.strip() if "_auto" not in _SESSION_CACHE: _SESSION_CACHE["_auto"] = ( time.strftime("%H%M%S", time.localtime(ts)) + "-" + secrets.token_hex(3) ) return _SESSION_CACHE["_auto"] def _ensure_session(ts: float) -> tuple[str, str]: date_str = time.strftime("%Y-%m-%d", time.localtime(ts)) sid = _session_id(ts) root = _linkfox_root() session_dir = os.path.join(root, date_str, sid) os.makedirs(session_dir, exist_ok=True) _ensure_meta(root, session_dir, date_str, sid, ts) return root, session_dir ``` The onboarding script repeats the same pattern: ```python sid = (os.environ.get("SESSION_ID") or "").strip() or ( time.strftime("%H%M%S", time.localtime(ts)) + "-" + secrets.token_hex(3) ) path = os.path.join( _linkfox_root(), time.strftime("%Y-%m-%d", time.localtime(ts)), sid, ) os.makedirs(path, exist_ok=True) ``` ### Technical Analysis `SESSION_ID` is used as a filesystem path component without validating that it is a simple identifier. Values containing `..`, path separators, or an absolute path can escape the intended date/session directory. Python's `os.path.join` discards preceding components when a later component is absolute. Relative traversal sequences can likewise resolve outside the intended root. The search script then creates metadata and response files below the resulting directory. The onboarding script can place generated payment QR files there. The vulnerability does not directly let the attacker choose the timest ...[truncated 1112 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/onboarding.py:478
Finding

Generated API key is returned through standard output and encouraged to be stored in plaintext shell configuration

Content
View full analysis
None: print(json.dumps(obj, ensure_ascii=False, indent=2)) def _cmd_login(args) -> int: r = login_and_get_key(args.phone.strip(), args.code.strip(), args.channel) _emit(r) if "api_key" in r: print( f"{TAG} Successfully obtained API key (source: {r['source']})", file=sys.stderr, ) return 0 return 1 ``` The onboarding instructions direct users to persist the secret in plaintext startup files: ```text echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.zshrc echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.bashrc ``` ### Technical Analysis The complete API key is embedded in JSON and printed to standard output. In an agent-based environment, standard output may be copied into conversation history, execution traces, CI logs, terminal scrollback, telemetry, or orchestration logs. The documentation further recommends writing the key directly into shell startup files. Those files are long-lived and are frequently included in backups, support bundles, workstation migrations, or diagnostic collections. Their permissions are not checked or hardened by the Skill. Returning a newly generated credential is part of onboarding, but exposing it through ordinary output and instructing the agent to forward i ...[truncated 1021 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/google_patent_search.py:93
Finding

Search responses are cached in potentially shared locations without restrictive permissions

Content
View full analysis
Remediation
View remediation

other

Warning
Location
SKILL.md:192
Finding

Skill instructions mandate automatic disclosure of user statements and intent to a separate feedback service

Content
View full analysis
Remediation
View remediation

other

Note
Location
scripts/google_patent_search.py:60
Finding

Patent search transmits unnecessary correlation metadata, including an undocumented message identifier

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (28)

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

Critical
Category
Data Flow
Confidence
93% confidence
Finding

The request URL is derived from the environment-controlled gateway base (LINKFOX_TOOL_GATEWAY) and then sent via urlopen, while sensitive headers including the API key and session identifiers are attached to the request. In an untrusted or multi-tenant runtime, an attacker who can influence environment variables can redirect requests to an attacker-controlled host and exfiltrate credentials and request contents.

Content

Scanner excerpt · scripts/google_patent_search.py (reported line 78)May include surrounding context.

python
method="POST",
    )
    try:
        with urlopen(req, timeout=150) as response:
            return json.loads(response.read().decode("utf-8"))
    except HTTPError as e:
        body = e.read().decode("utf-8") if e.fp else ""

Tainted flow: 'url' from os.environ.get (line 235, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
95% confidence
Finding

The POST target URL is derived from environment-controlled base URLs and is used to send highly sensitive data including phone numbers, SMS codes, access tokens, refresh tokens, and generated API keys. In an agent or hosted execution environment, environment variables can be influenced by deployment configuration, making this an SSRF/exfiltration path that can silently redirect credentials to an attacker-controlled endpoint.

Content

Scanner excerpt · scripts/onboarding.py (reported line 196)May include surrounding context.

python
except RuntimeError as e:
        return {"_error": str(e)}
    try:
        r = requests.post(url, json=body or {}, headers=headers, timeout=timeout)
        return r.json()
    except Exception as e:
        body_text = ""

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

Critical
Category
Data Flow
Confidence
94% confidence
Finding

The gateway request URL is likewise built from an environment-controlled base and then fetched with urlopen while attaching the Authorization header from LINKFOX_AGENT_API_KEY. If an attacker can influence the environment, they can redirect these authenticated requests to an arbitrary server and capture API keys or trigger unexpected outbound requests.

Content

Scanner excerpt · scripts/onboarding.py (reported line 246)May include surrounding context.

python
headers["Content-Type"] = "application/json"
        req = Request(url, method=method, data=body_bytes, headers=headers)
        try:
            with urlopen(req, timeout=30) as resp:
                return json.loads(resp.read().decode())
        except urllib.error.HTTPError as e:
            status = e.code

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose is patent search, but the detected behavior includes account login, API key generation, user/team info access, plan listing, order creation, payment initiation, QR code generation, and payment status queries. This is a major capability mismatch that can surprise users, enable unauthorized billing flows, and expose account or payment data under the guise of a search skill.

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

text
Action: `{"q": "wireless earbuds", "page": 2, "num": 20}`

## Display Rules

1. **Present results as a table**: show `publicationNumber`, `title`, `inventor`, `assignee`, `publicationDate`/`grantDate` per item.
2. **Show totals**: always state the total hit count from `searchInformation`/`pagination` and the current page range.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/onboarding.md (reported line 14)May include surrounding context.

md
示 JSON 里的 phone/agreements
   - 收到验证码后:`python scripts/onboarding.py login <phone> <code>`
   - 拿到 `api_key` 后把下面三平台配置转发给用户,提示重启会话生效:
     - Windows PowerShell(永久):`setx LINKFOX_AGENT_API_KEY "<key>"`
     - macOS zsh:`echo 'export LINKFOX_AGENT_API_KEY="<key>"' >> ~/.zshrc && source ~/.zshrc`
     - Linux bash:`echo 'export LINKFOX_AGENT_API_KEY="<key>"' >> ~/.bashrc && source ~/.bashrc`
     - 变量名 `LINKFOX_AGENT_API_KEY`(主推)或 `LINKFOXAGENT_API_KEY`(老规范)任一即可

**billing 场景**:`errcode=402` 或消息含 `算力/余额/quota/insufficient/充值/套餐到期`。
- `python scripts/onboarding.py list-plans` → 有 AskUserQuestion 就弹菜单,否则输出编号清单让用户选
- 校验 `plan_id` ∈ 清单、支付方式 ∈ 该套餐 `available_methods`(通常 `wechat/alipay`)
- `python scripts/onboarding.py order <plan_id> <method>` → 展示优先级 PNG

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The documentation claims /tmp must not be used and that failure to write the current directory should error out, but the implementation silently falls back to the home directory and temporary directory. This mismatch undermines operator expectations and can cause sensitive response data and session metadata to be written into less-controlled locations, especially shared temp areas.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This file implements LinkFox onboarding, login, token handling, package purchase, and payment QR generation, which is materially unrelated to the declared Google Patents search functionality. Such capability mismatch is dangerous because it enables credential collection and account monetization flows under the cover of an unrelated skill, increasing the likelihood of deceptive abuse.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill contains package discovery, order creation, and payment QR rendering even though the advertised purpose is patent search. In this context, billing and payment logic is unjustified and can be used to induce purchases or route users into unrelated commercial flows, making the mismatch more dangerous than it would be in a legitimate commerce skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code performs SMS-based authentication, token exchange, user/team discovery, and API key generation for LinkFox accounts, none of which is necessary for patent search. This creates a direct credential-harvesting and secret-provisioning pathway hidden inside an unrelated skill, greatly increasing risk of account compromise or unauthorized account creation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill appears to use environment variables, network access, and file writes but does not declare any explicit tool scope or allowed-tools boundary. That makes its execution privileges ambiguous and can permit broader access than users or reviewers expect, increasing the risk of unintended data access, persistence, or external calls.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger conditions are broad enough to fire on many generic patent-related requests, even when the user did not ask for Google Patents specifically. Over-broad invocation can cause unintended external queries, unnecessary cost, and disclosure of user research terms to third-party services without sufficiently specific intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill metadata and behavior are written to force Chinese-language interaction regardless of user preference. While not a classic security flaw, this can impair informed consent and user understanding of what external actions, costs, or data handling will occur, especially for non-Chinese-speaking users.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill instructs persistent storage of full responses in session-scoped project files, which may include sensitive user queries, search terms, identifiers, and provider metadata. Writing this data in plain JSON under the working directory increases the chance of unintended retention, repo inclusion, cross-task exposure, or access by other tools and users.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/api.md (reported line 110)May include surrounding context.

{"errcode": 401, "errmsg": "authorized error"}

text

## curl 示例

**基础检索:**

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation introduces a separate external feedback API unrelated to the patent-search execution path, which expands the skill's data-flow surface without clear necessity. In an agent setting, this can cause user content, task context, or operational details to be transmitted to a third party outside the primary tool purpose, especially if an orchestrator auto-implements all documented endpoints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The feedback section tells integrators to send free-form content to an external endpoint but provides no privacy warning, consent requirement, or data-minimization guidance. This creates a realistic risk that personal data, confidential user requests, or sensitive patent-search context will be exfiltrated to a third party under the guise of telemetry.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The referenced behavior focuses on auth and billing recovery rather than patent retrieval, which materially diverges from the manifest's declared purpose. Such mismatches are dangerous because users and higher-level policy may trust the skill as a search tool while it actually initiates credential setup and payment flows, enabling confused-deputy behavior and overcollection of sensitive data.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The onboarding document directs the agent to handle authentication, phone-based registration, and payment flows that are unrelated to the stated patent-search capability. This scope expansion can cause the skill to collect sensitive user data and steer users into account/payment operations they did not request, increasing the risk of privacy abuse, social engineering, and unauthorized transactions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs obtaining a user's phone number and sending it to a registration script without any explicit consent, privacy notice, retention policy, or verification that the phone number belongs to the requester. This exposes personally identifiable information and could lead to unauthorized account creation or linkage using a third party's number.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This file contains natural-language descriptions and usage guidance entirely in Chinese for key operational behavior, while providing no indication that the user can choose another language. That can violate a language/locale policy when the skill is not clearly documented as region-specific or opt-in.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill always writes full patent search responses and session metadata to local storage, which exceeds a simple search-and-return behavior and creates unnecessary data retention. Even if patent data is public, queries, assignee/inventor interest, session IDs, and usage metadata may reveal sensitive user intent, research strategy, or client matters.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The comment says small responses are output directly without file persistence, but the runtime always writes the full response to disk before printing. This misleading behavior can cause users and auditors to underestimate data retention, leading to unintentional local storage of potentially sensitive search activity and results.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/onboarding.py (reported line 196)May include surrounding context.

python
except RuntimeError as e:
        return {"_error": str(e)}
    try:
        r = requests.post(url, json=body or {}, headers=headers, timeout=timeout)
        return r.json()
    except Exception as e:
        body_text = ""

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The code retrieves or generates an API token and returns it without any in-file warning, consent gating, or indication of sensitivity. In a skill context, silent issuance of a credential is risky because downstream components or logs may expose the token, and users may not understand they are provisioning a reusable secret.

Content

No source excerpt is available for this finding.