T09 · Insecure Skill Coding Practices
- Location
SKILL.md:66- Finding
Shell Command Injection Through Interpolated Voice-Reply Text
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 66–72
Vulnerability Type: Shell command injection
Risk Level: HighVulnerable Code
bash ## Chat voice responses When Peter asks for a "voice" reply (e.g., "crazy scientist voice", "explain in voice"), generate audio and send it: # Generate audio file sag -v Clawd -o /tmp/voice-reply.mp3 "Your message here"Technical Analysis
The documented command encourages the Agent to replace
"Your message here"with generated or user-controlled text inside a double-quoted shell argument. Double quotes prevent ordinary word splitting but do not disable command substitution, backtick substitution, or variable expansion.If untrusted text is inserted directly into this command, input such as
$(command)or a backtick expression can be evaluated by the shell beforesagstarts. The resulting spoken text does not need to be maliciously interpreted bysag; execution occurs in the command shell itself.The vulnerability is therefore not limited to malformed audio generation. It can turn a voice-reply request into arbitrary local command execution under the identity and permissions of the Agent process.
Attack Path
- An attacker requests a voice response and supplies text containing a shell substitution expression, such as
$(malicious-command). - The Agent follows the documented template and places the supplied text between the command's double quotes.
- The Agent executes the assembled command through a shell.
- The shell evaluates the substitution expression before invoking
sag. - The injected command runs with the Agent's operating-system privileges.
sagthen receives the substitution output as part of its text argument, potentially concealing the underlying execution.
Impact Assessment
Successful exploitation provides command execution with the same privileges as the Agent or user running the Skill. Depending o ...[truncated 290 chars]
- An attacker requests a voice response and supplies text containing a shell substitution expression, such as
- Remediation
View remediation
Remediation Suggestions
- Do not construct the
sagcommand by interpolating untrusted text into a shell command string. - Invoke
sagthrough an argument-array or direct process-execution API where the message is passed as one literal argument without shell parsing. - If
sagsupports reading text from standard input or a file, use that interface with a securely created, user-private temporary file. - If shell execution is unavoidable, apply a well-tested shell-escaping function appropriate to the exact shell. Do not rely on double quotes as an escaping mechanism.
- Reject or safely encode control characters and ensure the output path is generated securely.
- Update the documentation with a safe implementation example and explicitly state that user-provided text must never be concatenated into a shell command.
- Do not construct the
