T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/searxng.py:94
- Finding
- Search Queries and Responses Are Exposed to Network Interception<![CDATA[ ## Vulnerability Details **File Location**: `scripts/searxng.py:94-107`; related insecure default in `scripts/searxng.ini:1-3` **Vulnerability Type**: Disabled TLS certificate validation and plaintext transport **Risk Level**: High ### Vulnerable Code ```python # Build final URL with encoded query string full_url = f"{SEARXNG_URL}/search?{urlencode(params)}" # Configure SSL context to ignore certificate verification. # Essential for local instances using self-signed certificates. ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE try: # Perform the HTTP GET request req = Request(full_url) with urlopen(req, context=ctx, timeout=30) as response: # Decode response body and convert to Python dictionary data = json.loads(response.read().decode("utf-8")) ``` The bundled configuration additionally selects plaintext HTTP: ```ini [searxng] # SearXNG instance URL url = http://192.168.1.20:4000 ``` ### Technical Analysis The script explicitly disables certificate-chain and hostname verification for every HTTPS connection. Consequently, possession of any certificate is sufficient to impersonate the configured SearXNG server. The bundled endpoint uses HTTP rather than HTTPS, so it provides no transport confidentiality, integrity, or server authentication at all. The search terms are encoded in the URL query string. They can therefore be exposed to network observers and may also be retained in proxy, gateway, or server access logs. A network attacker can modify the returned JSON because the client does not establish an authenticated transport channel. ### Attack Path 1. A user or Agent submits a search query, potentially containing sensitive contextual information. 2. The script constructs a GET request whose URL contains the complete query. 3. The request is sent over the bundled plaintext HTTP connection, or over HTTPS without certificate and hostname verification. 4. An attacker con ...[truncated 859 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the global TLS bypass: ```python ctx = ssl.create_default_context() ``` Do not set `check_hostname` to `False` or `verify_mode` to `ssl.CERT_NONE`. 2. Require HTTPS for non-loopback endpoints. Reject plaintext HTTP unless the destination is explicitly limited to a loopback address and the user has knowingly enabled an insecure development mode. 3. For private deployments using a self-signed certificate, support a configurable CA certificate: ```python ctx = ssl.create_default_context(cafile=configured_ca_path) ``` This preserves authentication without requiring a publicly trusted certificate. 4. Replace the bundled private-network endpoint with a neutral placeholder or loopback default, and require explicit configuration before the first search. 5. Prefer an HTTP POST request where supported by SearXNG so that query terms are not embedded in the URL. Regardless of method, configure servers and intermediaries to avoid logging sensitive request data. 6. Fail closed on certificate errors and provide a clear configuration message rather than silently weakening transport security. ]]>
