T09 · Insecure Skill Coding Practices
- Location
skill.yaml:6- Finding
Shell Command Injection Through Unquoted PCAP Path
- Content
View full analysis
Vulnerability Details
File Location:
skill.yaml, line 6
Vulnerability Type: OS command injection through unsafe template interpolation
Risk Level: HighVulnerable Code
yaml command: run: /home/tom/openclaw-tools/pcap_summary.sh {{pcap_path}}Technical Analysis
The required
pcap_pathinput is inserted directly into a command string without shell-safe quoting or argument-array separation. If the Skill runtime evaluates therunfield through a command shell, shell metacharacters contained in the input will be interpreted as syntax rather than as part of a file path.An attacker who can control
pcap_pathmay include separators, command substitutions, redirections, or pipelines. For example, a value structurally equivalent to:text /tmp/capture.pcap; attacker_commandcould produce the following effective shell command:
bash /home/tom/openclaw-tools/pcap_summary.sh /tmp/capture.pcap; attacker_commandThe bundled
scripts/analyze.shquotes"$PCAP"when invoking tools, butskill.yamlbypasses that script and invokes the external summarizer directly. Consequently, the safer argument handling in the bundled script does not mitigate the command-template vulnerability.Attack Path
- An attacker supplies or persuades the user to supply a crafted
pcap_pathcontaining shell syntax. - The runtime substitutes the value into the unquoted
command.runtemplate. - If the runtime executes that command through a shell, the shell parses the injected syntax.
- The legitimate summarizer is invoked, followed by or combined with the injected command.
- The injected command executes with the privileges and filesystem access of the Skill runner.
Impact Assessment
Successful exploitation permits arbitrary command execution in the Skill runner's security context. The attacker could read or alter files available to that account, access environment variab ...[truncated 276 chars]
- An attacker supplies or persuades the user to supply a crafted
- Remediation
View remediation
Remediation Suggestions
- Do not construct shell commands by concatenating or directly interpolating user input.
- Configure the Skill runtime to invoke the executable with an argument array, keeping the executable and
pcap_pathin separate argv elements. - If the framework supports only command strings, use its documented shell-escaping mechanism rather than relying on manual quoting.
- Change the entry point to the bundled script and preserve argument boundaries, for example by passing the PCAP path as one quoted argument.
- Resolve the submitted path to a canonical path and verify that it identifies an existing regular file.
- Enforce an allowlist for supported
.pcapand.pcapngextensions as defense in depth. Extension checks must not replace safe argument handling. - Add automated tests using paths containing spaces, quotes, semicolons, command substitutions, redirections, and leading hyphens to confirm that every value is treated strictly as a filename.
