Back to skill

Security audit

Xiaohongshu Extract

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but its extractor accepts any URL and follows redirects, which can let it probe internal or local network targets instead of only Xiaohongshu pages.

Review before installing or running in an environment with access to localhost services, private networks, cloud metadata endpoints, or sensitive internal systems. Only run it on trusted public Xiaohongshu URLs, and prefer adding domain/IP/redirect validation plus output-path limits before broader use.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/xiaohongshu_extract.py:45
Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery## Vulnerability Details **File Location**: `scripts/xiaohongshu_extract.py`, lines 45–51 and line 281 **Vulnerability Type**: Server-Side Request Forgery (SSRF) caused by unrestricted user-controlled URL fetching **Risk Level**: High **Vulnerable code:** ```python def fetch_url(url: str, timeout: int) -> Tuple[str, str, int]: resp = requests.get( url, allow_redirects=True, timeout=timeout, headers={"User-Agent": DEFAULT_UA}, ) return resp.url, resp.text, resp.status_code ``` The function is invoked with the unvalidated command-line URL: ```python final_url, html, status_code = fetch_url(args.url, args.timeout) ``` ### Technical Analysis The extractor passes a user-provided URL directly to `requests.get()`. It does not: - Restrict the scheme to HTTPS. - Enforce an allowlist of official Xiaohongshu hostnames. - Resolve and reject loopback, private, link-local, reserved, multicast, or unspecified IP addresses. - Validate redirect destinations. - Limit the downloaded response size. In addition, `allow_redirects=True` permits an initially acceptable public URL to redirect the request to an internal destination. Therefore, validation of only the original URL would not be sufficient. An attacker can cause the host running the Skill to send HTTP requests to destinations reachable from that host, including localhost services, private-network systems, and cloud instance metadata endpoints. Although the application normally expects an XHS page containing `window.__INITIAL_STATE__`, HTTP status codes, redirect URLs, parsing outcomes, blocker hints, and timing differences can still act as a network-discovery oracle. If a targeted response contains content in the expected initial-state format, selected response data may also be returned in the generated JSON. ### Attack Path 1. An attacker supplies a URL such as a loopback, private-network, link-local, or attacke ...[truncated 1400 chars]
Remediation
## Remediation Suggestions 1. Accept only `https` URLs and reject URLs containing credentials, malformed authority components, or unsupported ports. 2. Normalize hostnames and enforce an exact allowlist of official Xiaohongshu domains. Avoid unsafe substring or suffix checks; permit either the exact approved hostname or a dot-delimited subdomain of an approved parent. 3. Resolve all destination addresses before connecting and reject loopback, private, link-local, reserved, multicast, and unspecified IPv4 and IPv6 ranges. 4. Disable automatic redirects. If redirects are required, follow them manually with a small redirect limit and repeat scheme, hostname, DNS, IP-range, and port validation for every destination. 5. Account for DNS rebinding by ensuring the validated address is the address used for the connection, or by applying equivalent network-layer egress controls. 6. Apply outbound firewall or proxy rules so the process cannot reach localhost, private networks, link-local ranges, or cloud metadata endpoints. 7. Stream responses with a strict maximum byte limit rather than loading an unbounded response into memory. 8. Use conservative connection and read timeouts, and avoid exposing unnecessary redirect or internal-network details in user-visible errors. 9. Add regression tests covering direct private addresses, IPv6 loopback, alternative IP representations, user-information URL confusion, DNS responses resolving to private addresses, and public-to-private redirects.
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Lp3

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding
The skill documentation instructs running a bundled Python script against a user-provided URL and supports writing results to arbitrary output paths, which indicates network access and file-write capability. Because the skill omits any explicit permission or allowed-tools declaration, consumers cannot enforce least-privilege boundaries or clearly understand the operational risk, making misuse or unexpected data access more likely.

Static analysis

No suspicious patterns detected.