Back to skill

Security audit

competitor-skill

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its patent-reporting purpose, but it handles API keys and generated content in ways that create real review-worthy security risk.

Install only after reviewing and preferably fixing the credential flow, dependency installation, title sanitization, endpoint allowlisting, and HTML escaping. Use a dedicated low-privilege API key, avoid sharing credentials with other skills, and treat generated HTML reports as untrusted until escaping is corrected.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run.sh:11
Finding

User-Controlled Report Title Enables Python Code Injection

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/config.py:12
Finding

Configurable API Base URLs Can Exfiltrate Bearer Credentials

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/render_html.py:465
Finding

Generated Reports Permit Stored HTML and JavaScript Injection

Content
View full analysis
📊 新公开专利概况 🏢 专利技术总结 📋 专利详情 {sidebar_company_links} {lit_nav} """ ``` ```python hero = f"""
技术情报报告

{title}

生成时间:{gen_time}
``` Patent data is inserted into text and attribute contexts without escaping: ```python fig_html = "" if p.get("fig"): fig_html = f'
{p[
摘要附图
' ``` ```python cards += f"""
{p['pn']} {legal} {assignee_clean} 申请 {p['apdt']} 公开 {p['pbdt']}
{p['title']}
{fields_html}
{fig_html}
""" ``` Literature and AI-generated content are also inserted without complete sanitization: ```python if len(abstract) <= 300: abstract_html = f'
{abstract}
' ``` ```python return f"""
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/run.sh:27
Finding

Unpinned Dependencies Are Downloaded and Executed at Runtime

Content
View full analysis
/dev/null; then "${CLEAN_ENV[@]}" uv run --with requests --with python-dotenv python scripts/fetch_competitor_report.py "$QUERY" "$TITLE" "$LIMIT" | tee "$OUTPUT_FILE" else PYTHON=$("${CLEAN_ENV[@]}" sh -c 'command -v python3 || command -v python || echo /opt/homebrew/bin/python3') "${CLEAN_ENV[@]}" "$PYTHON" -c "import requests, dotenv, oss2" 2>/dev/null || \ "${CLEAN_ENV[@]}" "$PYTHON" -m pip install --quiet requests python-dotenv oss2 "${CLEAN_ENV[@]}" "$PYTHON" scripts/fetch_competitor_report.py "$QUERY" "$TITLE" "$LIMIT" | tee "$OUTPUT_FILE" fi ``` ### Technical Analysis The execution wrapper dynamically resolves and installs packages every time required modules are unavailable. Package versions and artifact hashes are not pinned, so the effective code executed by the Skill can change after the Skill itself has been audited. The `uv` branch also requests mutable package names without a lockfile. In the fallback branch, `pip install` executes package installation logic from the configured Python package index. The `oss2` package is checked and installed even though the audited scripts do not import it and `SKILL.md` does not declare it as a dependency. This unnecessarily expands the trusted computing base and allows package-index configuration, dependency compromise, or future malicious package releases to affect Skill execution. ### Attack Path 1. The host lacks one or more checked dependencies, or the `uv` path creates a fresh environment. 2. The wrapper contacts the configured package registry or mirror. 3. Package names are resolved without exact versions or verified hashes. 4. The installer downloads the currently selected distributions and their transitive dependencies. 5. Installation hooks or subsequently im ...[truncated 742 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (44)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Handling authentication tokens and credentials for external services without disclosing that behavior is security-relevant, especially when the claimed user-visible functionality is unrelated or incomplete. Undeclared credential processing expands the attack surface and may result in secret leakage, unintended retention, or trust abuse.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Handling authentication tokens and credentials for external services without disclosing that behavior is security-relevant, especially when the claimed user-visible functionality is unrelated or incomplete. Undeclared credential processing expands the attack surface and may result in secret leakage, unintended retention, or trust abuse.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Handling authentication tokens and credentials for external services without disclosing that behavior is security-relevant, especially when the claimed user-visible functionality is unrelated or incomplete. Undeclared credential processing expands the attack surface and may result in secret leakage, unintended retention, or trust abuse.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Handling authentication tokens and credentials for external services without disclosing that behavior is security-relevant, especially when the claimed user-visible functionality is unrelated or incomplete. Undeclared credential processing expands the attack surface and may result in secret leakage, unintended retention, or trust abuse.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly instructs the agent to solicit a user's API key via natural-language conversation and save it to a local .env file. This is dangerous because chat is not an appropriate secret-entry channel, plaintext local storage is easy to leak, and the credential may later be accessed by other tools, logs, or users on the same system.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bash scripts/run.sh "<检索式>" "<报告标题>" [数量]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bash scripts/run.sh "<检索式>" "<报告标题>" [数量]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bash scripts/run.sh "<检索式>" "<报告标题>" [数量]

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

The skill enumerates and loads .env files from local paths including another skill's directory, which is a form of credential access beyond its own configuration scope. In an agent ecosystem, this is particularly dangerous because it enables unauthorized reuse of secrets across skills and can expose API keys to code that the user did not intend to trust with those credentials.

Content

Scanner excerpt · scripts/config.py (reported line 7)May include surrounding context.

python
# 优先加载本目录的 .env,其次加载 patsnap_skill 的 .env(共享凭证)
_here = Path(__file__).parent
for _env in [_here / ".env", _here.parent / ".env", Path.home() / "Documents" / "patsnap_skill" / ".env", Path.home() / "Documents" / "patsnap_skill" / "scripts" / ".env"]:
    if _env.exists():
        load_dotenv(_env)
        break

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 13)May include surrounding context.

python
break

PATSNAP_BASE_URL = os.getenv("PATSNAP_BASE_URL", "https://connect.zhihuiya.com")
PATSNAP_API_KEY = os.getenv("PATSNAP_API_KEY", "")  # 从 scripts/.env 读取,首次使用需配置
LITERATURE_API_KEY = os.getenv("LITERATURE_API_KEY", PATSNAP_API_KEY)
ARK_API_KEY = os.getenv("ARK_API_KEY", "")
ARK_BASE_URL = os.getenv("ARK_BASE_URL", "https://ark.cn-beijing.volces.com/api/v3")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/fetch_competitor_report.py (reported line 303)May include surrounding context.

python
# 检测 API Key 是否已配置
    if not _cfg.PATSNAP_API_KEY:
        env_path = Path(__file__).parent / ".env"
        print("[配置] 未检测到智慧芽 API Key。", file=sys.stderr)
        print("[配置] 请前往 https://connect.zhihuiya.com 获取 API Key(格式:sk-xxx)", file=sys.stderr)
        print(f"[配置] 然后将以下内容写入 {env_path}:", file=sys.stderr)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill document describes capabilities to read/write local files, access environment configuration, and call external services, but it does not declare any explicit tool scope or permission boundaries. In an agent setting, missing scope declarations increases the chance of overbroad tool access and makes it harder for users or the platform to reason about what the skill may do.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description and operating instructions are presented exclusively in Chinese, including trigger conditions and user interaction text. This can violate language/locale policy when the skill forces a specific language without explicitly offering the user a choice or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest presents a reporting skill, but the instructions also direct the agent to collect and persist the user's API key in a local .env file. That is a sensitive-data handling behavior not implied by the core description, and it increases the risk of credential exposure through local file access, backups, logs, or later reuse by other processes.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

Conflicting instructions about using a local .env API key versus an external MCP authorization model create ambiguity about which trust boundary applies and where credentials should be stored. Ambiguous auth paths often lead to insecure fallback behavior, user confusion, and accidental exposure of secrets to the wrong component.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The report contains a large journal-literature section and AI-generated literature synthesis that goes beyond the declared function of patent-database competitor patent analysis. This scope expansion can cause unintended data retrieval, processing, and disclosure pathways, especially if users expect the skill to stay confined to patent results and internal competitive-intelligence constraints.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The literature summary is semantically off-target for a dump-truck competitor patent report, including unrelated topics such as elderly web assistance, public figures, and geophysics. This indicates poor query scoping or uncontrolled retrieval/aggregation behavior, which is dangerous because it can mislead decision-making, contaminate intelligence outputs, and mask whether the agent is using approved sources for its stated purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The report goes beyond the declared scope of competitor patent analysis by pulling in broad journal literature and generating AI summaries over that material. This creates scope creep that can expose users to irrelevant or unvetted external content, increase hallucination risk, and potentially cause unauthorized data processing beyond what the skill description leads users to expect.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document appears to expand a dump-truck patent query into loosely matching terms such as 'tipper', 'dump', and unrelated literature entries, which undermines query fidelity and can produce misleading competitor intelligence. In a business-analysis skill, this is dangerous because users may rely on contaminated results for strategic decisions while assuming the output accurately reflects the original patent search intent.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code searches for and loads a .env file from a different skill directory under the user's home folder, effectively allowing this skill to consume credentials intended for another project. That creates cross-skill secret leakage and trust-boundary violation: if the other directory exists, this skill can silently inherit API keys without explicit user consent or isolation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file includes Chinese-language comments and defaults to China-specific service domains such as connect.zhihuiya.com and cn-beijing.volces.com, suggesting a fixed language/locale context. There is no visible user choice, opt-in, or documented justification that this skill is intended only for a Chinese-region deployment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file-level description and multiple API calls indicate the skill is designed to operate in Chinese only, and the code hard-codes lang: "cn" for fetched patent data. Because there is no user opt-in or language selection mechanism, this is a natural-language locale policy issue under the rule for forced language constraints.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest description limits the skill to querying a patent database from a PatSnap search expression and generating a competitor patent analysis report. However, the code imports literature-retrieval and literature-AI-summary helpers and later appends a journal literature section to the report, expanding the behavior beyond patent analysis into broader literature analysis.

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/fetch_competitor_report.py (reported line 58)May include surrounding context.

python
"collapse_type": "DOCDB",
        "collapse_order": "LATEST",
    }
    resp = requests.post(url, json=payload, headers=_auth_headers(), timeout=30)
    resp.raise_for_status()
    return resp.json().get("data", {}).get("results", [])

Tainted flow: 'pid' from requests.get (line 139, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/fetch_competitor_report.py (reported line 98)May include surrounding context.

python
def fetch_one(pid):
        try:
            resp = requests.get(url, params={"patent_id": pid, "lang": "cn"},
                                headers=_auth_headers(), timeout=20)
            resp.raise_for_status()
            item = resp.json().get("data") or {}