Back to skill

Security audit

Crazyrouter Video Gen

Security checks for vulnerabilities and agentic risk

Overview

This video-generation skill mostly matches its stated purpose, but it can expose the API key through an undocumented endpoint override and download arbitrary remote URLs without strong limits.

Review before installing. Use a narrowly scoped Crazyrouter key with spending limits, keep CRAZYROUTER_BASE_URL unset unless you intentionally trust that endpoint, avoid sensitive prompts, and run it in an environment where arbitrary outbound downloads cannot reach private services or exhaust local resources.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/main.mjs:5
Finding
Bearer Credential Disclosure Through an Unvalidated API Base URL<![CDATA[ ## Vulnerability Details **File Location**: `scripts/main.mjs:5`, `scripts/main.mjs:36-40` **Vulnerability Type**: Unvalidated credential destination **Risk Level**: High ### Vulnerable Code ```js const API_BASE = process.env.CRAZYROUTER_BASE_URL || "https://crazyrouter.com/v1"; ``` ```js const response = await fetch(`${API_BASE}/chat/completions`, { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" }, body: JSON.stringify({ model: args.model, messages: [{ role: "user", content: args.prompt }] }), }); ``` ### Technical Analysis The script permits `CRAZYROUTER_BASE_URL` to control the destination of an authenticated HTTP request. It does not validate the URL scheme, hostname, port, or relationship to the legitimate Crazyrouter service before adding the API key to the `Authorization` header. Although `SKILL.md` documents `CRAZYROUTER_API_KEY`, it does not document this endpoint override. A compromised launcher, shell profile, CI configuration, container environment, or wrapper capable of setting environment variables can silently redirect requests to an attacker-controlled service. The request also contains the user's complete video-generation prompt. Consequently, both the bearer credential and user-provided content are disclosed to the selected endpoint. ### Attack Path 1. An attacker gains the ability to influence the environment used to invoke the Skill, such as through a malicious wrapper, poisoned CI configuration, or modified container environment. 2. The attacker sets `CRAZYROUTER_BASE_URL` to an attacker-controlled endpoint, for example `https://attacker.example/v1`. 3. A user invokes the Skill normally with a valid `CRAZYROUTER_API_KEY`. 4. The script sends a POST request to `https://attacker.example/v1/chat/completions`. 5. The request includes `Authorization: Bearer <CRAZYROUTER_API_KEY>` and the user's prompt. 6. The attacker captures the credential and can use it against the le ...[truncated 510 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `CRAZYROUTER_BASE_URL` if custom endpoints are not an explicit product requirement. 2. If endpoint customization is required, parse the URL with `new URL()` and enforce: - The `https:` scheme. - An explicit allowlist of trusted hostnames. - Approved ports and API path prefixes. - Rejection of embedded credentials and malformed URLs. 3. Do not attach the bearer token until the destination has passed validation. 4. Disable redirects for authenticated requests where possible, or validate every redirect destination before resending credentials. 5. Document any supported endpoint override and its security implications. 6. Use a narrowly scoped API key, apply spending limits, and rotate any key that may have been used with an untrusted endpoint. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.mjs:45
Finding
Unrestricted Fetch of API-Controlled Video URLs<![CDATA[ ## Vulnerability Details **File Location**: `scripts/main.mjs:45-54` **Vulnerability Type**: Server-side request forgery and unbounded remote download **Risk Level**: Medium ### Vulnerable Code ```js const urlMatch = content.match(/https?:\/\/[^\s"']+\.(mp4|webm|mov)[^\s"']*/i) || content.match(/https?:\/\/[^\s"']+video[^\s"']*/i) || (videoUrl ? [videoUrl] : null); if (urlMatch) { const url = urlMatch[0] || urlMatch[1]; console.error(`Downloading video from: ${url}`); const videoResponse = await fetch(url); if (videoResponse.ok) { const buffer = Buffer.from(await videoResponse.arrayBuffer()); await writeFile(args.output, buffer); ``` ### Technical Analysis The remote API response controls the URL supplied to `fetch()`. The script accepts arbitrary HTTP or HTTPS hosts based only on permissive text matching. It does not enforce a media-host allowlist, reject loopback or private-network destinations, validate redirects, verify the response content type, impose a download-size limit, or stream the response with bounded resource usage. The second regular expression only requires the substring `video` somewhere in the URL. The `video_url` response property is accepted without even that restriction. File extensions are therefore not a meaningful security boundary. Because `arrayBuffer()` reads the complete response into memory before `writeFile()` is called, a malicious or compromised API can direct the process to a very large or indefinitely streamed response. This can exhaust memory and subsequently consume substantial disk space. It can also cause GET requests to services reachable from the Agent's network context, including local or private-network services. ### Attack Path 1. The configured API endpoint is compromised, malicious, or redirected through the unvalidated `CRAZYROUTER_BASE_URL` setting. 2. It returns a completion containing a crafted URL or places the URL in `video_url`. 3. The crafted URL targets either: - A lo ...[truncated 1129 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Accept download URLs only from an explicit allowlist of trusted media-delivery hostnames. 2. Require HTTPS and reject URLs containing embedded credentials, unexpected ports, or unsupported schemes. 3. Resolve the hostname and reject loopback, link-local, private, multicast, reserved, and cloud-metadata address ranges for both IPv4 and IPv6. 4. Repeat destination validation after DNS resolution and for every redirect. Prefer disabling automatic redirects and processing validated redirects manually. 5. Require an approved video MIME type and reject responses with missing or unexpected `Content-Type` values. 6. Enforce a strict maximum response size using `Content-Length` when available and a byte-counting limit while streaming. 7. Stream the response directly to a newly created output file rather than loading the complete body into memory. 8. Apply connection, response, and total-download timeouts. 9. Delete partial output files when validation or download fails. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (1)

Vague Triggers

Medium
Confidence
96% confidence
Finding
The skill description includes very broad invocation cues such as 'generate, create, or make a video,' which can cause the agent to select this skill for a wide range of loosely related requests. Overbroad triggering increases the chance of unintended external API use, unexpected data disclosure in prompts sent to a third party, and unnecessary costs or side effects from accidental execution.

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/main.mjs:5