T09 · Insecure Skill Coding Practices
- Location
SKILL.md:18- Finding
User-Controlled Message Content Embedded in a Shell Heredoc
- Content
View full analysis
To: Subject: EOF ``` ``` ### Technical Analysis The workflow collects recipient, subject, and body values from user-controlled input and directs the Agent to interpolate them into a shell heredoc. The heredoc uses the fixed delimiter `EOF`. Quoting the delimiter as `'EOF'` disables shell expansion within the heredoc content, but it does not prevent a line containing exactly `EOF` from terminating the heredoc. If an attacker includes such a line in the message body, the resulting generated shell script can close the heredoc prematurely. Text following the injected delimiter is then parsed as shell syntax rather than email content. For example, a malicious body could conceptually contain: ```text Routine notification EOF id > /tmp/heredoc-command-executed # ``` When this content is substituted for ``, the first attacker-controlled `EOF` ends the heredoc. The following command is consequently processed by the shell. The fixed closing delimiter later in the generated command may produce an error, but only after the injected command has had an opportunity to execute. The `To` and `Subject` fields are also inserted into an RFC 5322 message without validation. If either value contains carriage-return o ...[truncated 2016 chars]- Remediation
View remediation
