T09 · Insecure Skill Coding Practices
- Location
assets/plugin/image-generation-provider.js:20- Finding
Hard-Coded Nonstandard API Endpoint Receives Credentials and User Prompts
- Content
View full analysis
Vulnerability Details
File Location:
assets/plugin/image-generation-provider.js, lines 20–22 and 101–121
Vulnerability Type: Unverified external data destination and credential disclosure risk
Risk Level: HighVulnerable Code
js function resolveHnbcBaseUrl(cfg) { const direct = cfg?.models?.providers?.hnbc?.baseUrl?.trim() || "https://api.1415.xin/v1"; return direct.replace(/\/+$/u, ""); }js const apiKey = auth.apiKey || req.cfg?.models?.providers?.hnbc?.apiKey?.trim(); if (!apiKey) throw new Error("HNBC API key missing"); const response = await fetch(`${resolveHnbcBaseUrl(req.cfg)}/images/generations`, { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" }, body: JSON.stringify({ model: req.model || "gpt-image-2", prompt: req.prompt, n: req.count ?? 1, size: resolveRequestedSize(req) }) });Technical Analysis
The provider defaults to the nonstandard domain
api.1415.xinand transmits both the HNBC bearer credential and the user's image-generation prompt to it. The project documentation identifies the service as HNBC but does not disclose this destination domain or explicitly warn that credentials and prompts are sent there.The destination can also be replaced through
models.providers.hnbc.baseUrlwithout an origin allowlist or an explicit confirmation mechanism. If configuration can be modified by another local component or untrusted configuration source, the bearer credential and prompt can consequently be redirected to an attacker-controlled HTTPS server.The code does not show an explicit cross-origin redirect policy. Depending on the runtime's Fetch implementation, authorization headers may be removed during cross-origin redirects; however, the project should not rely solely on implicit client behavior to protect credentials.
Attack Path
- The user invokes
scripts/install.sh, which installs the provider into OpenCl ...[truncated 1301 chars]
- The user invokes
- Remediation
View remediation
Remediation Suggestions
- Verify that the default endpoint is the provider's official, controlled API domain and document that ownership.
- Clearly disclose the destination domain and the transmission of API credentials and user prompts before first use.
- Restrict the default endpoint and configurable
baseUrlto HTTPS. - Maintain an allowlist of approved origins. If custom origins are required, require explicit user opt-in and show a warning that the API key will be sent to that origin.
- Parse the URL with the standard
URLAPI and reject embedded credentials, unsupported protocols, unexpected ports, malformed hosts, and unapproved origins. - Set an explicit redirect policy such as
redirect: "error"or manually validate every redirect destination before resending a request. - Add automated tests confirming that credentials are never sent to an unapproved origin or forwarded across redirects.
- Provide credential revocation and rotation guidance for users who may already have used an untrusted endpoint.
