Back to skill

Security audit

Xiaohongshu Ops

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly aligned with Xiaohongshu automation, but it can publish through a persistent logged-in browser and one one-shot workflow bypasses its own review-before-publish setting.

Install only if you are comfortable with a skill that stores a reusable Xiaohongshu browser session and can publish to a real account. Prefer manual-review flows, avoid running scripts/run_ops_once.js until review enforcement is fixed, and inspect or remove the pkill behavior before using it on a workstation with other active browser or automation sessions.

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

Error
Location
scripts/run_ops_once.js:49
Finding

Configured Review Requirement Is Bypassed by the One-Shot Publishing Workflow

Content
View full analysis

Vulnerability Details

File Location: scripts/run_ops_once.js:5-6, 49-54; final publication occurs in scripts/xhs_independent_publish.js:83-84
Vulnerability Type: Missing authorization and confirmation enforcement
Risk Level: High

Vulnerable Code

scripts/run_ops_once.js reads the profile but does not enforce its reviewBeforePublish preference:

js
const profilePath = path.join(process.cwd(), 'data/xiaohongshu/profile.json');
const profile = JSON.parse(fs.readFileSync(profilePath, 'utf8'));

It then unconditionally invokes the direct-publishing script:

js
const publish = spawnSync('node', [
  path.join(opsScriptDir, 'xhs_independent_publish.js'),
  '--asset-dir', path.join(outDir, 'png'),
  '--title', shortenTitle(post.title, 20),
  '--body', post.body
], { stdio: 'inherit' });

The invoked script clicks the final publication control:

js
await page.waitForSelector(selector, { timeout: 20000 });
await page.click(selector);

Technical Analysis

The profile is intended to control whether human review is required before publication. Although run_ops_once.js loads that profile, it never evaluates profile.reviewBeforePublish. Instead, it always invokes xhs_independent_publish.js, which uploads the assets, fills the post, and clicks the final publish button.

This is an authorization-state enforcement flaw: a security-relevant preference is stored but not checked at the point where the irreversible external action occurs. It also contradicts the declared rule in SKILL.md that execution must stop for review when the profile requires review.

The repository contains a safer review-only implementation in scripts/xhs_publish.js, which fills the draft and stops without clicking the publication button. The one-shot workflow does not select that safer path based on the profile.

Attack Path

  1. The operating profile is configured with `reviewBeforePubl ...[truncated 1090 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce profile.reviewBeforePublish before invoking any publisher:
    js
    if (profile.reviewBeforePublish) {
      console.log('READY_FOR_REVIEW');
      console.log(`Draft assets: ${outDir}`);
      process.exit(0);
    }
    
  2. When review is required, use the review-only workflow in scripts/xhs_publish.js or stop after asset generation.
  3. Require an explicit, non-default --confirm-publish flag immediately before the final click.
  4. Add the same confirmation check inside xhs_independent_publish.js so direct invocation cannot bypass the policy.
  5. Keep preparation and publication as separate commands. The preparation command should never perform the irreversible action.
  6. Add automated tests covering both reviewBeforePublish: true and false.
  7. Fail closed if the profile field is absent, malformed, or cannot be read.
  8. Log the selected publication mode without exposing authenticated browser data.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/xhs_independent_publish.js:45
Finding

Broad Process-Matching Termination Can Kill Unrelated Local Processes

Content
View full analysis

Vulnerability Details

File Location: scripts/xhs_independent_publish.js:45-46
Vulnerability Type: Unsafe process termination through broad command-line matching
Risk Level: Medium

Vulnerable Code

js
// Ensure prior independent browser instance does not hold the profile lock.
spawnSync('pkill', ['-f', 'xhs-independent-user-data'], { stdio: 'ignore' });

Technical Analysis

pkill -f matches against complete process command lines rather than a verified process identifier. The script terminates every process whose command line contains xhs-independent-user-data, without confirming:

  • that the process was created by this Skill;
  • that it is a Chrome or Playwright process;
  • that it is using the exact intended profile directory;
  • that it belongs to the current publishing run; or
  • that terminating it is safe.

Argument-array invocation prevents shell metacharacter injection, so this is not a shell-command injection issue. The weakness is the breadth and ambiguity of the process selection criterion.

A process can be killed merely because its command line contains the matching text. This can affect unrelated browser sessions, diagnostic commands, or other local automation.

Attack Path

  1. An unrelated process is launched with xhs-independent-user-data somewhere in its command line.
  2. The publishing workflow starts scripts/xhs_independent_publish.js.
  3. The script executes pkill -f xhs-independent-user-data.
  4. The operating system finds every process with that text in its command line.
  5. All matching processes that the current user is permitted to signal are terminated.
  6. Unsaved work or unrelated automation in those processes may be lost.

Impact Assessment

The command runs with the privileges of the user executing the Skill. It does not independently escalate privileges, and it generally cannot terminate processes owned by other users without additional perm ...[truncated 315 chars]

Remediation
View remediation

Remediation Suggestions

  1. Record the exact PID of browser processes created by this Skill and terminate only those PIDs.
  2. Before signaling a PID, validate process ownership, executable identity, start time, and exact profile path.
  3. Prefer Playwright lifecycle controls such as retaining and closing the relevant BrowserContext.
  4. Detect profile-lock files and report a clear error instead of automatically killing broadly matched processes.
  5. If automatic cleanup remains necessary, enumerate candidate processes and require an exact executable-and-argument match.
  6. Attempt graceful termination first and use forced termination only after a bounded timeout.
  7. Remove stale PID records safely by verifying that the PID still refers to the originally recorded process.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (27)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description promises a broad end-to-end Xiaohongshu operations skill, including style setting, saving an operating profile, generating posts in that persistent style, choosing/generating images, and publishing through an independent browser flow. The supplied code chunk does something narrower: it builds a hardcoded Xiaohongshu post draft, writes JSON output files, and calls a generator script for PNG card assets. That is related to post generation, but it does not substantiate several core declared capabilities, especially persistent style/profile management and publishing/browser automation. Because the declared primary purpose is significantly broader than the actual behavior shown, this is a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description promises an end-to-end Xiaohongshu operations capability, including style setup, profile persistence, post generation, image choice/generation, and publishing. The supplied code only creates a stock image search plan: it derives search queries from a topic, writes a JSON manifest to disk, and logs the output path. While image selection planning is loosely adjacent to one part of the declared description, the code lacks nearly all core advertised behaviors and has a materially narrower primary purpose. Therefore the description does not accurately represent this code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description promises a full Xiaohongshu operations workflow: configuring a content style, persisting an operating profile, generating posts in that style, choosing/generating suitable images, and publishing through a dedicated browser flow. The supplied code does something much narrower: it generates branded card images from input JSON, outputs SVG files, and screenshots them to PNG via Playwright. While the output is relevant to Xiaohongshu content creation, it does not implement the major declared capabilities such as style/profile management, post generation, image selection/generation, or publishing. Therefore the description materially overstates the code’s actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a broad end-to-end Xiaohongshu operations capability, including style management, content generation, image selection/generation, and publishing. The supplied code only initializes a persistent browser context and navigates to the Xiaohongshu creator publishing page. While this partially aligns with the 'independent browser flow' aspect, it does not implement most of the declared functionality and does not perform publishing itself. Therefore the description materially overstates what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The declared description presents a broad Xiaohongshu operations skill covering style management, persistent operating profile storage, post generation in a consistent house style, image choosing/generation, and publishing. The supplied code does not implement those higher-level capabilities. It only automates a browser to reach the Xiaohongshu image-post publishing page, waits for an existing login session, uploads local image assets, fills in a title and body, and then asks the user to review and publish manually. This is materially narrower than the declared purpose, especially around style/profile management, content generation, and image generation/selection. The browser-based publishing setup is consistent with part of the description, but the overall description overstates what the code actually does.

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

md
- `scripts/generate_xhs_cards.js`

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The workflow allows publishing through an automated browser flow without an explicit warning that this performs real external posting on the user's Xiaohongshu account. In this skill's context, that is especially dangerous because publication is an account-impacting action with reputational, compliance, and platform-policy consequences, and users may not realize that a generated post could be actually submitted rather than merely drafted.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill is triggered by very broad natural-language phrases such as '帮我运营小红书', which can cause accidental activation on ordinary conversational requests. In the context of a skill that can save local profiles and drive publishing workflows, over-broad invocation increases the chance of unintended persistence or account-affecting actions without the user explicitly opting into this specialized automation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The workflow instructs the agent to read and save data/xiaohongshu/profile.json and later publish through an independent browser flow, but it does not require a clear warning or consent for data persistence and account-impacting actions. In this skill context, silent profile storage and browser-based publishing can affect a real user account and retain potentially sensitive operational preferences, making missing disclosure materially risky.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
83% confidence
Finding

The skill explicitly supports automatic daily learning and writing outputs into local reference files, creating ongoing session persistence beyond the immediate user interaction. Persistent background accumulation of trend/style data can store sensitive business preferences or behavioral history without an explicit retention policy, user visibility, or consent boundary, which is especially concerning in a marketing/account-operations skill.

Content

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

md
Support automatic daily learning in reference mode.
If `autoLearning.enabled` is true in the profile, treat trend/style learning as a daily background reference task.
Write learning outputs into local reference files instead of silently mutating the main profile.

## Publish path

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The subtitle describes the skill as '全自动运营小红书' and line L030-L049 frame the workflow around Chinese-language Xiaohongshu content creation, including mixed Chinese-English title rewriting. Because this natural-language guidance specifies a language/locale expectation without mentioning user choice or opt-in, it can violate language/locale policy requirements.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The template switches entirely to Chinese and instructs output specifically for Xiaohongshu content without offering any language or locale choice. This can violate language/locale policy when users have not explicitly opted into Chinese-only output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file's template headings and content are entirely written in Chinese and present prescriptive content structures, but there is no indication that use of Chinese is optional or limited to a justified region-specific context. Under the policy, skills should not force a specific language or locale without user opt-in or clear documentation of the constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This JSON manifest contains multiple fixed Chinese-language values and instructions, such as the primary goal and notes, with no indication that language selection is optional or configurable. That creates a natural-language locale policy concern because the skill appears to force a specific language context without documented user opt-in or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented publish flow explicitly automates the final posting action by clicking the verified publish button, but it does not require a fresh user confirmation immediately before the irreversible external side effect. In a social-media publishing skill, that omission is dangerous because generated or stale content could be posted to a real account unintentionally, causing reputational, compliance, or account-level harm.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Lines L05-L11 require the interaction to proceed in Chinese, but the file does not indicate that the user can choose another language or that Chinese is required for a justified region-specific reason. This is a natural-language policy concern because it forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The workflow directs the agent to save user configuration to data/xiaohongshu/profile.json but does not require any user-facing notice or consent about local persistence. This is risky because style preferences, operating strategy, and related profile settings may constitute sensitive or business-relevant data, and silent storage can violate user expectations and create privacy or retention issues.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The activation phrases are broad enough that the skill may trigger on common requests like '帮我运营小红书' or '发一篇小红书' without clearly distinguishing between drafting assistance and actions that may lead toward account-affecting automation. In this skill's context, overbroad activation is more dangerous because the workflow includes reading saved profile data and potentially proceeding toward automated publishing, increasing the chance of unintended invocation of higher-risk behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The defaults and generated post content are entirely in Chinese, including the title, body, and hashtags, with no option or prompt to choose another language. This is a natural-language locale policy issue because the skill imposes a specific language by default rather than offering user choice or documenting a justified regional constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code creates an output directory and invokes two child Node.js processes that generate and publish content, but the file contains no confirmation prompt, warning comment, or user-facing disclosure about these operations. Because it performs side-effecting actions beyond simple computation, users reading or invoking the script are not warned in-file that it will write files and execute publishing steps.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script launches a persistent Playwright browser context using a fixed on-disk profile path under the user's home directory, which causes cookies, session tokens, browsing history, and other sensitive browser state to be retained across runs without any visible consent or warning. In the context of a publishing workflow for Xiaohongshu, this increases the chance of silent account reuse, leakage of authenticated state to later runs, and unintended access to a user's creator account if the local environment is shared or the data directory is later accessed by other components.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script unconditionally invokes pkill -f xhs-independent-user-data to terminate any matching process on the host before launching Playwright. This grants the skill host-level process-control behavior unrelated to the core business action of publishing content, and can kill other legitimate sessions or unrelated processes whose command lines match the pattern, causing denial of service or data loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The process termination is forceful and silent: the script kills matching processes without any user-facing warning, consent, or recovery path. In a publishing automation skill, this is more dangerous because it runs on a user workstation and may disrupt active browser work, destroy unsaved state, or interfere with concurrent automation using the same profile.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This JSON content hardcodes Chinese-language titles, subtitles, bullets, and footer text throughout the file. Under the natural-language policy rule, forcing a specific language without user opt-in can be a locale-policy violation when no choice or justification is provided.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/build_xhs_post.js:92

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/run_ops_once.js:39

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/xhs_independent_publish.js:46