T09 · Insecure Skill Coding Practices
- Location
scripts/videogen.py:89- Finding
Bearer API Credentials Can Be Redirected to an Arbitrary Server
- Content
View full analysis
Vulnerability Details
File Location:
scripts/videogen.py:89-101,scripts/videogen.py:129-145, andscripts/videogen.py:898-913
Vulnerability Type: Unrestricted service endpoint override causing credential disclosure
Risk Level: HighVulnerable Code
python def _resolve_base_url(self, cli_url): if cli_url: return cli_url.rstrip("/") env_url = os.environ.get("AI_HIVE_BASE_URL") if env_url: return env_url.rstrip("/") file_config = self._read_config_file() if file_config.get("base_url"): return file_config["base_url"].rstrip("/") return DEFAULT_BASE_URLpython def __init__(self, config): self.config = config self.base = config.base_url self.headers = { "Authorization": f"Bearer {config.api_key}", "Content-Type": "application/json", } def _url(self, path): return f"{self.base}/openapi/v1/{path}" def _request(self, method, url, **kwargs): self.config.log(f"{method} {url}") try: resp = requests.request( method, url, headers=self.headers, timeout=DEFAULT_TIMEOUT, **kwargs )python p.add_argument("--base-url", help=f"API Base URL (default {DEFAULT_BASE_URL})")Technical Analysis
The Skill permits the API base URL to be replaced through the
--base-urlargument, theAI_HIVE_BASE_URLenvironment variable, or the persistent configuration file. The supplied value is accepted without validating its scheme or hostname.The same HTTP client unconditionally attaches the AI Hive bearer credential to requests constructed from this configurable URL. Consequently, anyone who can influence the invocation arguments, environment, or configuration can cause the credential to be transmitted to a server outside the intended AI Hive trust boundary.
The issue exceeds the minimum privileges required for the declared functionality. A Sh ...[truncated 2034 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
--base-urlandAI_HIVE_BASE_URLoverrides from this specialized Skill unless custom deployments are an explicit requirement. - Allowlist the documented origin, such as
https://ai-hive.iclip.cn, and reject all other hosts. - Require HTTPS and reject URLs containing user information, fragments, unexpected ports, or non-HTTP schemes.
- Bind credentials to an expected origin. Do not attach the bearer token when the destination origin differs from the approved API origin.
- Validate upload URLs returned by the service against an approved set of HTTPS object-storage domains before transmitting media.
- If custom endpoints must remain supported, require a separate endpoint-specific credential instead of reusing the AI Hive key.
- Display the destination origin and require explicit confirmation before sending credentials or media to a non-default service.
- Add tests confirming that hostile schemes and hosts are rejected and that credentials are never sent outside the approved origin.
- Remove
