T09 · Insecure Skill Coding Practices
- Location
SKILL.md:40- Finding
Shell Command Injection Through Unsafe Placeholder Interpolation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:40-54, with additional affected command templates atSKILL.md:61-67,SKILL.md:74-75,SKILL.md:82-84,SKILL.md:103-107, andSKILL.md:126-152
Vulnerability Type: Shell command injection
Risk Level: MediumVulnerable Code
bash mkdir -p {OUTPUT_DIR}/screenshots {OUTPUT_DIR}/videosbash cp {SKILL_DIR}/templates/dogfood-report-template.md {OUTPUT_DIR}/report.mdbash agent-browser --session {SESSION} open {TARGET_URL} agent-browser --session {SESSION} wait --load networkidleAdditional affected examples include:
bash agent-browser --session {SESSION} fill @e1 "{EMAIL}" agent-browser --session {SESSION} fill @e2 "{PASSWORD}" agent-browser --session {SESSION} state save {OUTPUT_DIR}/auth-state.json agent-browser --session {SESSION} screenshot --annotate {OUTPUT_DIR}/screenshots/initial.png agent-browser --session {SESSION} record start {OUTPUT_DIR}/videos/issue-{NNN}-repro.webmTechnical Analysis
The Skill instructs an agent to interpolate user-supplied or dynamically generated values directly into Bash commands. Variables such as
TARGET_URL,OUTPUT_DIR,SESSION,EMAIL,PASSWORD, and generated file names are not subject to a documented validation or shell-safe escaping process.Several placeholders are entirely unquoted. Consequently, whitespace, shell separators, redirection operators, command substitutions, and other metacharacters may be interpreted as shell syntax rather than literal argument content.
Double quotes around credential placeholders do not provide complete protection. If an interpolated value contains a double quote, command substitution, or backticks, it may terminate or alter the intended shell argument. The underlying issue is constructing shell command text from untrusted values instead of passing arguments through a structured process-execution interface.
Attack Pa
...[truncated 1548 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not construct Bash command strings by directly interpolating user-controlled data.
- Invoke
agent-browserand filesystem operations through APIs that accept structured argument arrays without invoking a shell. - If shell execution is unavoidable, apply robust shell escaping to every substituted value and place every path and argument in quotes.
- Validate parameters using strict allowlists:
- Accept only
httpandhttpsURLs parsed by a URL library. - Restrict session names and generated page names to a conservative pattern such as
[A-Za-z0-9._-]+. - Resolve output paths and require them to remain inside an approved base directory.
- Reject control characters, shell metacharacters, traversal segments, and unexpected newlines.
- Accept only
- Treat credentials as opaque secrets and never interpolate them into shell command text.
- Add explicit Skill instructions prohibiting execution when a supplied value cannot be represented safely.
- Add tests covering spaces, quotes, semicolons, pipes, redirection operators, command substitutions, newlines, and path traversal.
