T09 · Insecure Skill Coding Practices
- Location
scripts/check.sh:24- Finding
Curl Option Injection and Unrestricted Endpoint Access in Health Checks
- Content
View full analysis
&1) ``` ### Technical Analysis The user-supplied `URL` is passed directly to `curl` without an option terminator (`--`) or URL validation. Shell quoting prevents shell metacharacter expansion, but it does not prevent `curl` from interpreting a value beginning with `-` as a command-line option. The script also does not restrict allowed URL schemes or destination addresses. Despite being documented as an HTTP endpoint monitor, it can attempt connections to loopback, private, link-local, or other network destinations reachable by the host. Depending on the installed curl build, non-HTTP schemes may also be accepted. The request executes with the network access and filesystem visibility of the account running the Skill. A crafted curl option may modify curl behavior, while a crafted URL may turn the health check into an internal network probing primitive. ### Attack Path 1. An attacker causes the Skill to invoke `check.sh` with an attacker-controlled endpoint. 2. The attacker supplies either: - An argument beginning with a curl option, such as a supported config-file option; or - An HTTP URL targeting a loopback, private, link-local, or otherwise sensitive internal service. 3. `curl` interprets the argument without an option boundary or sends the request to the internal destination. 4. The attacker observes the success status, HTTP status code, response timing, or other resulting behavior. 5. Repeated requests can be used to identify reachable internal services or influence curl using locally accessible configuration, subject to the privileges of the Skill process. ### Impact Assessment This issue d ...[truncated 699 chars]- Remediation
View remediation
&2 exit 2 fi CURL_OUTPUT=$(curl --silent --show-error --max-time 10 \ --proto '=http,https' \ --write-out "%{http_code}|%{time_total}" \ --output /dev/null \ -- "$URL" 2>&1) ``` The scheme check alone does not prevent SSRF. Destination IP validation should also be performed, including after DNS resolution and any redirect. ]]>
