T09 · Insecure Skill Coding Practices
- Location
SKILL.md:34- Finding
Command Injection Through Unsafe Interpolation of User-Controlled Location Data
- Content
View full analysis
- Remediation
View remediation
&2; exit 2 ;; esac curl --fail --silent --show-error \ --proto '=https' \ --proto-redir '=https' \ --max-redirs 3 \ --get 'https://api.aladhan.com/v1/timingsByCity' \ --data-urlencode "city=$city" \ --data-urlencode "country=$country" \ --data-urlencode "method=$method" ``` User input stored in a shell variable is not recursively interpreted as shell syntax when the variable is expanded normally. The implementation must not use `eval`, `sh -c` with concatenated input, or equivalent dynamic execution. 3. **Validate structured fields.** - Restrict `method` to the documented numeric allowlist. - Require dates to match the expected format and verify that they are valid dates. - Parse latitude and longitude as finite decimal numbers and enforce ranges of `-90` to `90` and `-180` to `180`, respectively. - Reject NUL bytes, newlines, and other control characters in city and country values. 4. **Encode all query parameters.** Do not limit encoding to spaces. Apply standards-compliant percent encoding to every user-controlled query value. 5. **Reduce execution privileges.** Prefer a domain-restricted HTTP capability over general shell access. If shell execution cannot be eliminated, run it in a sandbox with minimal filesystem, environment, process, and network access. 6. **Clarify the Skill instructions.** Explicitly state that location values are untrusted and must never be directly interpolated into executable shell command strings. ]]>
