T09 · Insecure Skill Coding Practices
- Location
- skills/smyx_common/scripts/util.py:548
- Finding
- Authentication Credentials, Internal Identity, and Uploaded Media Are Transmitted over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `skills/smyx_common/scripts/config.yaml:15`, `skills/smyx_common/scripts/config-dev.yaml:2-4`, `skills/smyx_common/scripts/util.py:548-561, 572-646`, `skills/smyx_analysis/scripts/skill.py:113-129` **Vulnerability Type**: Plaintext transmission of sensitive information **Risk Level**: High ### Vulnerable Code The default configuration activates the development environment: ```yaml env: dev ``` That environment replaces the HTTPS production endpoints with plaintext HTTP endpoints: ```yaml ApiEnum: base-url-open-api: "http://192.168.1.234:9601/smyx-open-api" base-url-open-h5: "http://192.168.1.234:4100" base-url-health: "http://192.168.1.234:7070/jeecg-boot-xzgz" ``` The request utility transmits the internal identity to the plaintext health endpoint: ```python def _get_or_create_user(username): _url = ApiEnum.BASE_URL_HEALTH + "/sys/phoneLogin" open_id = username _data = { "silent": 1, "register": 1, "openId": open_id, "mobile": username, "source": ConstantEnum.DEFAULT__SKILL_HUB_NAME } try: _response = requests.post(_url, json=_data) if _response.status_code == 200: _response_json = _response.json() if _response_json and _response_json.get("success"): return _response_json and _response_json.get("result") except Exception as _e: CommonUtil.trace_exception_stack(_e) return {} ``` It then adds authentication material to subsequent requests without requiring HTTPS or restricting the destination hostname: ```python if not url.startswith("https://") and not url.startswith("http://"): url = cls.BASE_URL + url headers['App-Id'] = ConstantEnum.APP__ID headers.setdefault("X-Access-Token", ApiEnum.TOKEN) headers.setdefault("X-Api-Key", ApiEnum.API_SECRET_KEY) headers.setdefault("Authorization", ApiEnum.OPEN_TOKEN) data = data or {} params = params or {} options = opt ...[truncated 3516 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `env: dev` from the shipped default configuration and use HTTPS production endpoints by default. 2. Reject all plaintext HTTP endpoints outside an explicitly enabled, isolated test environment. 3. Validate API destinations against a strict allowlist before adding authentication headers. 4. Only attach authentication headers after confirming the URL uses HTTPS and belongs to an approved hostname. 5. Configure private development services with TLS rather than relying on plaintext LAN transport. 6. Add an explicit timeout to the `/sys/phoneLogin` request. 7. Continue using certificate verification and do not introduce `verify=False`. 8. Avoid duplicating an internal identifier into a field named `mobile` unless the server contract strictly requires it. 9. Clearly disclose remote media upload and obtain user consent before transferring local files. 10. Rotate all tokens that may previously have traversed the plaintext development endpoints. ]]>
