T09 · Insecure Skill Coding Practices
- Location
SKILL.md:14- Finding
Shell Command Injection Through Unsanitized Calendar Input
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 14, 23, 38, and 42
Vulnerability Type: Shell command injection caused by unsafe interpolation of user-controlled values
Risk Level: HighThe skill instructs the agent to insert user-provided dates, durations, event names, and search terms directly into shell command templates:
bash khal new "ДАТА ВРЕМЯ" "ДЛИТЕЛЬНОСТЬ" "НАЗВАНИЕ" && vdirsyncer syncbash khal search "текст для поиска"The same unsafe command construction is repeated in the bot instructions:
text **"Добавь встречу [дата] в [время]"** → Выполни: `khal new "ДАТА ВРЕМЯ" "ДЛИТЕЛЬНОСТЬ" "НАЗВАНИЕ" && vdirsyncer sync` → Примеры дат: "завтра 15:00", "2026-02-10 14:00" **"Найди событие про [тема]"** → Выполни: `khal search "тема"`Technical Analysis
Shell double quotes do not make arbitrary input safe. Command substitutions such as
$(command)and backtick substitutions may still be evaluated inside double-quoted strings. An attacker may also inject a double quote followed by shell operators to terminate the intended argument and introduce an additional command.For example, if a malicious event title is substituted into the documented template as:
text $(id)the resulting shell command may evaluate
idbefore invokingkhal. A payload that closes the quote and introduces shell operators could similarly execute an independent command. Search terms are exposed to the same issue.Exploitation depends on the agent constructing a command string from the template and executing it through a shell. The skill provides no validation, escaping, argument-array invocation requirement, or rejection rules for shell metacharacters.
Attack Path
- An attacker asks the agent to create or search for a calendar event containing a crafted title, date, duration, or search term.
- The agent places the attacker-controlled text into on ...[truncated 1121 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not build shell command strings by concatenating or interpolating user input.
- Invoke
khalandvdirsyncerthrough an API that accepts an executable and a separate argument array, with shell processing disabled. - Validate dates and times against strict accepted formats and parse them before invocation.
- Restrict durations to an allowlist or a strict pattern such as positive integers followed by an approved unit.
- Pass event titles and search terms as literal arguments. Do not attempt to rely solely on shell quoting.
- If a shell is unavoidable, apply a well-tested shell-escaping library to every dynamic argument and reject control characters, command substitutions, quote-breaking input, and shell operators.
- Require explicit user confirmation before creating or modifying calendar events.
- Execute calendar operations under a least-privileged account with access only to the required calendar configuration and data.
- Update the skill instructions to prescribe safe structured tool invocation rather than executable command templates containing placeholders.
