T09 · Insecure Skill Coding Practices
- Location
skills/smyx_common/scripts/util.py:568- Finding
Authentication Credentials Can Be Forwarded to Arbitrary Absolute URLs
- Content
View full analysis
Vulnerability Details
File Location:
skills/smyx_common/scripts/util.py, lines 568–608 and 642
Vulnerability Type: Unrestricted credential forwarding
Risk Level: HighVulnerable Code
python if not url.startswith("https://") and not url.startswith("http://"): url = cls.BASE_URL + urlpython headers.setdefault("X-Access-Token", ApiEnum.TOKEN) headers.setdefault("X-Api-Key", ApiEnum.API_SECRET_KEY) headers.setdefault("Authorization", ApiEnum.OPEN_TOKEN)python response = requests.request(method, url, *args, json=data, params=params, headers=headers, timeout=int(timeout), **argss)Technical Analysis
RequestUtil.http_requestaccepts both relative URLs and arbitrary absolute HTTP or HTTPS URLs. Relative URLs are prefixed with the configured API base URL, but absolute URLs are used without validating their destination.The method subsequently adds the cached access token, API key, and authorization token to the request headers regardless of the destination host or transport security. Consequently, any internal caller that can influence the
urlargument can cause credentials intended for the trusted service to be transmitted to an attacker-controlled server.The reviewed gait-analysis CLI currently invokes fixed relative endpoints. Its advertised
--api-urlargument is passed toanalyze_videobut is not applied, so direct exploitation through that CLI option was not confirmed. Nevertheless, the shared request utility exposes an exploitable credential-forwarding primitive to current or future callers.Attack Path
- The Skill authenticates with the configured cloud service and caches values in
ApiEnum.TOKEN,ApiEnum.OPEN_TOKEN, orApiEnum.API_SECRET_KEY. - An attacker influences a caller of
RequestUtil.http_request, directly or through another shared API method, to provide an absolute URL such as `https://attacker.ex ...[truncated 1071 chars]
- The Skill authenticates with the configured cloud service and caches values in
- Remediation
View remediation
Remediation Suggestions
- Parse destinations with
urllib.parse.urlsplitand reject malformed URLs, embedded user information, nonstandard schemes, and unexpected ports. - Maintain an explicit allowlist of trusted HTTPS hosts. Compare normalized hostnames exactly rather than using string prefixes or suffixes.
- Attach authentication headers only when the destination matches the corresponding trusted service.
- Reject all plaintext HTTP destinations for authenticated requests.
- Use separate request functions or
requests.Sessionobjects for authenticated first-party traffic and unauthenticated external traffic. - Disable automatic cross-origin redirects or validate every redirect destination before retaining authentication headers.
- Remove or correctly implement
--api-url. If custom endpoints are required, do not forward first-party credentials to them unless they pass an explicit trust policy. - Add tests proving that credentials are omitted for external hosts, HTTP destinations, deceptive subdomains, user-information URLs, and cross-origin redirects.
- Parse destinations with
