T09 · Insecure Skill Coding Practices
- Location
scripts/video_gen.js:22- Finding
Unrestricted API endpoint overrides can disclose bearer credentials
- Content
View full analysis
Vulnerability Details
File Location:
scripts/video_gen.js, lines 22–25 and 70–79
Vulnerability Type: Credential disclosure through unrestricted network destination configuration
Risk Level: MediumVulnerable Code
js const BASE_URL = (process.env.WERYAI_BASE_URL || 'https://api.weryai.com').replace(/\/$/, ''); const MODELS_BASE_URL = (process.env.WERYAI_MODELS_BASE_URL || 'https://api-growth-agent.weryai.com').replace( /\/$/, '', );js async function httpJson(method, fullUrl, body, apiKey) { const headers = { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json', }; const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), 30_000); try { const res = await fetch(fullUrl, { method, headers, body: body != null ? JSON.stringify(body) : undefined, signal: controller.signal, });Technical Analysis
The script permits
WERYAI_BASE_URLandWERYAI_MODELS_BASE_URLto specify arbitrary network destinations. It does not validate the URL scheme or restrict the hostname to trusted WeryAI domains.The shared
httpJsonfunction attaches theWERYAI_API_KEYas a bearer credential to every request, regardless of the selected destination. Consequently, a modified runtime environment can redirect credential-bearing requests to an untrusted host. Anhttp://destination can additionally expose the API key and request data to interception or modification in transit.Sending prompts, public image URLs, generation parameters, and authentication information to the legitimate WeryAI service is necessary for the declared cloud video-generation functionality. However, unrestricted endpoint overrides exceed the minimum privileges required because normal operation only needs access to the documented WeryAI endpoints.
Attack Path
- An attacker or compromised launcher g ...[truncated 1589 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove endpoint overrides if custom WeryAI deployments are not an explicit functional requirement. Use fixed vendor endpoints:
https://api.weryai.comhttps://api-growth-agent.weryai.com
-
If endpoint customization is required, parse each value with
new URL()and reject it unless:- The protocol is exactly
https:. - The hostname is present on an explicit allowlist.
- Embedded usernames and passwords are absent.
- Unexpected ports are rejected or explicitly approved.
- The protocol is exactly
-
Bind credentials to origins. Do not send the production WeryAI API key to a custom origin. Require a separate credential variable for any separately trusted deployment.
-
Fail closed when URL validation fails. Do not silently fall back to an arbitrary or plaintext endpoint.
-
Document the approved destinations and warn operators that environment variables controlling authenticated network destinations are security-sensitive.
-
Add automated tests confirming that attacker-controlled hosts, plaintext HTTP URLs, malformed URLs, embedded credentials, and unapproved ports are rejected before any request is made.
-
Rotate
WERYAI_API_KEYif the Skill has previously run with an endpoint configuration that cannot be verified as trusted.
-
