T09 · Insecure Skill Coding Practices
- Location
skills/search.sh:11- Finding
Configurable Gateway Can Receive the Research API Key
- Content
View full analysis
/dev/null) ``` ### Technical Analysis The script accepts `RESEARCH_GATEWAY_URL` without validating its scheme, hostname, port, or trust relationship. It then constructs the request URL from that value and attaches `RESEARCH_API_KEY` as a bearer token. Consequently, any party capable of controlling the environment variable can redirect authenticated requests to an arbitrary destination. The script does not require HTTPS or restrict authenticated requests to the expected `gateway.spraay.app` host. This is a configuration-dependent vulnerability: exploitation requires influence over the process environment or deployment configuration. The issue does not independently provide command execution because shell arguments are passed through arrays and quoted correctly. ### Attack Path 1. An attacker gains the ability to influence the Skill's environment or installation configuration. 2. The attacker sets `RESEARCH_GATEWAY_URL` to an attacker-controlled endpoint, such as `http://attacker.example`. 3. A user or agent invokes `skills/search.sh` while `RESEARCH_API_KEY` is present. 4. The script constructs the destination URL using the malicious gateway value. 5. `curl` sends the `Authorization: Bearer ...` header and request data to the attacker-controlled server. 6. The attacker captures the API key and may reuse it for unauthorized gateway requests or paid API consu ...[truncated 610 chars]- Remediation
View remediation
