T09 · Insecure Skill Coding Practices
- Location
ip.py:23- Finding
API Credential Exposed in URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
ip.py, lines 23–38
Vulnerability Type: API credential exposure through URL query parameters
Risk Level: Mediumpython params = {"appkey": appkey} ip = req.get("ip") if not ip: return { "error": "missing_param", "message": "ip is required", } params["ip"] = ip try: resp = requests.get(IP_LOCATION_URL, params=params, timeout=10)Technical Analysis
The API key obtained from the
JISU_API_KEYenvironment variable is added to theparamsdictionary and passed torequests.get. This causes the credential to be encoded into the request URL as a query parameter.HTTPS protects the URL while it is transmitted between the client and the HTTPS endpoint, but it does not prevent the complete URL from being recorded by local diagnostics, HTTP client instrumentation, forward proxies, API gateways, monitoring products, or server access logs. Consequently, systems and personnel with access to those records may gain access to the credential.
Attack Path
- A legitimate user invokes the skill with
JISU_API_KEYconfigured. - The script constructs a URL containing both
appkeyandipquery parameters. - A proxy, gateway, server, monitoring system, or diagnostic facility records the complete request URL.
- An attacker or unauthorized operator obtains access to those records.
- The attacker extracts the
appkeyvalue from the recorded query string. - The attacker reuses the credential to make unauthorized requests to JisuAPI until the key is revoked, expires, or reaches its quota.
Impact Assessment
Successful exploitation exposes the privileges associated with the JisuAPI key. An attacker could consume the account's API quota, issue requests billed or attributed to the legitimate account, and cause denial of service by exhausting request limits. The scope is limited to permissions granted to that API key; the ...[truncated 100 chars]
- A legitimate user invokes the skill with
- Remediation
View remediation
Remediation Suggestions
- If JisuAPI supports it, transmit the credential in an HTTP authorization header rather than in the URL:
python headers = {"Authorization": f"Bearer {appkey}"} params = {"ip": ip} resp = requests.get( IP_LOCATION_URL, headers=headers, params=params, timeout=10, ) - If the provider requires
appkeyas a query parameter, confirm whether an authenticated POST body is supported and prefer that mechanism. - Where the provider offers no alternative, configure clients, proxies, gateways, observability tools, and server access logs to redact the
appkeyparameter. - Use a dedicated, least-privileged API key with restrictive quotas or endpoint permissions where supported.
- Rotate the key periodically and immediately rotate it if URLs containing the key may have been logged.
- Avoid logging prepared request URLs, exception objects containing request details, or verbose HTTP traces in production.
- If JisuAPI supports it, transmit the credential in an HTTP authorization header rather than in the URL:
