T09 · Insecure Skill Coding Practices
- Location
SKILL.md:40- Finding
Potential Shell Command Injection Through Unquoted Command Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 40–60
Vulnerability Type: Shell command injection caused by unsafe parameter interpolation
Risk Level: HighVulnerable Code
bash pilotctl --json publish <target-hostname> <topic> --data <payload>bash pilotctl --json subscribe <target-hostname> <topic> [--timeout <seconds>]bash pilotctl --json find <hostname>bash pilotctl --json handshake <hostname> "reason for trust request"Technical Analysis
The documented command templates place dynamic hostnames, topics, payloads, and timeout values directly into shell commands without demonstrating shell-safe quoting or validation. If an agent substitutes an attacker-controlled value into one of these templates, shell metacharacters such as semicolons, redirections, command substitutions, or pipeline operators may be interpreted by the shell before
pilotctlreceives the arguments.For example, a malicious hostname containing a command separator could cause an additional command to execute if it is inserted verbatim into the template. Payload values present additional risk because event data may originate from external agents or other untrusted workflow inputs.
Exploitation depends on the calling agent constructing the Bash command through direct textual interpolation. Passing arguments without a shell or using correctly quoted variables would prevent this attack.
Attack Path
- An attacker controls or influences a hostname, topic, payload, or timeout supplied to the skill.
- The attacker includes shell syntax or command substitution in that value.
- The agent inserts the value verbatim into one of the documented Bash command templates.
- Bash interprets the injected syntax before invoking
pilotctl. - The injected command executes with the operating-system privileges of the agent process.
I
...[truncated 468 chars]
- Remediation
View remediation
Remediation Suggestions
- Store every dynamic value in a variable and quote each expansion:
bash pilotctl --json publish "$target_hostname" "$topic" --data "$payload" - Prefer direct process invocation with an argument array rather than constructing a shell command string.
- Apply strict allowlist validation:
- Hostnames should contain only permitted DNS hostname characters.
- Topics should conform to the documented dotted topic syntax.
- Timeouts should contain digits only and be constrained to a reasonable range.
- Reject control characters, newlines, shell metacharacters, and unexpected option prefixes where they are not explicitly allowed.
- Use
--before positional arguments ifpilotctlsupports an end-of-options delimiter. - Treat all values received from remote agents or event payloads as untrusted input.
- Add negative tests using values containing semicolons, command substitutions, redirections, newlines, and leading hyphens.
- Store every dynamic value in a variable and quote each expansion:
