T09 · Insecure Skill Coding Practices
- Location
SKILL.md:82- Finding
TLS Certificate and Hostname Verification Disabled
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:82-83
Vulnerability Type:T09: Insecure Skill Coding Practices
Risk Level: Mediumpython ssl_context.check_hostname = False ssl_context.verify_mode = ssl.CERT_NONETechnical Analysis
The documented network-check procedure disables both TLS certificate validation and hostname verification. If this configuration is used for the Tencent Finance API request, the client will no longer authenticate the remote server.
The example is incomplete because it does not show the initialization or use of
ssl_context. Nevertheless, the explicitly documented configuration is unsafe: applying it to the HTTPS request would allow any certificate to be accepted, including a self-signed or attacker-controlled certificate.An attacker with a network interception capability could impersonate the financial-data endpoint and supply fabricated market information. No remote code execution or privilege escalation is demonstrated; the affected security property is the integrity and authenticity of externally retrieved data.
Attack Path
- A user invokes the skill to analyze a stock.
- The implementation follows the documented procedure and uses an SSL context with certificate and hostname verification disabled.
- An attacker positioned on the network, or controlling a relevant proxy or routing component, intercepts the HTTPS connection.
- The attacker presents an untrusted certificate, which the client accepts because verification is disabled.
- The attacker returns manipulated stock prices, valuation metrics, or trading-volume data.
- The skill processes the forged response and generates a misleading score, rating, or trading recommendation.
Impact Assessment
Successful exploitation could compromise the integrity of all financial data retrieved through the affected request and consequently alter the generated analysis and investment guidance. The scope ...[truncated 190 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove the assignments that disable hostname and certificate verification.
-
Use Python's default verified TLS context:
python import ssl import urllib.request ssl_context = ssl.create_default_context() request = urllib.request.Request( "https://qt.gtimg.cn/q=sh603127", headers={"User-Agent": "TianShu-Stock-Analysis/1.0"}, ) with urllib.request.urlopen( request, context=ssl_context, timeout=10, ) as response: data = response.read() -
Do not provide an insecure fallback that retries requests with certificate validation disabled.
-
Configure an explicit connection timeout to prevent indefinite blocking.
-
Validate the response structure, expected stock identifier, encoding, field count, and numeric ranges before using the data.
-
Fail closed and report a data-source error when TLS validation or response validation fails.
-
If a private certificate authority is required in a controlled environment, install and trust that specific authority rather than disabling verification globally.
-
