T09 · Insecure Skill Coding Practices
- Location
SKILL.md:24- Finding
Command Injection Through Unvalidated Time-Range Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 24-31
Vulnerability Type: OS command injection through user-controlled command arguments
Risk Level: HighVulnerable Code
text 1. To query notifications within a specified time range, use exec to execute: If the user does not provide the corresponding time, query notifications from yesterday to the current time: ```text command: openclaw ntf search --from start time --to end time yieldMs: 30000Example:
text command: openclaw ntf search --from 2026-03-01T00:00:00+08:00 --to 2026-03-09T23:59:59+08:00Technical Analysis
The skill instructs the agent to execute
openclaw ntf searchusing a time range that may originate from the user's request. It does not require strict ISO-8601 validation, define an allowlist of accepted characters, or require a shell-free argument-array execution interface.If the execution tool passes the constructed command through a command shell, shell metacharacters embedded in a malicious
--fromor--tovalue may be interpreted as command separators, substitutions, redirections, or pipelines rather than as part of the timestamp. This can permit arbitrary command execution under the identity and privileges of the agent process.Exploitability depends on the execution tool accepting a command string through a shell and on the agent inserting user-supplied values without safe encoding. The skill provides no controls that prevent this unsafe execution path.
Attack Path
- An attacker asks for a morning report over a deliberately crafted time range.
- The attacker places shell syntax in the supplied start or end time.
- Following the skill workflow, the agent inserts the supplied value into the
openclaw ntf search --from ... --to ...command. - A shell-backed
execimplementation interprets the injected syntax. - The attacker's additional command executes with the permissions of the ...[truncated 796 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse both time values with a strict ISO-8601 date-time parser before command execution. Reject invalid dates, trailing content, control characters, whitespace beyond the defined format, and shell metacharacters.
- Invoke the executable through a shell-free API using a fixed argument array, for example:
text ["openclaw", "ntf", "search", "--from", validatedStart, "--to", validatedEnd] - Do not concatenate user-controlled values into a command string. If the platform only supports string commands, apply robust platform-specific escaping and reject any input outside a narrowly defined timestamp allowlist.
- Generate omitted time values internally rather than accepting free-form replacements.
- Run the command with least privilege and restrict its filesystem, credential, and network access through sandboxing.
- Require confirmation or reject the request when a supplied time value cannot be normalized unambiguously.
- Add tests covering command separators, command substitution, quoting characters, redirection operators, newlines, and malformed timestamps.
