Back to skill

Security audit

RedNote Publish Auto

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent Xiaohongshu publishing purpose, but it handles full account cookies and optional API publishing in ways that could expose or misuse a user's account credential.

Review this carefully before installing. Use a dedicated Xiaohongshu account, avoid placing real session cookies in shared project directories, do not use API mode with any remote or untrusted --api-url, and treat any cookie used with this skill as exposed if it was sent to a service you do not control. Only render Markdown from trusted sources until HTML sanitization and network restrictions are added.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/render_xhs.py:109
Finding

Unsanitized Markdown and metadata can execute active content in Playwright

Content
View full analysis
str: """Convert Markdown to HTML.""" # Process tags beginning with # tags_pattern = r'((?:#[\w\u4e00-\u9fa5]+\s*)+)$' tags_match = re.search(tags_pattern, md_content, re.MULTILINE) tags_html = "" if tags_match: tags_str = tags_match.group(1) md_content = md_content[:tags_match.start()].strip() tags = re.findall(r'#([\w\u4e00-\u9fa5]+)', tags_str) if tags: tags_html = '
' for tag in tags: tags_html += f'#{tag}' tags_html += '
' html = markdown.markdown( md_content, extensions=['extra', 'codehilite', 'tables', 'nl2br'] ) return html + tags_html ``` The generated cover metadata and converted Markdown are interpolated directly into the document: ```python
{emoji}
{title}
{subtitle}
``` ```python html_content = convert_markdown_to_html(content) ``` The resulting document is then opened by Playwright: ```python with tempfile.NamedTemporaryFile( mode='w', suffix='.html', delete=False, encoding='utf-8' ) as f: f.write(html_content) temp_html_path = f.name try: await page.goto(f'file://{temp_html_path}') await page.wait_for_load_state('networkidle') ``` The JavaScript implementation has the same unsafe conversion and rendering flow: ```javascript function generateCardHtml(content, th ...[truncated 3473 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/publish_xhs.py:205
Finding

Arbitrary API endpoint can receive the complete Xiaohongshu authentication cookie

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Security-sensitive third-party dependencies are not reproducibly pinned

Content
View full analysis
=3.4.0 PyYAML>=6.0 # Browser automation for image rendering playwright>=1.40.0 # Xiaohongshu publishing xhs>=0.4.0 # Environment variable management python-dotenv>=1.0.0 # HTTP requests for API mode requests>=2.28.0 ``` The documentation also recommends installing unversioned packages: ```bash pip install markdown PyYAML playwright xhs python-dotenv requests playwright install chromium ``` ### Technical Analysis Every dependency is resolved to an unspecified version at installation time. Future releases that satisfy the lower-bound constraints may be selected without having been reviewed with this project. The documented installation command is even less restrictive and retrieves the latest available versions. This is particularly sensitive for `xhs`, which executes in the same Python process that receives the complete Xiaohongshu authentication cookie and image paths. Playwright also installs and launches a browser binary, making version integrity and compatibility important. The audit did not establish that any listed package is currently malicious. The confirmed issue is the absence of reproducible dependency controls, which makes the effective installed code mutable after the Skill itself has been reviewed. ### Attack Path 1. A user follows the documented installation instructions or installs from `requirements.txt`. 2. The package manager resolves the latest versions satisfying the lower-bound constraints. 3. A compromised, malicious, or incompatible future package release is selected. 4. Package installation or import execute ...[truncated 1096 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (43)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

By claiming one-click Xiaohongshu creation and publication while the documented behavior centers on transforming content and performing authenticated posting, the skill obscures the difference between passive formatting and active account operations. In this context, hidden or overstated capabilities are risky because the action target is a real social-media account and misuse can directly publish unwanted content.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

By claiming one-click Xiaohongshu creation and publication while the documented behavior centers on transforming content and performing authenticated posting, the skill obscures the difference between passive formatting and active account operations. In this context, hidden or overstated capabilities are risky because the action target is a real social-media account and misuse can directly publish unwanted content.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

By claiming one-click Xiaohongshu creation and publication while the documented behavior centers on transforming content and performing authenticated posting, the skill obscures the difference between passive formatting and active account operations. In this context, hidden or overstated capabilities are risky because the action target is a real social-media account and misuse can directly publish unwanted content.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

The documentation instructs users to place a sensitive Xiaohongshu cookie in a .env file, which is local credential handling for a full session secret. Although environment files are common, using them for browser session cookies in a content-publishing skill increases the chance of accidental disclosure through source control, backups, logs, or multi-user systems.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 14)May include surrounding context.

python
python publish_xhs.py --title "标题" --desc "描述" --images cover.png card_1.png --api-mode

环境变量:
    在同目录或项目根目录下创建 .env 文件,配置:
    
    # 必需:小红书 Cookie
    XHS_COOKIE=your_cookie_string_here

Credential Access

High
Category
Privilege Escalation
Confidence
78% confidence
Finding

The function is designed to load a sensitive session cookie from a .env file, which confirms the skill accesses account credentials. Credential access is expected for publishing on behalf of a user, so this is not inherently malicious, but in combination with full-cookie use it contributes to risky secret handling.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 44)May include surrounding context.

python
def load_cookie() -> str:
    """从 .env 文件加载 Cookie"""
    # 尝试从多个位置加载 .env
    env_paths = [
        Path.cwd() / '.env',

Credential Access

High
Category
Privilege Escalation
Confidence
72% confidence
Finding

Searching the current working directory for a .env file broadens where credentials may be sourced from, increasing the risk of accidentally loading the wrong secret in shared or untrusted directories. While not severe on its own, it weakens secret provenance and can surprise operators.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 45)May include surrounding context.

python
def load_cookie() -> str:
    """从 .env 文件加载 Cookie"""
    # 尝试从多个位置加载 .env
    env_paths = [
        Path.cwd() / '.env',
        Path(__file__).parent.parent / '.env',

Credential Access

High
Category
Privilege Escalation
Confidence
72% confidence
Finding

Loading credentials from parent directories expands the trust boundary and can cause the script to ingest unintended secrets from unrelated project locations. This makes credential handling less predictable and raises the risk of accidental misuse of another account's cookie.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 47)May include surrounding context.

python
"""从 .env 文件加载 Cookie"""
    # 尝试从多个位置加载 .env
    env_paths = [
        Path.cwd() / '.env',
        Path(__file__).parent.parent / '.env',
        Path(__file__).parent.parent.parent / '.env',
    ]

Credential Access

High
Category
Privilege Escalation
Confidence
72% confidence
Finding

Extending secret discovery to even higher-level parent directories further increases the chance of loading an unintended .env containing unrelated credentials. In a skill that can publish content on behalf of a user, mistaken credential selection could lead to unauthorized posting to the wrong account.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 48)May include surrounding context.

python
# 尝试从多个位置加载 .env
    env_paths = [
        Path.cwd() / '.env',
        Path(__file__).parent.parent / '.env',
        Path(__file__).parent.parent.parent / '.env',
    ]

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 49)May include surrounding context.

python
env_paths = [
        Path.cwd() / '.env',
        Path(__file__).parent.parent / '.env',
        Path(__file__).parent.parent.parent / '.env',
    ]
    
    for env_path in env_paths:

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The script requires the XHS_COOKIE environment variable and instructs the user to provide a full session cookie, which is effectively an account credential. In the context of an automated publishing skill, this creates a significant account-compromise risk if the secret is mishandled, especially since the same cookie may later be transmitted to an API service.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 60)May include surrounding context.

python
cookie = os.getenv('XHS_COOKIE')
    if not cookie:
        print("❌ 错误: 未找到 XHS_COOKIE 环境变量")
        print("请创建 .env 文件,添加以下内容:")
        print("XHS_COOKIE=your_cookie_string_here")
        print("\nCookie 获取方式:")
        print("1. 在浏览器中登录小红书(https://www.xiaohongshu.com)")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs access to a local cookie file and execution of a publishing command that uses networked account actions, but it declares no tool scope or permissions. That mismatch can cause an agent runtime or reviewer to underestimate the skill's access to secrets, filesystem data, and external services, increasing the risk of unintended credential use or unauthorized posting.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger phrases are broad enough to match ordinary requests like 'write a Xiaohongshu post' or 'generate a Xiaohongshu note,' yet this skill ultimately includes an authenticated publishing step. In an agent environment, that collision can route benign content-generation requests into a workflow that reads cookies and prepares account actions, creating a real risk of unintended posting if confirmation logic is bypassed or misunderstood.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file’s title, subtitle, body text, hashtags, and usage framing are entirely in Chinese and present the skill as a general-purpose creation aid, with no indication that language selection is optional. Under the policy, locale-specific behavior should either be opt-in or clearly documented as region-specific and justified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script explicitly instructs operators to extract and provide their full browser cookie for Xiaohongshu, which is a highly sensitive session credential. In this publishing-skill context, asking for the complete cookie string exceeds least-privilege needs and normalizes unsafe credential handling that can enable account takeover if the cookie is exposed or reused.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

This outbound request sends sensitive initialization data, including the full cookie, to the API endpoint. In the context of a publishing skill, external transmission of session credentials is especially dangerous because the cookie effectively authenticates as the user and can be reused by the receiving service or an interceptor.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 227)May include surrounding context.

python
# 初始化 session
        try:
            resp = requests.post(
                f"{self.api_url}/init",
                json={
                    "session_id": self.session_id,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

In API mode, the script transmits the full Xiaohongshu cookie to the configured API service during session initialization. This creates a direct credential disclosure path to another service without any explicit consent prompt, trust validation, or transport-security enforcement, so compromise or misconfiguration of that API can lead to account takeover.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 254)May include surrounding context.

python
def get_user_info(self) -> Optional[Dict[str, Any]]:
        """获取当前登录用户信息"""
        try:
            resp = requests.post(
                f"{self.api_url}/user/info",
                json={"session_id": self.session_id},
                timeout=10

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/publish_xhs.py (reported line 289)May include surrounding context.

python
if post_time:
                payload["post_time"] = post_time
            
            resp = requests.post(
                f"{self.api_url}/publish/image",
                json=payload,
                timeout=120

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The generated cover HTML hard-codes lang="zh-CN", which imposes a specific locale on all rendered output. The file does not offer a user opt-in or locale selection, and no region-specific justification is documented in the script comments or CLI help.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The generated card HTML also hard-codes lang="zh-CN", creating the same locale-policy issue for all non-cover pages. This is a natural-language policy concern because the skill silently enforces one language/locale instead of allowing user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document declares lang="zh-CN", which hard-codes a specific language/locale. Under the policy, forcing a specific language or locale without user opt-in or a clearly documented regional justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document declares lang="zh-CN", which hard-codes a specific language/locale. Under the policy, forcing a locale without user opt-in or an explicit documented justification 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
92% confidence
Finding

This CSS file contains Chinese-language comments and explicitly prioritizes Chinese fonts, which indicates a locale-specific presentation choice. Because SQP-3 applies to all file types and there is no visible opt-in or documentation justifying a China-specific locale restriction, this may violate language/locale policy expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This CSS file contains natural-language comments indicating the theme is specifically adapted for '小红书卡片渲染', and the descriptive comments are written in Chinese without any indication that localization is optional. Under the policy, forcing a specific language or locale without user choice or a clearly documented regional justification can be a violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.