T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/echotik_batch_video_detail.py:36
- Finding
- Credential-Bearing Requests Can Be Redirected to Arbitrary Endpoints<![CDATA[ ## Vulnerability Details **File Location**: `scripts/echotik_batch_video_detail.py:36-69`; `scripts/onboarding.py:74-85, 188-230, 402-459` **Vulnerability Type**: Unvalidated security-sensitive endpoint configuration **Risk Level**: High ### Vulnerable Code ```python def get_api_base() -> str: """Gateway base address: LINKFOX_TOOL_GATEWAY takes precedence.""" return (os.environ.get("LINKFOX_TOOL_GATEWAY") or "https://tool-gateway.linkfox.com").rstrip("/") def call_api(params): api_url = get_api_url() api_key = get_api_key() data = json.dumps(params).encode("utf-8") headers = { "Authorization": api_key, "Content-Type": "application/json", "User-Agent": "LinkFox-Skill/2.0", "SESSION_ID": os.environ.get("SESSION_ID", ""), "MESSAGE_ID": os.environ.get("MESSAGE_ID", ""), "MODE_ID": os.environ.get("MODE_ID", ""), "APP_NAME": os.environ.get("APP_NAME", ""), } ``` The onboarding script similarly allows the login and account API destinations to be overridden: ```python def _agent_base() -> str: return _env_base("LINKFOX_AGENT_API_URL", "https://tool-gateway.linkfox.com", "LINKFOX_TOOL_GATEWAY") def _login_base() -> str: return _env_base("LINKFOX_LOGIN_API_URL", "https://api.linkfox.com") def _agent_user_base() -> str: return _env_base("LINKFOX_AGENT_USER_API_URL", "https://agent-api.linkfox.com") ``` Sensitive tokens are attached to requests made to these configurable destinations: ```python if access_token: h["authorization"] = access_token h["uid"] = _uid_header(access_token, user_id) if user_id else _LOGIN_FIXED_UID ``` ### Technical Analysis The scripts trust environment variables as complete network origins without enforcing HTTPS or validating the destination hostname. The affected requests may contain: - LinkFox API keys - Access and refresh tokens - Phone numbers an ...[truncated 1527 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Hardcode production origins in release builds or enforce an explicit hostname allowlist. 2. Require `https` and reject URLs containing user information, unexpected ports, fragments, or non-empty paths where an origin is expected. 3. Never attach credentials after a cross-origin redirect; disable redirects or validate every redirect target. 4. Keep test endpoint support behind an explicit development-only option that is unavailable in normal Skill execution. 5. Use separate, least-privilege credentials for development and production. 6. Add automated tests proving that HTTP URLs, unknown hosts, IP literals, and deceptive subdomains are rejected. 7. Document every destination and each category of data transmitted before users begin login or account operations. ]]>
