T09 · Insecure Skill Coding Practices
Error
- Location
- paper.sh:23
- Finding
- Unrestricted MCP Endpoint Allows Design Data Disclosure to Remote Servers<![CDATA[ ## Vulnerability Details **File Location**: `paper.sh:23, 35-39, 70-73, 123-127` **Vulnerability Type**: Unrestricted external endpoint configuration **Risk Level**: High ### Vulnerable Code ```bash PAPER_MCP_URL="${PAPER_MCP_URL:-http://127.0.0.1:29979/mcp}" ``` ```bash check_paper() { if ! curl -s --max-time 3 -o /dev/null -w "%{http_code}" "$PAPER_MCP_URL" -X POST \ -H "Content-Type: application/json" \ -H "Accept: $ACCEPT_HEADER" \ -d '{"jsonrpc":"2.0","method":"ping","id":0}' 2>/dev/null | grep -q "200\|400\|405"; then ``` ```bash response=$(curl -s -i -X POST "$PAPER_MCP_URL" \ -H "Content-Type: application/json" \ -H "Accept: $ACCEPT_HEADER" \ -d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"openclaw-paper-skill","version":"1.0.0"}},"id":1}' 2>&1) ``` ```bash response=$(curl -s -X POST "$PAPER_MCP_URL" \ -H "Content-Type: application/json" \ -H "Accept: $ACCEPT_HEADER" \ -H "Mcp-Session-Id: $session_id" \ -d "$payload" 2>&1) ``` ### Technical Analysis The skill is documented as a bridge to Paper's local MCP server, but `PAPER_MCP_URL` is accepted directly from the process environment without validating its scheme, hostname, port, or path. Every initialization request and subsequent MCP tool request is sent to that endpoint. An attacker who can influence the environment of the skill process can replace the loopback URL with a remote server. The transmitted payload can include MCP tool names, node identifiers, HTML content, text content, design metadata, or other arguments supplied during design operations. The MCP session identifier received from the configured server is also sent in later requests. Because the remote response is trusted as an MCP response, the issue additionally permits an attacker-controlled endpoint to supply arbitrary response content and image bytes to downstream response-processing functions. ### Attack Path 1 ...[truncated 1189 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Parse `PAPER_MCP_URL` and require the hostname to be exactly `127.0.0.1`, `::1`, or another explicitly approved local endpoint. 2. Restrict the URL scheme to plain HTTP over loopback unless authenticated TLS is deliberately supported. 3. Restrict the port and path to the expected Paper MCP endpoint. 4. Disable HTTP redirects with `curl --max-redirs 0` so a local endpoint cannot redirect requests externally. 5. Reject URLs containing user information, fragments, unexpected query parameters, or alternate address representations. 6. If endpoint customization is required, use a trusted configuration file with strict ownership and permissions rather than an unrestricted inherited environment variable. 7. Authenticate the local MCP server where the protocol supports it and validate response size and structure before processing. ]]>
