- Location
- scripts/clawvisual-mcp-client.mjs:248
- Finding
- Sensitive RPC Data Can Be Transmitted over Cleartext HTTP<![CDATA[
## Vulnerability Details
**File Location**: `scripts/clawvisual-mcp-client.mjs:26-27, 248-265, 440-450, 489-500, 523-528`
**Vulnerability Type**: Cleartext transmission of credentials and potentially sensitive user content
**Risk Level**: High
### Vulnerable Code
```js
const BASE_URL = process.env.CLAWVISUAL_MCP_URL || getConfigValue(LOCAL_CONFIG, "CLAWVISUAL_MCP_URL") || "http://localhost:3000/api/mcp";
const API_KEY = process.env.CLAWVISUAL_API_KEY || getConfigValue(LOCAL_CONFIG, "CLAWVISUAL_API_KEY");
```
```js
async function rpc(method, params = {}, id = 1) {
const headers = {
"Content-Type": "application/json"
};
if (API_KEY) {
headers["x-api-key"] = API_KEY;
}
const res = await fetch(BASE_URL, {
method: "POST",
headers,
body: JSON.stringify({
jsonrpc: "2.0",
id,
method,
params
})
});
```
Examples of user-controlled data included in RPC requests:
```js
const payload = {
session_id: typeof args.session === "string" ? args.session : undefined,
input_text: args.input,
max_slides: slideCount,
aspect_ratios: [ratio],
style_preset: typeof args.style === "string" ? args.style : "auto",
tone: typeof args.tone === "string" ? args.tone : "auto",
generation_mode: typeof args.mode === "string" ? args.mode : "quote_slides",
output_language: typeof args.lang === "string" ? args.lang : "en-US",
review_mode: args.review === "required" ? "required" : "auto"
};
```
```js
const payload = {
job_id: args.job,
intent:
args.intent === "regenerate_cover" || args.intent === "regenerate_slides"
? args.intent
: "rewrite_copy_style",
instruction: args.instruction,
preserve_facts: true,
preserve_slide_structure: true,
preserve_layout: true
};
```
```js
const result = await callTool("regenerate_cover", {
prompt: args.prompt,
aspect_ratio: ratio
});
```
### Technical Analysis
The configured MCP endpoint accepts arbitrary URLs, including non-loopback endpoints
...[truncated 1941 chars]
- Remediation
- <![CDATA[
## Remediation Suggestions
1. Parse and validate `CLAWVISUAL_MCP_URL` before sending any request.
2. Permit cleartext HTTP only for verified loopback addresses such as `localhost`, `127.0.0.1`, and, if supported, `::1`.
3. Require `https://` for every non-loopback destination.
4. Refuse to attach `x-api-key` to any cleartext remote request, even if an override is requested.
5. Consider requiring explicit user confirmation before transmitting content to a newly configured remote endpoint.
6. Optionally support an allowlist of trusted MCP hosts.
7. Avoid following redirects from HTTPS to HTTP and ensure credentials are not forwarded across origins.
8. Clearly document that conversion text, prompts, revision instructions, and job identifiers are sent to the configured service.
]]>