Back to skill

Security audit

High-Value Patent Portfolio Screening

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent PatSnap patent-screening workflow with disclosed credential, network, and report-generation behavior, though users should be careful with optional remote image handling.

Install in a virtual environment, provide the PatSnap API key only through PATSNAP_API_KEY or an explicit key file, and run it only on reviewed queries. Treat generated checkpoints as trusted inputs: avoid editing final_records.json with arbitrary drawing URLs, and be cautious with --word --images or opening HTML reports in sensitive networks because remote images can trigger outbound requests.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/hv_8_word.py:192
Finding

Optional Word Image Download Permits Server-Side Request Forgery

Content
View full analysis
bytes | None: if requests is None: return None parsed = urlparse(str(url or "")) if parsed.scheme.lower() not in {"http", "https"} or not parsed.netloc: return None try: response = requests.get(str(url), timeout=(8, 20), allow_redirects=False, stream=True, headers={"User-Agent": "patsnap-high-value-screening/2.0"}) if response.status_code != 200 or "image/" not in response.headers.get("Content-Type", "").lower(): return None declared = response.headers.get("Content-Length") if declared and int(declared) > MAX_IMAGE_BYTES: return None content = bytearray() for block in response.iter_content(64 * 1024): content.extend(block) if len(content) > MAX_IMAGE_BYTES: return None return bytes(content) except (requests.RequestException, ValueError): return None ``` ### Technical Analysis The function accepts any URL whose scheme is HTTP or HTTPS and whose parsed URL contains a network location. It does not restrict the destination to PatSnap-controlled image hosts or reject loopback, private, link-local, multicast, reserved, and cloud metadata addresses. The drawing URL originates from the P021 API response in `scripts/hv_5_display.py` and is propagated through `final_records.json`. That checkpoint can also be modified locally before the optional Word generation stage. Consequently, either a compromised upstream response or a tampered checkpoint can control the destination requested by the process. Rejecting redirects reduces cross-host redirection risk but does not protect the initial request. The response size and content-type checks occur only after the ...[truncated 1415 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/hv_7_html_a.py:55
Finding

Generated HTML Automatically Loads Untrusted Remote Images

Content
View full analysis
str: url = safe_url(record.get("drawing")) if not url: return f'{esc(str(record.get("drawing_state") or "not_run").replace("_", " ").title())}' alt = f"Abstract drawing for {record.get('pn') or 'selected patent'}" return f'{html.escape(alt, quote=True)}' ``` The associated URL validator accepts any absolute HTTP or HTTPS destination: ```python def safe_url(value: Any) -> str | None: text = str(value or "").strip() parsed = urlparse(text) return text if parsed.scheme.lower() in {"http", "https"} and parsed.netloc else None ``` ### Technical Analysis The report is described as static HTML, but an accepted drawing URL is embedded directly into an `` attribute. When a reviewer opens the report and the image enters the browser's loading range, the browser contacts the remote host. HTML escaping prevents markup injection, and `referrerpolicy="no-referrer"` limits referrer disclosure. However, the destination is not restricted to PatSnap-controlled infrastructure, HTTPS is not required, and remote content remains mutable after report generation. This also weakens report reproducibility: the image can expire, change, track access, or be replaced after the report has been created. ### Attack Path 1. A compromised P021 response or modified checkpoint supplies an attacker-controlled HTTP or HTTPS drawing URL. 2. Stage 6 copies the URL into the selected record. 3. Stage 7 accepts the URL because it has an allowed scheme and a host. 4. ...[truncated 745 chars]
Remediation
View remediation
` elements in the required HTML report by default. 2. Render the drawing state and a text-only link that requires an explicit reviewer action. 3. If embedding is required, download the image during an explicit opt-in step, validate it, and embed a local immutable copy or safe data URI. 4. Require HTTPS and restrict image destinations to an explicit list of trusted PatSnap hosts. 5. Record the image hash and retrieval time when embedding a local copy so the report remains auditable. 6. Retain a text alternative when an image is unavailable, expired, or rejected. 7. Consider a restrictive Content Security Policy, such as `default-src 'none'; img-src 'self' data:; style-src 'unsafe-inline'`, when reports no longer need remote images. ]]>

T08 · Insecure Dependencies

Note
Location
scripts/README.md:14
Finding

Dependency Installation Instructions Use Unpinned Packages

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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The code chunk does not implement the core declared function of ranking a patent universe using the stated factors or selecting a screening portfolio. Instead, it assumes selection has already happened (scored.json with selected_count) and enriches those selected patents with supplemental display evidence: abstract drawing paths, English technical summaries, and simple legal status. While this could be part of a larger pipeline supporting the overall skill, this specific chunk’s primary purpose is materially different from the declared description. It performs undeclared external retrieval against P021/P025/P041 and generates enrichment metadata rather than scoring, ranking, or portfolio selection. Therefore this code chunk is mismatched relative to the declared purpose.

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 341)May include surrounding context.

md
- Legal-event records retain category and event-level context.
- Dynamic HTML values are escaped; only HTTP(S) links are rendered.
- Reports use text labels, semantic tables, responsive local overflow, US-Letter
  print rules, and no color-only meaning.
- Secrets, local paths, China-only domains, guessed product URLs, and expiring
  image credentials are absent from persisted reports.
- A human reviewer approves the query, scoring interpretation, exceptions, and

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 · references/screening-standard.md (reported line 226)May include surrounding context.

md
- Legal-event records retain category and event-level context.
- Dynamic HTML values are escaped; only HTTP(S) links are rendered.
- Reports use text labels, semantic tables, responsive local overflow, US-Letter
  print rules, and no color-only meaning.
- Secrets, local paths, China-only domains, guessed product URLs, and expiring
  image credentials are absent from persisted reports.
- A human reviewer approves the query, scoring interpretation, exceptions, and

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/run_all.py (reported line 43)May include surrounding context.

python
if not 0.10 <= args.selection_ratio <= 0.15:
        parser.error("--selection-ratio must be between 0.10 and 0.15")
    args.output_dir.mkdir(parents=True, exist_ok=True)
    environment = dict(os.environ)
    environment["HVP_RUN_ID"] = environment.get("HVP_RUN_ID") or str(uuid.uuid4())
    environment["PYTHONDONTWRITEBYTECODE"] = "1"
    for script, description in STAGES:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill describes capabilities that require sensitive operations such as reading environment variables for API keys, network access to external services, file I/O, and likely shell-driven orchestration, but it declares no explicit tool or permission scope. That creates an over-privileged execution surface where a host may grant broader access than intended, increasing the blast radius if the skill is misused or modified.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This manifest file includes a default prompt describing what the skill should do, but it does not define any explicit trigger phrases, invocation boundaries, or negative examples. That ambiguity can cause the skill to match loosely related patent-screening requests rather than a clearly delimited activation condition.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The prompt explicitly instructs the skill to generate an 'English HTML report,' which forces a specific language in natural-language behavior. There is no indication that the user can opt into another language or that English-only output is required for a documented regional or compliance reason.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The params function unconditionally sets the request parameter lang to en when language mode is enabled. This enforced locale is then used for the technical summary retrieval, with no user opt-in or configurable language selection visible in the script.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The DOCX renderer includes an optional capability to fetch remote images from arbitrary HTTP(S) URLs embedded in the input data, which expands the skill from offline document generation into making outbound network requests. Even with scheme, redirect, content-type, timeout, and size checks, this can still be abused for SSRF-like access to attacker-chosen destinations, internal network probing, metadata-service access, or unintended data egress/signaling from environments where network access is sensitive.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/run_all.py (reported line 30)May include surrounding context.

python
def run_stage(script: str, description: str, *, working_directory: pathlib.Path, environment: dict[str, str], extra: list[str] | None = None) -> None:
    command = [sys.executable, str(SCRIPT_DIR / script)] + list(extra or [])
    print(f"\n===== {script}: {description} =====", flush=True)
    subprocess.run(command, cwd=working_directory, env=environment, check=True)


def main() -> int: