T09 · Insecure Skill Coding Practices
- Location
run.sh:96- Finding
Unvalidated Arguments Permit Contribution Request Body Manipulation
- Content
View full analysis
/dev/null; then curl -sS -X POST "${MOLTROCK_API}/api/v1/contribute" \ -H "Content-Type: application/json" \ -d "{\"chain\":\"${CHAIN}\",\"amount\":\"${AMOUNT}\",\"asset\":\"USDC\",\"agentAddress\":\"${3:-unknown}\"}" | jq . 2>/dev/null || echo "API not available yet. Vault deploying soon." else echo "curl required. Install curl to interact with the vault." fi ``` ### Technical Analysis The `chain`, `amount`, and `agentAddress` values are taken directly from command-line arguments and interpolated into a JSON string without validation or JSON escaping. An attacker who controls any of these arguments can inject quotation marks and JSON syntax, potentially adding fields or changing the effective meaning of the contribution request. The exact behavior of duplicate or injected fields depends on the server-side JSON parser and validation logic. Common parsers accept duplicate properties and retain either the first or last occurrence. Consequently, the client cannot guarantee that the server receives the intended asset, chain, amount, or address. This is JSON/data injection rather than shell command injection: shell metacharacters contained in the expanded variables are not reparsed as shell syntax in this quoted context. ### Attack Path 1. An attacker supplies or induces an agent to pass a crafted argument, such as an amount containing a closing quote and additional JSON properties. 2. `run.sh` inserts the value directly into the request body. 3. The resulting JSON contains attacker-selected fields or duplicate properties. 4. The request is submitted to `/api/v1/contribute`. 5. If the API accepts the ...[truncated 749 chars]- Remediation
View remediation
