Back to skill

Security audit

Pans Lead Miner

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent lead-mining tool that searches a local SearXNG service and can export results, with some clear data-quality and output-handling cautions.

Use this skill only when you intend to run lead searches through your local SearXNG service. Check whether returned records are marked as demo before using them for outreach or business decisions, treat snippets and URLs as untrusted web content, and choose --export paths carefully because exported lead files may persist locally.

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

Warning
Location
scripts/miner.py:425
Finding

Unsanitized search results can enable indirect prompt injection and Markdown output manipulation

Content
View full analysis

Vulnerability Details

File Location: scripts/miner.py:185-197 and scripts/miner.py:425-446
Vulnerability Type: Untrusted external content rendered without sanitization
Risk Level: Medium

Vulnerable Code

Search-result fields are accepted directly from SearXNG:

python
for item in data.get("results", []):
    combined_text = f"{item.get('title', '')} {item.get('content', '')}"
    results.append({
        "company": _extract_company(item.get("title", "Unknown")),
        "title": item.get("title", ""),
        "url": item.get("url", ""),
        "snippet": item.get("content", ""),
        "source": cat,
        "stage": _extract_stage(combined_text),
        "amount": _extract_amount(combined_text),
        "signal_score": _compute_signal_score(combined_text),
        "region": _infer_region(combined_text),
    })

The externally controlled values are subsequently placed into Markdown output:

python
for i, lead in enumerate(leads, 1):
    lines.append(f"### {i}. {lead['company']}")
    lines.append(f"- **Stage:** {lead.get('stage') or 'N/A'}")
    lines.append(f"- **Region:** {lead.get('region', 'GLOBAL')}")
    lines.append(f"- **Signal Score:** {lead.get('signal_score', 0)}/100")
    lines.append(f"- **Source:** {lead.get('source', 'N/A')}")
    if lead.get("url"):
        lines.append(f"- **URL:** {lead['url']}")
    if lead.get("snippet"):
        lines.append(f"- **Snippet:** {lead['snippet']}")
    lines.append("")

Technical Analysis

Search-result titles, URLs, and snippets originate from websites indexed by SearXNG and must therefore be treated as attacker-controlled input. The implementation copies these values into Markdown without escaping Markdown control characters, validating URL schemes, delimiting retrieved content, or neutralizing instruction-like text.

An attacker who can cause crafted content to appear in relevant search result ...[truncated 1569 chars]

Remediation
View remediation

Remediation Suggestions

  1. Treat every SearXNG field as untrusted external data.
  2. Escape Markdown metacharacters in company names, snippets, stages, sources, and other text fields before rendering.
  3. Validate URLs with urllib.parse.urlsplit() and permit only explicitly supported schemes such as https and, if necessary, http.
  4. Render retrieved snippets inside clearly labeled quoted or fenced data blocks and state that their contents are untrusted source material, not executable instructions.
  5. Apply length limits and remove control characters from all retrieved fields.
  6. Where output is consumed by another agent, pass records as structured JSON and enforce a policy that instructions contained in retrieved fields must never be followed.
  7. Consider retaining both raw and sanitized fields internally so output encoding is applied specifically for each target format.

other

Note
Location
scripts/miner.py:552
Finding

Backend failures and empty searches silently produce fabricated lead data

Content
View full analysis

Vulnerability Details

File Location: scripts/miner.py:552-557
Vulnerability Type: Data integrity failure caused by implicit demo-data fallback
Risk Level: Low

Vulnerable Code

python
if not args.demo:
    print(f"🔍 Searching for '{keyword}' via SearXNG...", file=sys.stderr)
    leads = search_searxng(keyword, source, region, fetch_limit)

    if not leads:
        print("⚠️  SearXNG unavailable, using demo data.", file=sys.stderr)
        leads = generate_demo_leads(keyword, region, args.size, fetch_limit)
else:
    print("📋 Demo mode enabled.", file=sys.stderr)
    leads = generate_demo_leads(keyword, region, args.size, fetch_limit)

Technical Analysis

The program uses the same empty-list result for multiple materially different conditions:

  • A SearXNG transport or response-parsing failure.
  • A valid search that legitimately returned no results.
  • Search categories that did not produce matching records.

In every case, the normal non-demo execution path automatically substitutes hard-coded illustrative companies and funding details. The only notification is written to standard error, while standard output or an exported file contains apparently valid lead records. Machine consumers that read only standard output or exported files may therefore be unable to distinguish fabricated demo records from real search results.

This is a data-integrity and provenance issue rather than a direct privilege-escalation vulnerability.

Attack Path

  1. A user or automated workflow invokes the skill without --demo, expecting live search results.
  2. The local SearXNG service becomes unavailable, returns malformed JSON, or returns no matching records.
  3. _safe_get() or search_searxng() produces no leads.
  4. The default fallback calls generate_demo_leads() and creates fictional or illustrative records.
  5. The generated data is printed as JSON, CSV, or Markdown, or written to an ...[truncated 705 chars]
Remediation
View remediation

Remediation Suggestions

  1. Use demonstration data only when the user explicitly supplies --demo.
  2. Return a nonzero exit status when SearXNG is unavailable or returns an invalid response.
  3. Distinguish transport failures from a successful search with zero results by returning a structured result or raising a dedicated exception.
  4. For legitimate zero-result searches, return an empty result set instead of sample records.
  5. Add explicit provenance fields such as "data_mode": "live" or "data_mode": "demo" to every machine-readable record.
  6. Include backend status and error details in JSON output when appropriate rather than relying exclusively on standard-error warnings.
  7. Require a separate opt-in flag, such as --fallback-demo, if automatic fallback is considered necessary for interactive demonstrations.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (7)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises network access to a local SearXNG instance and supports exporting results to CSV, but it does not declare any explicit tool scope or permission boundaries. Missing scope declarations make it harder for the platform and user to understand or constrain what the skill may access or write, increasing the risk of unintended network use or file output when invoked.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger phrases are broad sales and search terms like '客户发现', 'AI公司搜索', and 'prospect', which can overlap with ordinary user requests and cause accidental invocation. Unintended activation is risky here because the skill performs external searches and may collect and export lead data without the user clearly intending to run this specific workflow.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill supports exporting discovered lead information to a CSV file, but the description does not clearly warn users about this data persistence behavior. That omission can lead to users unintentionally creating local files containing prospect or personal data, which may then be retained, shared, or mishandled outside the immediate session.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code file contains user-facing natural-language descriptions in Chinese in the module docstring, and additional Chinese-only CLI descriptions appear later. That can violate language/locale policy when the skill does not offer user opt-in or explain that it is intended only for Chinese-speaking users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The argparse description, epilog, and help strings are presented in Chinese only, which imposes a specific language on users. The file does not provide an alternative locale, language toggle, or justification that the tool is restricted to a Chinese-language audience.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The tool advertises live lead mining across external sources, but when the search backend fails it silently substitutes fabricated demo companies. In a sales-intelligence context, this can mislead users into acting on nonexistent prospects, corrupt downstream CRM data, and cause business decisions to be made on false information without clear disclosure.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The CLI exposes a --size filter and the manifest describes automatic filtering of potential customers, implying the requested criteria will affect results. In practice, the code accepts the size argument but never applies SIZE_MAP or any size-based filtering to live or demo results, so behavior does not match the stated filtering capability.

Content

No source excerpt is available for this finding.