T09 · Insecure Skill Coding Practices
- Location
scripts/video_highlights_llm.py:135- Finding
Bearer Credential and Task Data Can Be Sent to an Unrestricted Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
scripts/video_highlights_llm.py, lines 135–138
Vulnerability Type: Unrestricted destination for authenticated network requests
Risk Level: Highpython endpoint = (args.endpoint or _env_value("BYTEPLUS_MEDIAKIT_ENDPOINT", "MEDIAKIT_ENDPOINT") or _first_config_value(config, "endpoint", "base_url", "baseUrl") or DEFAULT_ENDPOINT).rstrip("/") data = None if payload is None else json.dumps(payload, ensure_ascii=False).encode("utf-8") request = urllib.request.Request(f"{endpoint}{path}", data=data, headers=_headers(args), method=method) try: with urllib.request.urlopen(request, timeout=args.timeout) as response: body = response.read().decode("utf-8")Technical Analysis
The request destination can be supplied through
--endpoint, theBYTEPLUS_MEDIAKIT_ENDPOINTor legacyMEDIAKIT_ENDPOINTenvironment variable, or the configuredendpoint,base_url, orbaseUrlproperty. The value is used without validating its scheme or hostname.Every submit or query request is created with
_headers(args), which includes the MediaKit API key as anAuthorization: Bearer ...header. Consequently, an arbitrary configured endpoint receives both the bearer credential and the request content. The code does not require TLS, restrict destinations to the documented BytePlus service, or prevent a production credential from being attached after the destination changes.Supporting internal environments may require endpoint configuration, but unrestricted destination selection exceeds the minimum privilege required for the declared default functionality.
Attack Path
- An attacker influences a command, environment, or configuration source used by the Skill.
- The attacker sets
--endpoint,BYTEPLUS_MEDIAKIT_ENDPOINT,MEDIAKIT_ENDPOINT, or a configuration endpoint to a server under their control, potentially using plaintext HTTP. - The user or Agent invoke ...[truncated 1017 chars]
- Remediation
View remediation
Remediation Suggestions
- Require
https://for every endpoint and reject plaintext HTTP. - Allowlist the documented production hostname by default:
mediakit.ap-southeast-1.bytepluses.com
- Maintain a separate explicit allowlist for approved internal MediaKit environments.
- Require an explicit high-friction opt-in for non-allowlisted development endpoints.
- Do not attach a production API key when the endpoint hostname differs from its approved destination.
- Parse endpoints with
urllib.parse.urlsplitand reject:- Unsupported schemes.
- Embedded user information.
- Unexpected ports.
- Missing or malformed hostnames.
- Ambiguous hostname encodings.
- Consider binding credentials to named endpoint profiles instead of accepting arbitrary endpoint strings.
- Display the validated destination during preflight without printing credentials, allowing users to detect unexpected configuration before submission.
- Require
