T09 · Insecure Skill Coding Practices
- Location
SKILL.md:16- Finding
API Credential Exposed in URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 16
Vulnerability Type: API credential exposure through a URL query parameter
Risk Level: MediumVulnerable Code
bash curl -s "https://ai-mcp.niu.com/claw/scooter_info?key=$NIU_API_KEY"Technical Analysis
The command expands
NIU_API_KEYdirectly into the request URL. Although HTTPS encrypts the request in transit, it does not protect the credential from exposure through locations where complete URLs may be recorded, including process inspection interfaces, diagnostic output, HTTP access logs, reverse proxies, observability systems, and endpoint monitoring products.URL query parameters are commonly logged by default and may receive weaker redaction than authentication headers. Consequently, a legitimate skill invocation can unintentionally leave reusable credential material in systems accessible to users or services that should not possess the NIU API key.
Attack Path
- A user invokes the skill to obtain scooter information.
- The shell expands
$NIU_API_KEYinto curl's URL argument. - A local process observer, diagnostic system, proxy, access logger, or monitoring component records the complete URL.
- An attacker with access to that record extracts the
keyquery parameter. - The attacker submits requests to the NIU scooter endpoint using the exposed key.
- If the key remains valid and the service does not impose additional authorization controls, the endpoint returns the associated vehicle information.
Impact Assessment
Successful exploitation may allow unauthorized access to private scooter information available through the API, including battery level, estimated range, charging state, remaining charging time, current location, total mileage, and last-update time.
The impact is limited to the permissions assigned to the compromised API key. No evidence indicates that the key provides operating-system privileges, code execution, persistence, or contr ...[truncated 153 chars]
- Remediation
View remediation
Remediation Suggestions
-
Modify the API to accept the credential in an authorization header rather than a query parameter. For example:
bash curl -s \ -H "Authorization: Bearer $NIU_API_KEY" \ "https://ai-mcp.niu.com/claw/scooter_info" -
Configure the server to reject query-string credentials so clients cannot continue using the insecure pattern.
-
Ensure authorization headers are redacted from application, proxy, monitoring, and debugging logs.
-
Avoid enabling shell tracing while handling the credential, and restrict access to processes and configuration files containing it.
-
Rotate API keys that may previously have appeared in URL, proxy, access, diagnostic, or monitoring logs.
-
Apply short expiration periods, least-privilege scopes, revocation support, and rate limiting to reduce the consequences of credential disclosure.
-
