T09 · Insecure Skill Coding Practices
- Location
stock_plugin.py:72- Finding
Unauthenticated HTTP Allows Stock Announcement Response Tampering
- Content
View full analysis
Vulnerability Details
File Location:
stock_plugin.py:72,stock_plugin.py:115-117, andstock_plugin.py:146
Vulnerability Type: Cleartext communication with external exchange APIs
Risk Level: MediumVulnerable Code
python url = "http://www.szse.cn/api/disc/announcement/annList?random=" + str(time.time())python url = "http://query.sse.com.cn/infodisplay/queryLatestBulletinNew.do" headers = { "Referer": "http://www.sse.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" }python link = f"http://www.sse.com.cn{url_path}"Technical Analysis
Both exchange integrations communicate over unauthenticated plaintext HTTP. HTTP provides neither transport confidentiality nor server authenticity and does not protect responses against modification in transit.
An attacker capable of observing or modifying network traffic—such as a malicious Wi-Fi operator, compromised router, proxy, or upstream network participant—can inspect query parameters and replace the returned JSON. The plugin accepts announcement titles, identifiers, publication dates, security codes, and URL paths from these responses without authenticity verification, then presents the resulting strings to the user or calling AI agent.
The Shanghai Stock Exchange result link is also constructed with HTTP, allowing subsequent navigation to be intercepted or redirected. Although HTTPS links are produced for Shenzhen announcement details, the Shenzhen API response used to construct those links is still retrieved over HTTP.
Attack Path
- A user or agent invokes
query_announcements. - The plugin sends the query to an exchange endpoint over plaintext HTTP.
- An attacker with a network interception position captures the request.
- The attacker returns a forged HTTP response containing modified announcement titles, stock codes, identifiers, dates, or URL paths. 5 ...[truncated 859 chars]
- A user or agent invokes
- Remediation
View remediation
Remediation Suggestions
- Replace every exchange endpoint, referer, and generated result link with its verified HTTPS equivalent.
- Allow redirects only when the destination remains on an approved exchange hostname and uses HTTPS.
- Reject HTTPS-to-HTTP downgrade redirects.
- Retain TLS certificate verification and do not introduce
verify=False. - Validate response structures and field types before processing them.
- Validate returned paths and identifiers before constructing links; reject absolute URLs or unexpected hostnames supplied by a response.
- Treat all remote announcement text as untrusted content when forwarding it to an AI agent or rendering it in another interface.
- Return a clear error if a secure endpoint is unavailable rather than silently falling back to HTTP.
