T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:116
- Finding
- Shell Command Injection Through Unescaped Calendar Data<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 116-118, 130-138, and 153 **Vulnerability Type**: Shell command injection through unsafe interpolation **Risk Level**: High ### Vulnerable Code ```sh gcalcli --nocolor --calendar "<Cal>" add --noprompt --title "<Title>" --when "<Start>" --duration <minutes> gcalcli --nocolor --calendar "<Cal>" add --noprompt --allday --title "<Title>" --when "<Date>" ``` ```sh echo 'BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT DTSTART;VALUE=DATE:20260308 SUMMARY:Event Title RRULE:FREQ=YEARLY TRANSP:TRANSPARENT END:VEVENT END:VCALENDAR' | gcalcli import --calendar "<Cal>" ``` ```sh gcalcli --nocolor delete --iamaexpert "<query>" <start> <end> ``` ### Technical Analysis The Skill directs the agent to interpolate calendar names, event titles, dates, search queries, durations, and generated ICS content into shell command strings. It does not require argument-array execution, strict input validation, or shell-safe escaping. Double quotes do not neutralize all shell syntax. If a dynamic value contains a double quote followed by shell operators, it may terminate the intended argument and append another command. The multiline `echo` pattern is also unsafe when generated ICS data contains a single quote, because that character can terminate the shell's single-quoted string. The risk applies to values supplied directly by a user and potentially to text retrieved from calendar events and later reused in commands. Whether exploitation succeeds depends on the execution tool invoking these templates through a shell. If commands are executed as structured argument arrays without shell parsing, the shell-injection path is prevented. The ICS template has an additional data-integrity concern: dynamically generated text fields should be escaped according to RFC 5545, independently of shell escaping. ### Attack Path 1. An attacker supplies an event title, calendar name, or deletion query containing quote-breaking charact ...[truncated 1344 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require execution through a structured process API that accepts an executable and argument array, without invoking a shell. For example, pass `gcalcli`, `--calendar`, the calendar name, and other values as separate arguments. 2. Explicitly prohibit constructing shell command strings from user-controlled or calendar-derived data. 3. If shell execution is unavoidable, apply robust, platform-specific shell escaping to every dynamic argument. Simple quote replacement is insufficient. 4. Replace the `echo '...' | gcalcli import` pattern with direct stdin delivery through the process execution API. 5. Escape dynamic ICS properties according to RFC 5545, including backslashes, commas, semicolons, and line breaks where applicable. 6. Validate numeric durations with a strict integer allowlist or range. 7. Parse and validate dates and times before execution rather than accepting arbitrary shell text. 8. Treat calendar names, event titles, search terms, and existing event content as untrusted input, even when they originate from Google Calendar rather than the current user. ]]>
