xiaohongshu-mcp
- Type
- MCP server
- Scanned
- Nov 12, 2026
- Version
- bb6fa2e20871
- Files read
- 139
This project provides an HTTP MCP server, REST API, and optional agent skill that automate a browser to browse feeds, manage interactions, and publish image or video posts on a user's Xiaohongshu account. Because the server listens on all network interfaces without authentication by default and exposes its REST API to cross-origin browser requests, anyone on the same local network or a malicious website the user visits can control their Xiaohongshu account and upload local media files from their computer.
What it can reach
- Browser
- Automates a downloaded Chromium browser (Go server) or local Google Chrome via DevTools Protocol (post-to-xhs skill) to log in, read feeds and notifications, like, favorite, comment, reply, and publish posts on Xiaohongshu.
- Secrets
- Reads, writes, and deletes Xiaohongshu session cookies in cookies.json (or COOKIES_PATH, with a fallback to the system temp directory) and stores logged-in Chrome user profiles on disk.
- Files
- Uploads local image and video files specified in tool or API calls to Xiaohongshu, caches the downloaded browser binary in the user cache directory, and writes downloaded images to temporary directories.
- Network
- Listens on TCP port 18060 across all interfaces by default, connects to xiaohongshu.com and creator.xiaohongshu.com (optionally through XHS_PROXY), downloads a custom Chromium build from cdn.one-world.ai, and fetches HTTP/HTTPS image URLs.
- Shell commands
- Runs hdiutil, cp, and xattr on macOS to mount and unpack the browser disk image on first run, and runs chrome.exe, netstat, and taskkill in the Windows skill scripts.
Findings
-
HighHTTP server listens on all network interfaces without authentication by default
By default, the -port flag is set to :18060 (binding to 0.0.0.0 and :: across all network interfaces, mirrored by 18060:18060 in docker/docker-compose.yml) while authentication is disabled unless -token or AUTH_TOKEN is set. Anyone on the same Wi-Fi or local network can call both /mcp and /api/v1/* without credentials to read the user's notifications and profile, post comments or notes as the user, delete login cookies, or upload local image and video files from the host machine to Xiaohongshu.
Fix: Bind to 127.0.0.1:18060 by default (both in main.go and docker/docker-compose.yml) and require a non-empty AUTH_TOKEN whenever listening on a non-loopback address.
-
HighREST API allows cross-origin browser requests with wildcard CORS and no CSRF protection
While routes.go wraps /mcp in http.NewCrossOriginProtection(), all /api/v1/* endpoints omit CrossOriginProtection and run behind corsMiddleware(), which sets Access-Control-Allow-Origin: * and answers OPTIONS preflight requests with 204 No Content. When AUTH_TOKEN is unset (the default, even if bound to 127.0.0.1), any website the user visits in a browser that can reach localhost can send cross-origin requests to /api/v1/* and read the responses, allowing drive-by reading of notifications, posting or commenting on Xiaohongshu, deleting session cookies, or uploading local media files.
Fix: Wrap /api/v1/* with http.NewCrossOriginProtection() in routes.go and remove wildcard Access-Control-Allow-Origin: * from corsMiddleware().
-
HighUnescaped HTML injection into Xiaohongshu Creator Center via innerHTML in post-to-xhs skill
skills/post-to-xhs/scripts/cdp_publish.py:411
The post-to-xhs skill workflow instructs the agent to fetch external web pages from user-supplied URLs and pass the extracted text to cdp_publish.py. In _fill_content(), each paragraph is concatenated raw into <p> tags without HTML escaping and assigned to el.innerHTML inside the logged-in https://creator.xiaohongshu.com/publish/publish page (and publish_long_article similarly interpolates image_paths into a single-quoted JS string without escaping). If untrusted page content contains HTML event handlers such as <img src=x onerror=...>, arbitrary JavaScript executes immediately inside the authenticated Xiaohongshu Creator Center origin before the user confirms publishing.
Fix: Create paragraph elements with document.createElement('p') and assign text via p.textContent = paragraphs[i] instead of concatenating into innerHTML, and serialize image paths with json.dumps().
-
MediumFirst-run browser binary downloaded from third-party CDN without pinned checksum
browser/browser_download.go:25
On first startup, EnsureBrowser() downloads and executes a custom ~150MB Chromium build from https://cdn.one-world.ai/browsers/<version>/. Although verifySHA256() checks a SHA-256 digest, fetchExpectedSHA() fetches SHA256SUMS dynamically from the exact same CDN directory rather than verifying against a hash pinned in the repository, extractDmg() strips com.apple.quarantine on macOS (bypassing Gatekeeper), and extractTarXz()/extractZip() do not validate archive paths against directory traversal. If cdn.one-world.ai is compromised, an attacker can serve a malicious binary with a matching SHA256SUMS and gain code execution even on pinned release versions.
Fix: Embed expected per-platform SHA-256 digests in the source repository alongside browser_version.txt, validate that extracted archive paths stay within cacheDir, and avoid stripping macOS quarantine attributes on unsigned binaries.
-
MediumServer-side request forgery and unbounded memory read when downloading image URLs
When publish_content (MCP) or POST /api/v1/publish fetches HTTP/HTTPS URLs from the images parameter, DownloadImage() only checks for an http/https scheme and non-empty host without blocking loopback (127.0.0.1, ::1), cloud metadata (169.254.169.254), or private network IPs (including redirects), and reads the entire response body into memory with io.ReadAll(). Prompt injection in Xiaohongshu posts or comments read by the agent can trick it into calling publish_content with internal URLs to probe internal services, exfiltrate internal image endpoints to Xiaohongshu, or trigger out-of-memory crashes via oversized responses.
Fix: Use a custom net.Dialer Control hook and CheckRedirect policy to block loopback, link-local, multicast, and private IP ranges on every connection, and cap response reads with io.LimitReader.
-
MediumSession cookies saved with world-readable 0644 permissions and /tmp/cookies.json fallback
localCookie.write() writes Xiaohongshu session cookies (including web_session and galaxy_creator_session_id) with file mode 0644 instead of 0600, and GetCookiesFilePath() falls back to /tmp/cookies.json when COOKIES_PATH is unset and ./cookies.json does not yet exist. On multi-user systems, other local users or unprivileged local processes can read cookies.json to hijack the Xiaohongshu account, or pre-create /tmp/cookies.json before first login to fixate or capture the session.
Fix: Write cookie files with 0600 permissions (and directories with 0700), and remove the shared /tmp/cookies.json fallback in favor of a user-owned config directory.
-
LowSkill scripts leave Chrome remote debugging port 9222 open after execution
skills/post-to-xhs/scripts/chrome_launcher.py:113
When publish_pipeline.py or cdp_publish.py runs, launch_chrome() starts Chrome with --remote-debugging-port=9222 and leaves the browser process running in the background after the script disconnects. Any local process or other user on the same machine can connect to 127.0.0.1:9222 to control the logged-in Xiaohongshu browser profile or read local files via CDP.
Fix: Use --remote-debugging-pipe instead of a TCP port, or shut down the dedicated Chrome instance when the publishing workflow completes.
-
LowSkill configuration and instructions hardcode C:\Users\admin paths
skills/post-to-xhs/config/accounts.json:6
The checked-in accounts.json file hardcodes Chrome profile storage to C:\Users\admin\AppData\Local\Google\Chrome\XiaohongshuProfiles\default, and SKILL.md instructs the agent to execute Python scripts under C:\Users\admin\AI\.claude\skills\post-to-xhs\scripts\. On shared Windows machines where another account is named admin, following the skill stores sensitive Chrome session cookies in or executes scripts from that other user's directory.
Fix: Remove the hardcoded profile_dir from accounts.json so account_manager.py resolves paths dynamically from the current user's environment, and use relative paths in SKILL.md.
