T09 · Insecure Skill Coding Practices
- Location
scripts_files/risk_monitor.py:23- Finding
Unauthenticated HTTP Market Data Can Be Manipulated to Produce False Risk Alerts
- Content
View full analysis
45: return { 'price': float(data[3]), 'change_pct': float(data[32]), 'name': data[1] } ``` ### Technical Analysis The risk monitor obtains security prices from a plaintext HTTP endpoint. HTTP provides neither transport encryption nor server authentication, so an attacker able to observe or modify network traffic can intercept the requested stock code and alter the returned price fields. The program directly trusts response fields `data[3]` and `data[32]`. These values control portfolio profit-and-loss calculations and the generation of stop-loss, take-profit, intraday-crash, and intraday-surge alerts. The implementation does not authenticate the response, verify the HTTP status, restrict redirects to HTTPS, or validate the returned quote against an independent source. Although the code checks the number of response fields, that structural check does not establish the integrity or authenticity of the data. ### Attack Path 1. A user invokes `risk_monitor.py` while connected through a network controlled or observable by an attacker, such as a hostile Wi-Fi access point, compromised router, or malicious proxy. 2. The script sends the portfolio stock code to `http://qt.gtimg.cn`. 3. The attacker intercepts the plaintext response. 4. The attacker substitutes forged values for the current price or daily percentage change. 5. The script parses the forged fields and treats them as authentic market data. 6. The risk calculations produce false results, potentially suppressing a genuine stop-loss warning or creating a fraudulent alert. 7. The user may make ...[truncated 735 chars]- Remediation
View remediation
