Back to skill

Security audit

XHS Video Downloader

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Xiaohongshu video downloader, but its bundled script is under-scoped and can fetch arbitrary URLs and write to unsafe output paths.

Review before installing. Use only for videos you are allowed to download, avoid authenticated or private pages unless you have explicit permission, and do not run the bundled script against untrusted URLs or with user-supplied filenames until URL allowlisting and output-path sanitization are added.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/download_video.py:122
Finding

Unrestricted Page URL Fetching Enables Server-Side Request Forgery

Content
View full analysis
Optional[str]: try: response = requests.get(page_url, headers=HEADERS, timeout=30) response.raise_for_status() return response.text except requests.RequestException as e: print(f"Failed to fetch page: {e}") return None ``` The function is called directly with the user-supplied command-line argument: ```python html_content = fetch_page_content(args.url) ``` ### Technical Analysis The application performs an HTTP request to a user-controlled URL without validating: - The URL scheme - The destination hostname - The resolved IP address - The destination port - Redirect destinations - Whether the destination belongs to Xiaohongshu Although the Skill is intended to process Xiaohongshu pages, the implementation does not enforce this restriction. The `requests` library also follows redirects by default, so validating only an initial URL in a future partial fix would not be sufficient. An attacker can provide a URL targeting loopback addresses, private network ranges, link-local services, or cloud instance metadata endpoints. DNS rebinding or an attacker-controlled redirect can similarly route a superficially legitimate request to a prohibited destination. ### Attack Path 1. An attacker supplies a URL such as `http://127.0.0.1:PORT/internal`, a private-network service, or a URL that redirects to such a destination. 2. `args.url` is passed directly to `fetch_page_content()`. 3. `requests.get()` connects to the attacker-selected destination from the environment running the Skill. 4. The target response is read and processed as HTML. 5. Observable output, response differences, or subsequent media extraction can disclose service availability or cause further request ...[truncated 644 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/download_video.py:57
Finding

Unvalidated Extracted Media URL Enables Secondary SSRF and Arbitrary Content Retrieval

Content
View full analysis
]+\.mp4[^\s"<>]*' mp4_matches = re.findall(mp4_pattern, html_content) if mp4_matches: # Prefer xhscdn URLs for url in mp4_matches: if "xhscdn" in url: return url.split('"')[0].split("'")[0] return mp4_matches[0].split('"')[0].split("'")[0] ``` The selected URL is subsequently requested without destination validation: ```python response = requests.get(url, headers=HEADERS, stream=True, timeout=60) ``` ### Technical Analysis The extractor merely prefers URLs containing the substring `xhscdn`; it does not require an approved CDN hostname. If no such match exists, it returns the first arbitrary HTTP or HTTPS URL whose text contains `.mp4`. Substring matching is not a secure hostname check. For example, attacker-controlled hostnames can contain `xhscdn` without belonging to the legitimate CDN. The download request also follows redirects by default, and neither the final destination nor its resolved address is checked. Consequently, any attacker who controls the fetched page content can direct the downloader to another attacker-selected HTTP endpoint. The endpoint does not need to serve an actual video because the downloader does not validate the response content type. ### Attack Path 1. The attacker causes the Skill to fetch attacker-controlled or manipulated HTML. 2. The HTML contains a URL matching the broad MP4 regular expression, such as an internal URL with `.mp4` in its path or query. 3. `extract_video_url()` returns that URL because no strict CDN allowlist is enforced. 4. `download_video()` requests the selected destination from the Agent host. 5. The response body is saved locally as an MP4-named file regardless of its actual content. 6. Redirects can be ...[truncated 590 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/download_video.py:167
Finding

User-Controlled Filename Allows Path Traversal and Arbitrary File Overwrite

Content
View full analysis
Remediation
View remediation
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 (3)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill instructs use of browser automation, JavaScript extraction, curl, and a Python downloader to access external sites, but it declares no explicit tool scope or permissions. That mismatch creates an authorization and governance gap: an agent could invoke network-capable actions without clear restriction, review, or least-privilege boundaries.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill is designed to download third-party video content and even suggests bypassing access controls like JS rendering and header checks, yet it provides no warning about copyright, terms-of-service, privacy, or account-related implications. In context, this increases the chance of misuse for unauthorized copying of user content or downloading from authenticated pages without informed user consent or policy checks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file is explicitly framed as a downloader for Xiaohongshu and repeatedly uses the Chinese platform name, but it does not offer any user-selectable language/locale behavior or explain a justified regional constraint. Under the stated policy, natural-language instructions that force a specific locale without opt-in can be flagged even in code docstrings and CLI descriptions.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.