T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:63
- Finding
- Command Injection Through Unsafe User-Controlled Value Interpolation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 63–66; the same unsafe pattern also appears at lines 111–138 and 158–170. **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: High ### Vulnerable Code ```bash LYRICS_RESP=$(curl -s -X POST "https://api.senseaudio.cn/v1/song/lyrics/create" \ -H "Authorization: Bearer $SENSEAUDIO_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"prompt\": \"<PROMPT>\", \"provider\": \"sensesong\"}") ``` Additional affected code includes: ```bash SONG_A=$(curl -s -X POST "https://api.senseaudio.cn/v1/song/music/create" \ -H "Authorization: Bearer $SENSEAUDIO_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"model\": \"sensesong\", \"lyrics\": \"<LYRICS>\", \"title\": \"<品牌名> Jingle\", \"vocal_gender\": \"<f|m>\", \"style\": \"<STYLE>, short jingle, 5-15 seconds, brand audio logo\", \"negative_tags\": \"long intro, extended outro, complex arrangement\" }") TASK_A=$(echo $SONG_A | jq -r '.task_id') ``` ```bash SONG_B=$(curl -s -X POST "https://api.senseaudio.cn/v1/song/music/create" \ -H "Authorization: Bearer $SENSEAUDIO_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"model\": \"sensesong\", \"instrumental\": true, \"title\": \"<品牌名> Jingle Instrumental\", \"style\": \"<STYLE>, short jingle, 5-15 seconds, brand audio logo\", \"negative_tags\": \"vocals, long intro, extended outro\" }") TASK_B=$(echo $SONG_B | jq -r '.task_id') ``` ```bash curl -s -X POST https://api.senseaudio.cn/v1/t2a_v2 \ -H "Authorization: Bearer $SENSEAUDIO_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"model\": \"SenseAudio-TTS-1.0\", \"text\": \"<品牌名>\", \"stream\": false, \"voice_setting\": { \"voice_id\": \"<VOICE_ID_MATCHING_TONE>\", \"speed\": 0.9 }, \"audio_setting\": { \"format\": \"mp3\" } }" -o brand_name.json ``` ### Technical Analysis The Skill instructs ...[truncated 2136 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Do not insert user-controlled text into generated shell source or manually escaped JSON strings. 1. Store each user-derived value in a shell variable without evaluating it as code. 2. Construct all JSON request bodies with `jq -n --arg` or a language-native JSON serializer. 3. Pass the resulting payload to `curl` using `--data-binary`. 4. Validate allowed values for enumerated fields such as vocal gender, voice ID, and output format. 5. Avoid `eval`, shell re-parsing, or any textual replacement that turns user data into executable shell syntax. 6. Use `curl --fail-with-body -sS` so HTTP failures are handled explicitly. 7. Run the Skill with a minimally privileged account and expose only the credential required for the current operation. A safer pattern is: ```bash payload=$(jq -n \ --arg prompt "$PROMPT" \ '{prompt: $prompt, provider: "sensesong"}') curl --fail-with-body -sS \ -X POST "https://api.senseaudio.cn/v1/song/lyrics/create" \ -H "Authorization: Bearer $SENSEAUDIO_API_KEY" \ -H "Content-Type: application/json" \ --data-binary "$payload" ``` Apply the same construction method independently to the lyrics, music, and text-to-audio requests. ]]>
