T09 · Insecure Skill Coding Practices
- Location
scripts/proxy_demo.py:25- Finding
Plaintext Backup Gateways Can Expose API Credentials and Financial Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/proxy_demo.py:25-28andSKILL.md:564-568
Vulnerability Type: Sensitive information transmitted over an unencrypted channel
Risk Level: HighVulnerable Code
python DEFAULT_GATEWAY = "https://tushare.citydata.club/" BACKUP_GATEWAY_1 = "http://111.229.164.2:8083/" BACKUP_GATEWAY_2 = "http://124.223.112.152:6331/" BACKUP_GATEWAY_3 = "http://110.42.211.9:9900/"The corresponding configuration documentation is:
markdown | `TUSHARE_TOKEN` | (none) | Required API token | | `TUSHARE_GATEWAY` | `https://tushare.citydata.club/` | Custom backend address | | `TUSHARE_GATEWAY_BACKUP1` | `http://111.229.164.2:8083/` | Backup gateway 1 | | `TUSHARE_GATEWAY_BACKUP2` | `http://124.223.112.152:6331/` | Backup gateway 2 | | `TUSHARE_GATEWAY_BACKUP3` | `http://110.42.211.9:9900/` | Backup gateway 3 |Technical Analysis
Three supported backup endpoints use plaintext HTTP. The Tushare client authenticates requests using
TUSHARE_TOKEN; therefore, directing the client to one of these endpoints can transmit the token and API request contents without transport encryption or server authentication.Although the current implementation does not automatically rotate through these constants, the endpoints are published as supported backup gateways and can be selected through the custom gateway configuration. An HTTP connection is vulnerable to passive interception and active man-in-the-middle modification.
Using raw IP addresses also prevents meaningful hostname-based identity verification. An attacker controlling a network segment, proxy, router, or DNS-independent traffic path could observe or alter API traffic.
Attack Path
- A user follows the documented backup configuration or passes one of the HTTP backup addresses to
get_client. - The client assigns that address to
pro._DataApi__http_url. - An authenticated financial-data API meth ...[truncated 885 chars]
- A user follows the documented backup configuration or passes one of the HTTP backup addresses to
- Remediation
View remediation
Remediation Suggestions
- Remove all plaintext HTTP gateway definitions and documentation.
- Require HTTPS for every configured gateway and reject all other URL schemes.
- Use trusted DNS hostnames with valid TLS certificates instead of raw IP addresses.
- Maintain an explicit allowlist of approved gateway hostnames.
- Do not silently downgrade from HTTPS to HTTP during failover.
- Fail closed when TLS validation fails.
- Add tests verifying that HTTP URLs, IP-literal endpoints, and invalid certificates are rejected.
- Revoke and rotate any token known to have been transmitted through a plaintext endpoint.
