T09 · Insecure Skill Coding Practices
- Location
SKILL.md:53- Finding
Shell Command Injection Through Unsafe Interpolation of User-Controlled JSON Fields
- Content
View full analysis
", "name":"", "creator":"", "symbol":"", "timeframe":"", "direction":"", "leveragePreference":"", "weeklyEvolution":, "strategyBrief":"", "persona":"" }' ``` ### Technical Analysis The skill instructs the agent to build a shell command by placing submission values into a single-quoted JSON argument passed to `curl`. Several placeholders—including `name`, `creator`, `symbol`, `timeframe`, `strategyBrief`, `persona`, and `pairCode`—can originate from user-controlled input. Single quotes prevent ordinary shell expansion only while the supplied value remains inside the quoted argument. If a value itself contains a single quote, it can terminate the surrounding shell string. Subsequent shell metacharacters can then be interpreted as commands or operators rather than JSON data. The instructions do not require use of a JSON serializer, validation of control characters, safe shell escaping, or an HTTP API that accepts structured parameters. Consequently, an implementation that directly substitutes user values into this documented command can create a command-injection primitive. This is distinct from ordinary malformed JSON: the dangerous parsing occurs in the local shell before `curl` sends the request. ### Attack Path 1. An attacker provides a malicious value for one of the free-text submission fields, such as `strategyBrief`, `name`, or `persona`. 2. The supplied value contains a single quote that closes the shell's `-d` argument, followed by ...[truncated 1749 chars]- Remediation
View remediation
"$payload_file" curl --fail-with-body --silent --show-error \ -X POST 'https://app.miraix.fun/api/agent-arena/register' \ -H 'Content-Type: application/json' \ --data-binary "@$payload_file" ``` 4. **Avoid `sh -c`, `bash -c`, `eval`, or equivalent shell evaluation.** Invoke programs with an argument array whenever the runtime supports it. 5. **Validate constrained fields with allowlists.** Enforce the documented values for `direction` and `leveragePreference`; validate expected formats and lengths for pair codes, symbols, timeframes, and names. Validation should supplement—not replace—safe serialization. 6. **Apply reasonable input-size limits.** Limit free-text fields such as `s ...[truncated 533 chars]
