T09 · Insecure Skill Coding Practices
Warning
- Location
- references/exa-mcp-setup.md:15
- Finding
- API Key Exposed Through MCP Endpoint Query String<![CDATA[ ## Vulnerability Details **File Location**: `references/exa-mcp-setup.md`, lines 15 and 27 **Vulnerability Type**: API key exposure through a URL query parameter **Risk Level**: Medium ### Vulnerable Code Line 15: ```text `https://mcp.exa.ai/mcp?exaApiKey=${MAVERICK_EXA_API_KEY}&tools=web_search_exa,web_search_advanced_exa,people_search_exa` ``` Lines 21–29, including the second occurrence at line 27: ```json { "mcpServers": { "exa": { "transport": { "type": "streamable-http", "url": "https://mcp.exa.ai/mcp?exaApiKey=${MAVERICK_EXA_API_KEY}&tools=web_search_exa,web_search_advanced_exa,people_search_exa" } } } } ``` ### Technical Analysis The documented MCP configuration places `MAVERICK_EXA_API_KEY` in the endpoint URL as the `exaApiKey` query parameter. Although the file does not contain a hardcoded secret, an MCP client that expands the environment-variable placeholder will construct a URL containing the plaintext API key. URLs are frequently captured by client diagnostics, proxy and gateway logs, telemetry systems, exception reports, configuration snapshots, browser or request history, and support bundles. HTTPS protects the URL while it is transmitted over the network, but it does not prevent endpoint software or authorized intermediaries from recording the complete URL. Exploitation requires an attacker to gain access to a location where the expanded URL has been recorded. The issue does not itself grant local system privileges or expose unrelated credentials. ### Attack Path 1. A user copies the documented MCP configuration and defines `MAVERICK_EXA_API_KEY`. 2. The MCP client or its configuration layer expands the placeholder into the endpoint URL. 3. The resulting URL includes the plaintext Exa API key in its query string. 4. The client, a debugging facility, telemetry collector, HTTP proxy, gateway, or support bundle records the complete URL. 5. An attacker with access to that record extrac ...[truncated 786 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Prefer an authorization header or a vendor-supported protected header configuration instead of placing the key in the URL. For example, configure the MCP transport to send the credential through an `Authorization` or service-specific API-key header when supported. 2. Store the key in the MCP client's secret-management facility or an environment variable that is referenced only by the protected header configuration. 3. If Exa requires query-string authentication for this endpoint: - Explicitly warn users that the expanded URL contains a secret. - Disable or redact URL logging in MCP clients, proxies, gateways, telemetry, and error reporting. - Ensure support bundles and diagnostic exports remove the `exaApiKey` parameter. - Restrict access to configuration files and logs containing expanded URLs. 4. Use a dedicated key with the minimum available permissions and appropriate usage limits. 5. Establish key-rotation and revocation procedures. Immediately rotate any key that may have appeared in logs or diagnostic output. 6. Add automated secret-redaction tests that verify values assigned to `exaApiKey` never appear in logs, exceptions, telemetry, or exported configuration. ]]>
