Back to skill

Security audit

xueqiu-collector

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed Xueqiu scraping skill, but it needs review because it drives a logged-in browser and has weak controls that can navigate to unintended URLs, fetch arbitrary image URLs, and write outside the intended output folder.

Review before installing. Use a dedicated Edge profile and least-privilege Xueqiu account, avoid collecting content without authorization or a lawful basis, choose a controlled output directory, do not pass untrusted author names or URLs, avoid --fix unless you accept local package changes, and monitor storage because images/OCR and exports can accumulate sensitive local data.

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/collect.py:1491
Finding

Arbitrary Filesystem Writes Through Author Path Traversal

Content
View full analysis
共{len(all_posts)}条,生成时间:{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n---\n\n") ``` ### Technical Analysis The user-controlled `--author` value is used directly as a filesystem path component. The application does not reject absolute paths, path separators, drive-qualified paths, or traversal sequences such as `..`. `os.path.join()` does not enforce containment. Traversal components can escape the configured output directory, and an absolute author value may cause the output root to be discarded entirely on supported platforms. The application then creates directories and writes predictable filenames beneath the resulting path. The affected outputs include: - `posts_full.json` - `posts_full.md` - Category-specific JSON and Markdown files - Downloaded image files - Intermediate output directories ### Attack Path 1. An attacker or untrusted caller controls the `--author` argument or interactive author input. 2. The attacker supplies a value such as `../../target-directory` or an absolute ...[truncated 1166 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/collect.py:1482
Finding

Insufficient URL Validation Allows Unrestricted Browser Navigation

Content
View full analysis
` anywhere in the URL. The complete URL is then passed to Playwright and opened using an existing Edge profile. This permits navigation to origins unrelated to Xueqiu, including potentially local or private-network destinations, as long as ...[truncated 1825 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/collect.py:430
Finding

Unrestricted Image Fetching Enables Server-Side Request Forgery and Resource Exhaustion

Content
View full analysis
100: results.append({**img_info, 'local_path': local_path, 'success': True}) continue try: req = urllib.request.Request(src, headers=headers) with urllib.request.urlopen(req, timeout=10) as resp: data = resp.read() if len(data) < 100: results.append({**img_info, 'local_path': None, 'success': False}) continue with open(local_path, 'wb') as f: f.write(data) results.append({**img_info, 'local_path': local_path, 'success': True}) except Exception as e: print(f" [图片下载失败] {alt[:20]}: {e}") results.append({**img_info, 'local_path': None, 'success': False}) ``` Image sources are extracted from page-controlled DOM content: ```python 'if (src.indexOf("http") !== 0) continue; ' 'r.push({alt: alt, src: src}); } return r; ...[truncated 2249 chars]
Remediation
View remediation
MAX_IMAGE_BYTES: raise ValueError("Image exceeds the maximum permitted size") chunks.append(chunk) data = b"".join(chunks) ``` ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/check_env.py:138
Finding

Unpinned Third-Party Package Resolution and Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

A second, more specific description-to-behavior mismatch indicates the skill may scan local toolchain/browser paths and install Python packages via --fix while claiming only to collect and analyze Xueqiu content. Hidden or undisclosed local system interaction materially increases risk because it can expose local environment details or modify the host without informed consent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

A second, more specific description-to-behavior mismatch indicates the skill may scan local toolchain/browser paths and install Python packages via --fix while claiming only to collect and analyze Xueqiu content. Hidden or undisclosed local system interaction materially increases risk because it can expose local environment details or modify the host without informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explicitly promotes bulk collection of arbitrary users' posts, full-text extraction, image download, OCR, and long-term local storage, but frames this mainly as convenience and analysis functionality rather than handling potentially sensitive personal or account-linked data. Even if the source content is publicly viewable, aggregating it at scale, enriching it with OCR, and persisting it in searchable local databases materially increases privacy risk and misuse potential.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README instructs users to run the scraper against an already logged-in Edge browser profile but does not clearly warn that automation against a live personal profile can expose session cookies, account data, private browsing state, and other user content accessible to that profile. In a scraping skill, this context makes the omission more dangerous because the tool is specifically designed to drive a real authenticated browser session to collect data at scale.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill declares broad operational behavior involving shell, network, file read/write, and environment access, but does not define any explicit tool scope or permission boundaries. In an agent setting, this weakens least-privilege controls and can allow the skill to invoke more capabilities than a user would reasonably expect, especially given it handles local browser profiles, databases, logs, and package installation guidance.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill description omits a clear user-facing warning that it performs large-scale collection, image downloading, OCR, and local persistence to SQLite/JSON/Markdown. Without prominent disclosure, users may not understand that the skill stores extracted content locally, potentially including sensitive text from images and authenticated browsing context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases and scenarios are broad enough to overlap with normal conversation, making accidental activation more likely. Because this skill is described as capable of crawling, downloading images, OCR processing, and writing local databases, a false trigger could cause unintended collection or local side effects without sufficiently explicit user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code file contains natural-language strings that force a specific language/locale for the user-facing interface, including the module docstring and usage examples. The policy allows locale constraints only when justified or when users are given a choice, neither of which is present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The argparse description, argument help text, and printed runtime/status output are all fixed to Chinese, which enforces a specific language for interaction. This is a natural-language locale policy issue because the script does not offer an alternative language or explicit user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring and all user-facing status/help text are written exclusively in Chinese, which imposes a specific language on all users. The file does not provide any opt-in, locale detection, or alternate language path that would satisfy a language-choice policy.

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

python
if not npx_path or not os.path.isfile(npx_path):
        return False, "文件不存在"
    try:
        result = subprocess.run(
            [npx_path, '--version'],
            capture_output=True, text=True, timeout=5
        )

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

python
if not npx_path or not os.path.isfile(npx_path):
        return False, "npx 不可用"
    try:
        result = subprocess.run(
            [npx_path, "playwright-cli", "--version"],
            capture_output=True, text=True, timeout=15
        )

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

python
if not tess:
        return False, None, "未找到"
    try:
        r = subprocess.run(
            ["tesseract", "--version"],
            capture_output=True, text=True, timeout=5
        )

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/check_env.py (reported line 318)May include surrounding context.

python
return False, (
        "Windows: choco install tesseract\n"
        "         或下载: https://github.com/UB-Mannheim/tesseract/wiki\n"
        "Linux:   sudo apt install tesseract-ocr tesseract-ocr-chi-sim"
    )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
84% confidence
Finding

In --fix mode, the script automatically installs packages with pip, which executes code from package distributions and modifies the local Python environment. Although the package names are hardcoded, this still creates a supply-chain and environment-integrity risk, especially in an agent skill context where automatic dependency installation may run without sufficient user scrutiny.

Content

Scanner excerpt · scripts/check_env.py (reported line 418)May include surrounding context.

python
for pkg in pip_fixable:
                print(f"\n  正在安装 {pkg} ...")
                try:
                    r = subprocess.run(
                        [sys.executable, "-m", "pip", "install", pkg],
                        capture_output=True, text=True, timeout=120
                    )

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

The script depends on npx/Playwright CLI without a pinned version, so execution behavior can change or become malicious if a package update, typosquatted dependency, or compromised registry artifact is pulled at runtime. Because this code is used to drive a logged-in browser session, a compromised tool could access session data, navigate to attacker-controlled pages, or exfiltrate scraped/private content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script automatically detects and reuses the user's logged-in Edge profile, inheriting cookies, authenticated sessions, browsing state, and possibly access to unrelated sites. In a scraping skill this is particularly sensitive because the automation can act with the user's real identity and privileges, and the file offers no explicit privacy warning or consent gate before doing so.

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

python
]
    for c in candidates:
        try:
            result = subprocess.run([c, '--version'], capture_output=True, timeout=5)
            if result.returncode == 0:
                return c if os.path.isabs(c) else shutil_which(c) or c
        except Exception:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
80% confidence
Finding

This helper executes arbitrary Playwright CLI subcommands assembled from args_list and is the central command runner for browser automation. While the current call sites appear internal, the function creates a broad execution primitive that trusts the resolved npx binary and a mutable CLI tool without version pinning, increasing supply-chain and unintended-command risk if the environment is compromised.

Content

Scanner excerpt · scripts/collect.py (reported line 278)May include surrounding context.

python
if attempt == 0 and not no_delay:
                time.sleep(random.uniform(MIN_DELAY, MAX_DELAY))

            result = subprocess.run(
                [npx, "playwright-cli", f"-s={session}"] + args_list,
                capture_output=True, text=True, encoding="utf-8",
                errors="replace", timeout=timeout

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

python
return

        print(f"  [尝试 {attempt+1}/3] 启动 Edge 浏览器...")
        subprocess.Popen(
            [npx, "playwright-cli", f"-s={session}", "open", target_url,
             "--browser=msedge", "--headed", f"--profile={edge_profile}"],
            creationflags=subprocess.CREATE_NEW_CONSOLE

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

python
except Exception:
        pass
    try:
        res = subprocess.run(
            ["tesseract", image_path, "-", "-l", "chi_sim+eng", "--psm", "3"],
            capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=30
        )

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This JSON file uses Chinese-only natural-language category names and metadata fields such as "_说明" and "_格式", with no indication that users can choose another language or that the skill is intentionally limited to a Chinese-speaking context. Under the policy, forcing a specific language without opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

All user-facing documentation, prompts, help text, and console output in this file are in Chinese, with no option to choose another language. Under the stated policy, forcing a specific language or locale without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.