T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/speedtest.py:30
- Finding
- Credentials and Session Cookies Transmitted over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `scripts/speedtest.py`, lines 30-31, 59-97, and 118-155 **Vulnerability Type**: Plaintext transmission of sensitive information **Risk Level**: High ### Vulnerable Code ```python LEGACY_API_BASE = "http://www.17ce.com/api/site" API_BASE = "http://www.17ce.com/apis" ``` The API-password authentication request is constructed and transmitted as follows: ```python data = [ ("user", username), ("t", str(t)), ("code", code), ("url", url), ("rt", str(rt)), ("nocache", str(nocache)), ] if cookie: data.append(("cookie", cookie)) response = requests.post( f"{API_BASE}/http", data=data, timeout=30 ) ``` The legacy authentication mode transmits the account secret directly: ```python data = [ ("appKey", username), ("appSecret", password), ("url", url), ("rt", str(rt)), ("nocache", str(nocache)), ] if cookie: data.append(("cookie", cookie)) response = requests.post( f"{LEGACY_API_BASE}/http", data=data, timeout=30 ) ``` ### Technical Analysis Both API base URLs use plaintext HTTP. The legacy mode places the account name and reusable account secret in an unencrypted form body. The alternative mode transmits the username, timestamp, derived authentication code, target URL, and any supplied cookie without transport encryption. Although the API-password mode does not transmit the raw API password, its authentication code is exposed to network observers and may be replayable during its accepted timestamp window. The script's own API error definitions indicate that timestamps are accepted within a five-minute range. The Base64 operation reported by the static pre-scan is not itself a covert exfiltration mechanism. It is an intermediate operation in the documented authentication hash: ```python code = hashlib.md5(base64.b64encode(raw.encode())).hexdigest() ``` The confirmed vulnerability is the subsequent network transmission over plaintex ...[truncated 1312 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace both plaintext API endpoints with verified HTTPS endpoints. 2. Remove the legacy account-password authentication mode if the service does not support it securely over TLS. 3. Configure the HTTP client to reject redirects from HTTPS to HTTP. 4. Do not accept or forward production session cookies by default. 5. If cookie-based testing is indispensable, require explicit user confirmation and short-lived, test-only credentials. 6. Implement certificate verification and fail closed on TLS validation errors. 7. Ensure sensitive request fields are never written to logs or exception messages. 8. Rotate any account passwords or cookies previously transmitted through these HTTP endpoints. ]]>
