T09 · Insecure Skill Coding Practices
- Location
scripts/toolkit.js:129- Finding
Plaintext HTTP Used for IP Geolocation Requests
- Content
View full analysis
Vulnerability Details
File Location:
scripts/toolkit.js:129
Vulnerability Type: Unencrypted transmission of user input and API responses
Risk Level: MediumVulnerable Code
js const data = await fetch(`http://ip-api.com/json/${ip}?lang=zh-CN`);Technical Analysis
The IP geolocation function sends the user-supplied IP address to
ip-api.comover plaintext HTTP. HTTP provides neither transport confidentiality nor server authentication and response integrity.A passive network observer can read the queried IP address and returned geolocation information. An active on-path attacker can intercept the request and replace the response with attacker-controlled JSON. Because the application accepts parsed JSON without cryptographic verification, a forged response with
status: "success"is treated as legitimate and its country, region, city, ISP, organization, and timezone values are printed to the caller.Attack Path
- A user invokes
china-toolkit ip <IP-address>. - The skill constructs a plaintext request to
http://ip-api.com/json/.... - An attacker with an on-path position, such as control of an untrusted Wi-Fi access point, compromised router, or network proxy, intercepts the request.
- The attacker reads the queried IP address or returns forged JSON containing
status: "success"and manipulated geolocation fields. - The skill parses the response and presents the forged information as successful API output.
Impact Assessment
Exploitation does not grant local code execution, filesystem access, elevated system privileges, or persistence. Its scope is limited to the confidentiality of IP lookup queries and the integrity of geolocation results transmitted through this endpoint. Manipulated results could cause a user or downstream agent to make incorrect decisions based on forged country, organization, ISP, or location data.
- A user invokes
- Remediation
View remediation
Remediation Suggestions
- Replace the endpoint with an IP geolocation service that supports HTTPS.
- Do not silently fall back or redirect to plaintext HTTP.
- Retain Node.js TLS certificate and hostname verification.
- Validate response status codes, content type, structure, and expected field types before using the response.
- Add request timeouts and response-size limits to reduce exposure to stalled or oversized third-party responses.
- Document that IP addresses are disclosed to a third-party geolocation provider.
- Add a regression test that rejects non-HTTPS service URLs.
