T09 · Insecure Skill Coding Practices
- Location
scripts/ip_threat.py:16- Finding
Cleartext Transmission of Queried IP Addresses and Threat Intelligence
- Content
View full analysis
Vulnerability Details
File Location:
scripts/ip_threat.py, lines 16–23
Vulnerability Type: Cleartext transmission of potentially sensitive lookup data
Risk Level: MediumVulnerable Code:
python url = f"http://ip-api.com/json/{ip}?fields=status,country,countryCode,region,regionName,city,isp,org,as,asname,query" req = urllib.request.Request(url) req.add_header('User-Agent', 'OpenClaw-IP-Threat-Check/1.0') with urllib.request.urlopen(req, timeout=10) as response: data = json.loads(response.read().decode())Technical Analysis
The Skill sends every IP address submitted to the
ip-api.comdata source over unencrypted HTTP. This request occurs for theinfoaction and is also performed unconditionally bycheck_ip_threat, including bulk checks.Sending a queried IP to an external intelligence provider is necessary for the declared functionality. However, using cleartext HTTP is not a minimum functional requirement. HTTP provides neither transport confidentiality nor server authentication and response integrity. A network observer can identify which addresses are under investigation, while an active on-path attacker can intercept or modify the returned geolocation, ISP, organization, and ASN data.
The response is decoded and incorporated into the Skill's JSON output without any cryptographic authenticity protection. The project does use HTTPS for AbuseIPDB and sends the API key only to that HTTPS endpoint; no evidence was found that credentials are sent to
ip-api.com.Attack Path
- A user invokes
info,check, orbulkwith one or more IP addresses. - The Skill constructs a URL containing each queried address and sends it to
ip-api.comusing cleartext HTTP. - An attacker able to observe or alter network traffic intercepts the request.
- A passive attacker records the investigated IP addresses. An active attacker instead returns forged JSON with a successful status ...[truncated 893 chars]
- A user invokes
- Remediation
View remediation
Remediation Suggestions
- Replace the cleartext endpoint with an HTTPS-capable geolocation or threat-intelligence endpoint.
- Retain standard TLS certificate and hostname validation; do not disable verification or silently fall back to HTTP.
- Fail closed with a clear error if a secure connection cannot be established.
- Validate IP input using Python's
ipaddressmodule before constructing requests, and construct query parameters with a URL-encoding API rather than direct string interpolation. - Validate the response schema and expected field types before using returned intelligence.
- Document that queried addresses are disclosed to external providers, particularly in bulk mode, and obtain user approval where investigation targets are sensitive.
- Consider making each external source explicitly selectable rather than always querying the basic-information service during a threat check.
