T09 · Insecure Skill Coding Practices
- Location
scripts/mobile_lookup.py:28- Finding
Phone Numbers and API Credentials Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/mobile_lookup.py:28, 72-81
Vulnerability Type: Plaintext transmission of sensitive information
Risk Level: HighThe Skill sends the queried phone number and Juhe API key to an external service through an unencrypted HTTP connection. Although contacting the declared provider is necessary for the Skill's functionality, transmitting these values without TLS is not necessary and violates least-risk data handling.
The vulnerable implementation is:
python API_URL = "http://apis.juhe.cn/mobile/get"python def query_mobile(phone: str, api_key: str) -> dict: """Call the Juhe Data API to query mobile-number attribution.""" params = { "phone": phone, "key": api_key, "dtype": "json", } url = f"{API_URL}?{urllib.parse.urlencode(params)}" try: with urllib.request.urlopen(url, timeout=15) as resp: data = json.loads(resp.read().decode("utf-8"))The same insecure transport is explicitly documented in
SKILL.md:95:text GET http://apis.juhe.cn/mobile/get?phone=13812345678&key=YOUR_KEYTechnical Analysis
HTTP provides no transport confidentiality, integrity, or authenticated endpoint protection. The generated URL places two sensitive values in its query string:
- The user's full 7- or 11-digit mobile number or prefix.
- The Juhe API credential.
Any party capable of observing or intercepting the connection—such as a network gateway, transparent proxy, compromised router, malicious Wi-Fi operator, or on-path attacker—can read both values. An active attacker can also modify the server response because the client has no TLS-based assurance that the response originated from the intended provider.
Query-string placement creates an additional exposure surface because complete URLs are commonly retained by HTTP proxies, monitoring systems, debugging tools, and a ...[truncated 1417 chars]
- Remediation
View remediation
Remediation Suggestions
-
Replace the endpoint with the provider's verified HTTPS endpoint:
python API_URL = "https://apis.juhe.cn/mobile/get" -
Update
SKILL.md:95and all examples so they use HTTPS exclusively. -
Reject non-HTTPS endpoint configurations and unexpected redirects rather than silently downgrading to HTTP.
-
If supported by the provider, send the credential in an authorization header instead of the query string. Otherwise, ensure that application and intermediary logging never records complete request URLs.
-
Prefer loading the key from the environment or a permission-restricted secret file. Discourage
--key, because command-line arguments may be exposed through shell history and process inspection. -
Rotate any API key that may previously have been used with the plaintext endpoint.
-
Add an automated test asserting that the configured API URL uses the
httpsscheme.
-
