T09 · Insecure Skill Coding Practices
- Location
search.sh:48- Finding
Unsanitized Remote Content Can Inject Terminal Control Sequences
- Content
View full analysis
/dev/null || echo "$RESPONSE" ``` ### Technical Analysis The script treats fields returned by the remote SkillsMP API as trusted terminal text. Values such as `name`, `description`, `author`, and `skillUrl` are decoded from JSON and printed without filtering control characters. JSON escape sequences such as `\u001b` are converted into actual escape bytes by `json.load`. If a marketplace record or API response contains ANSI terminal control sequences, printing these fields can cause the user's terminal emulator to interpret them rather than display them literally. The error fallback creates an additional exposure because `echo "$RESPONSE"` writes the complete, untrusted response directly to the terminal when the Python command fails. This fallback does not require the response to be valid JSON. This is a display-layer injection issue. The reviewed code does not establish ...[truncated 1467 chars]- Remediation
View remediation
&2 exit 1 } ``` 3. Avoid suppressing all Python diagnostics with `2>/dev/null`. Log a controlled diagnostic message so parsing failures can be investigated without exposing raw, attacker-controlled content. 4. Consider an output mode that serializes data safely, such as JSON generated by a trusted encoder, for callers that do not require human-readable terminal output. 5. Add regression tests containing ANSI escape bytes, C0/C1 control characters, malformed JSON, and multiline marketplace fields to verify that no untrusted control characters reach terminal output. ]]>
