T09 · Insecure Skill Coding Practices
- Location
workflows/text-to-design.md:19- Finding
User-Controlled Prompt Interpolation into Shell Command Templates
- Content
View full analysis
Vulnerability Details
File Location:
workflows/text-to-design.md:19-21,workflows/edit-design.md:23-31, andworkflows/variants.md:19-21
Vulnerability Type: Shell command injection through unsafe handling of user-derived arguments
Risk Level: HighAffected code snippets:
workflows/text-to-design.md:19-21bash cd "${STITCH_STARTER_ROOT:-$HOME/.agents/stitch-starter}" npm run generate -- --prompt "..." [--project-id ...] [--device DESKTOP]workflows/edit-design.md:23-31bash cd "${STITCH_STARTER_ROOT:-$HOME/.agents/stitch-starter}" npm run edit -- --prompt "..."Or target a specific screen:
bash cd "${STITCH_STARTER_ROOT:-$HOME/.agents/stitch-starter}" npm run edit -- --project-id ... --screen-id ... --prompt "..."workflows/variants.md:19-21bash cd "${STITCH_STARTER_ROOT:-$HOME/.agents/stitch-starter}" npm run variants -- --prompt "..." --variant-count 3Technical Analysis
These workflows direct the agent to derive a prompt from user-controlled content and substitute it into shell command templates. They do not require a non-shell process API, strict argument validation, a safe prompt-input file, or robust shell escaping.
Enclosing a substituted value in double quotes is not sufficient protection when a command is interpreted by a shell. Shell constructs such as command substitution, backticks, embedded quote termination, and certain expansions can still be evaluated if the agent constructs the final command as text. The project and screen identifiers shown in the edit and generation templates are likewise not subject to documented validation.
This is an instruction-level unsafe coding pattern rather than evidence that the repository itself contains an active malicious payload. Exploitability depends on the invoking agent replacing the placeholders with untrusted values and executing the assembled command through a shell.
Atta
...[truncated 1619 chars]
- Remediation
View remediation
Remediation Suggestions
- Invoke the CLI through a process execution API that accepts an executable and an argument array, with shell processing explicitly disabled. For example, pass
npm,run,generate,--,--prompt, and the prompt as separate arguments rather than constructing one command string. - Do not use
exec,sh -c,bash -c, or equivalent shell-evaluated command strings for user-derived prompts. - If the agent environment only supports shell execution, write the prompt to a securely created temporary file and update the toolkit to accept a
--prompt-fileoption. Use restrictive file permissions and delete the file after use. - Validate
project-idandscreen-idvalues with strict allowlists appropriate to the Stitch API. Reject whitespace, shell metacharacters, option prefixes, path separators, and values outside the expected format. - Use an explicit allowlist for
--device,--creative-range, and--aspects. - Add workflow instructions stating that user content must never be directly interpolated into shell command text.
- Run the toolkit under a least-privileged account and restrict read access to
.envso unrelated processes and users cannot access the API key. - Add security tests containing quotes, backticks,
$(), semicolons, newlines, and option-injection payloads to confirm that all supplied text is delivered as a single literal argument.
- Invoke the CLI through a process execution API that accepts an executable and an argument array, with shell processing explicitly disabled. For example, pass
