T09 · Insecure Skill Coding Practices
- Location
scripts/zabbix_api.py:24- Finding
Zabbix API Token May Be Transmitted Without HTTPS
- Content
View full analysis
Vulnerability Details
File Location:
scripts/zabbix_api.py, lines 24-25, 28-48
Vulnerability Type: Sensitive credential transmission without enforced HTTPS
Risk Level: HighVulnerable Code
python class ZabbixDirect: def __init__(self, url, token): self.api_url = f"{url.rstrip('/')}/api_jsonrpc.php" self.token = token def _call(self, method, params): payload = { "jsonrpc": "2.0", "method": method, "params": params, "auth": self.token, "id": 1 } data = json.dumps(payload).encode('utf-8') # Use a clean, honest User-Agent instead of browser spoofing headers = { 'Content-Type': 'application/json', 'User-Agent': 'OpenClaw-ZabbixSkill/1.0' } req = urllib.request.Request(self.api_url, data=data, headers=headers) # Use the system's default SSL context, which verifies certificates. # This protects against Man-in-the-Middle attacks. context = ssl.create_default_context() with urllib.request.urlopen(req, context=context) as response: return json.loads(response.read().decode()).get("result")Technical Analysis
The constructor accepts the user-configured URL without parsing or validating its scheme. The
_callmethod places the Zabbix API token in the JSON-RPC request body and submits it throughurllib.request.urlopen.Creating a certificate-verifying SSL context protects HTTPS requests against untrusted certificates, but it does not require HTTPS. If
ZABBIX_URLuseshttp://,urllibcan send the request without TLS, exposing the token and API data in plaintext. Documentation recommends HTTPS, but this recommendation is not enforced by the implementation.Redirect behavior should also be constrained. An initially secure URL must not be permitted to redirec ...[truncated 1767 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse
ZABBIX_URLbefore retaining or using it and reject every scheme other thanhttps. - Require a nonempty hostname and reject embedded credentials, malformed URLs, and unexpected URL components.
- If local plaintext HTTP support is operationally necessary, limit it to explicit loopback addresses and require a clearly named opt-in setting. Do not enable it by default.
- Disable automatic redirects for credential-bearing requests or validate every redirect target. Reject HTTPS-to-HTTP downgrades and cross-origin redirects.
- Preserve system certificate and hostname verification; do not add an option that silently disables TLS validation.
- Use a dedicated least-privilege Zabbix token restricted to the hosts, groups, data, and actions required by this Skill.
- Separate read-only operations from event acknowledgement where possible, using distinct tokens so routine monitoring cannot exercise mutation privileges.
- Fail closed with a clear error before constructing a request when URL security requirements are not satisfied.
- Add automated tests confirming rejection of
http://, malformed URLs, downgrade redirects, and cross-origin redirects. - Rotate the Zabbix token after any suspected plaintext transmission or unauthorized configuration change.
- Parse
