T09 · Insecure Skill Coding Practices
Warning
- Location
- wolfram_query.py:11
- Finding
- API Credential Exposed in URL Query Parameters## Vulnerability Details **File Location**: `wolfram_query.py`, lines 11–15 **Vulnerability Type**: API credential exposure through URL query parameters **Risk Level**: Medium ```python url = "https://www.wolframalpha.com/api/v1/llm-api" params = { "input": query, "appid": app_id } ``` The vulnerable data flow is completed by the request at line 18: ```python response = requests.get(url, params=params) ``` ### Technical Analysis The script reads `WOLFRAM_APP_ID` from the process environment and passes it as the `appid` parameter of an HTTP GET request. The `requests` library serializes this parameter into the URL query string. Although HTTPS encrypts the URL while it is in transit, full URLs can still be captured by client-side debugging facilities, HTTP proxies, gateways, observability platforms, exception telemetry, or other systems that record outbound request URLs. Consequently, infrastructure operators or attackers with access to such records may be able to recover the API credential. The credential is not hardcoded in the repository, and the examined code does not deliberately transmit it to an unrelated endpoint. The exposure risk arises from placing sensitive authentication material in a URL rather than a less commonly logged authorization channel. ### Attack Path 1. A user configures a valid `WOLFRAM_APP_ID` and invokes `wolfram_query.py`. 2. The script constructs a GET URL containing the credential as the `appid` query parameter. 3. A local diagnostic facility, outbound proxy, gateway, monitoring platform, or error-reporting system records the complete request URL. 4. An attacker or unauthorized operator gains read access to those records. 5. The attacker extracts the `appid` value and reuses it in requests to the Wolfram|Alpha API. 6. The stolen credential may remain usable until it is revoked, rotated, or otherwise restricted. ### Impact Assessment Successful exploitation would ...[truncated 536 chars]
- Remediation
- ## Remediation Suggestions 1. Prefer an API-supported authorization header or POST body so the credential is not included in the URL. 2. If the Wolfram|Alpha API requires `appid` as a query parameter, treat that exposure as an API constraint and configure clients, proxies, gateways, telemetry systems, and exception handlers to redact the `appid` parameter. 3. Disable verbose HTTP request logging in production and verify that monitoring platforms do not retain full query strings. 4. Restrict the credential's permissions and usage where supported, apply quota and anomaly monitoring, and rotate it periodically. 5. Revoke and replace the credential immediately if URLs containing it may already have been recorded in systems accessible to unauthorized parties. 6. Document that request URLs contain sensitive authentication material so operators do not copy them into tickets, chat messages, logs, or public diagnostics.
