Back to skill

Security audit

xhs-comment-scraper

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a real Xiaohongshu comment-scraping workflow, but it asks for broad authenticated browser automation and persistent local storage without enough scoping, privacy, or report-safety controls.

Review this skill before installing. Use it only for profiles and comments you are authorized to collect, confirm the exact scraping scope before it starts, and assume the generated JSON/report files may contain personal or sensitive user-generated content. Avoid opening generated HTML reports from untrusted comments unless the report generator safely escapes all content, and delete stored outputs when no longer needed.

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/save_comments.py:33
Finding

Path Traversal Through Unsanitized Output Filename Components

Content
View full analysis
Remediation
View remediation
str: value = str(value or fallback) value = re.sub(r'[^A-Za-z0-9._-]+', '_', value) value = value.strip(' ._')[:80] return value or fallback base = output_dir.resolve() blogger_name = safe_component( data.get('blogger', {}).get('name'), 'unknown' ) note_id = safe_component( data.get('note', {}).get('id'), 'unknown' ) filename = f"xhs_comments_{blogger_name}_{note_id}_{timestamp}.json" filepath = (base / filename).resolve() if filepath.parent != base: raise ValueError("Unsafe output path") ``` 6. If overwriting is unnecessary, use exclusive creation mode (`'x'`) or a securely generated unique suffix to prevent accidental truncation. 7. Validate the complete input structure and accepted field types before processing it. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.en.md:246
Finding

Stored Script Injection Risk in Generated HTML Analysis Reports

Content
View full analysis
` dropdowns, keyword search with `data-content` attribute matching Chart generation order: PNG charts first → HTML with local image refs → `Start-Process` to open. ``` An equivalent unsafe report-generation design is also documented in `SKILL.md`, lines 268-271. ### Technical Analysis The skill directs the report generator to embed scraped data into an inline JavaScript variable and place original comment content in HTML `data-content` attributes. Comments and related metadata originate from external Xiaohongshu users and therefore constitute untrusted input. Ordinary JSON serialization alone is not sufficient when JSON is embedded inside an HTML `
Remediation
View remediation
`, `&`, U+2028, and U+2029. - Ensure every case-insensitive occurrence of a script-closing sequence cannot terminate the surrounding element. 6. Add a restrictive Content Security Policy, for example one that blocks inline scripts and disallows network connections unless explicitly required. 7. Avoid inline event handlers and dynamically evaluated code, including `eval`, `new Function`, and string arguments to timers. 8. Add regression tests containing hostile strings in every displayed field, including script terminators, quotes, angle brackets, ampersands, and malformed Unicode. 9. Update both `SKILL.en.md` and `SKILL.md` so the safe rendering requirements are mandatory and consistent. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

There is a clear description-behavior mismatch. The declared purpose promises an end-to-end crawler triggered by Xiaohongshu profile links, including automatic retrieval of all note comments and generation of analytical visual reports. The actual code chunk is only a local save utility: it accepts preexisting JSON input, creates an output directory, writes the JSON to disk, and prints metadata. While saving comment data is consistent with one small supporting part of the declared workflow, the primary advertised capabilities—link-triggered crawling, network retrieval, aggregation across notes, and report generation—are absent from this code.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README describes automatic activation when a chat message contains a Xiaohongshu profile URL, which is a broad trigger for a skill that performs browser automation, bulk scraping, and local file writes. This can cause unintended invocation from casual link sharing or quoted text, leading to unexpected data collection and execution of higher-risk capabilities.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README explicitly promotes scraping all notes' comments, saving per-note JSON files, and generating analysis reports, but it does not warn about privacy, terms-of-service, data retention, or the sensitivity of storing user-generated content locally. In context, the skill's browser and exec permissions make this more dangerous because it enables large-scale collection and persistence of third-party data without visible safeguards.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README explicitly states the skill will scrape all comments from a Xiaohongshu profile, save them as local JSON, and generate analysis reports, but it does not disclose privacy implications, data minimization expectations, retention, or consent boundaries. Because the data includes user-generated content and metadata such as nicknames, timestamps, and likes, silently collecting and storing it increases privacy, compliance, and misuse risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The instructions tell the user to log into Xiaohongshu through browser automation and complete CAPTCHA manually, but they do not warn about account/session exposure, automated interaction risk, or possible policy violations. This is dangerous because the skill may operate within an authenticated session and could access or persist data under the user's account context without adequate safeguards or informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill automates bulk scraping of comments from an entire Xiaohongshu profile and stores the collected data as local JSON, with optional HTML reporting, but the front-matter description does not clearly disclose this local persistence behavior. In an agent setting, insufficient disclosure can cause users to trigger collection and retention of third-party content without informed consent, increasing privacy, compliance, and data-handling risk.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Lines L067-L082 state that all querySelector/getElementById calls return nothing and that innerText is the only reliable extraction method. However, lines L088-L093 and later L164-L176 explicitly use querySelectorAll for reply buttons and note links, so the guidance contradicts the documented implementation approach.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The workflow at L164-L176 instructs using document.querySelectorAll to collect note links from the profile page. This directly conflicts with L069-L080, which claims all JS selector calls return nothing, creating an intent/documentation contradiction that could mislead operators about how the skill actually works.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill clearly instructs reading and writing local files (saving scraped comments and reports) but does not declare any tool scope such as allowed-tools or permissions. This creates an authorization gap: an agent may infer broader file access than intended, making local data handling less auditable and easier to misuse or overreach.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger condition uses vague language such as 'or similar blogger profile links,' which can cause unintended activation on unrelated URLs or ambiguous user input. In an automated scraping skill, overbroad triggering increases the risk of collecting data from the wrong target or launching browser automation without sufficiently clear user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill is designed to scrape and locally store large volumes of comment data, including usernames, raw comment text, timestamps, and engagement counts, but it omits privacy, retention, and lawful-use warnings. This is dangerous because it normalizes bulk collection of user-generated content without safeguards, increasing the chance of privacy violations, excessive retention, or downstream misuse of personal data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring specifies usage entirely in Chinese, which imposes a specific language on users without any opt-in or indication that the skill is intended only for a Chinese-language environment. This matches the policy category for language or locale constraints expressed in natural language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The printed status messages are natural-language strings shown to users and are only in Chinese. Because the skill does not offer a language selection or justify a locale-specific constraint, this is a language-policy issue under the applicable rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
68% confidence
Finding

All user-facing instructions in this file are written only in Chinese, with no indication that language selection is optional or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. This can violate language/locale policy when a specific language is imposed without opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

metadata.language: zh 以及全文中文指令共同表明该技能默认强制使用中文,但文档没有说明这是用户可选项,也没有明确声明该技能仅面向特定中文使用场景。按规则,强制特定语言而未提供选择或正当化说明,属于自然语言层面的语言/locale 策略问题。

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.