T09 · Insecure Skill Coding Practices
- Location
SKILL.md:116- Finding
Shell Command Injection Through Unquoted User-Controlled Configuration Values
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 116–143 and 276–299
Vulnerability Type: Command injection through unsafe shell-command construction
Risk Level: HighVulnerable Code
The skill instructs the agent to retain an API key without validation:
text ### 4b. `API_KEY` (OPTIONAL) > (CN) API Key 是什么?服务没开认证就直接说"没有"。 > (EN) What's the API Key? Say "none" if the server has no auth. - "no" / "none" / "没有" / "空" / empty → `API_KEY=""` (you will skip the flag later). - Otherwise store as-is.It subsequently inserts collected values into shell-command templates:
bash npx -y openclaw-openviking-setup-helper@latest --base-url BASE_URL [--api-key API_KEY] [--agent-prefix AGENT_PREFIX] [--account-id ACCOUNT_ID] [--user-id USER_ID]The documented flag-construction rules are:
text - Always pass `--base-url BASE_URL`. - Pass `--api-key API_KEY` only if `API_KEY` is non-empty. - Pass `--agent-prefix AGENT_PREFIX` only if the user gave one. - `--account-id` / `--user-id` only if the root-key path requires them.Technical Analysis
BASE_URL,API_KEY,ACCOUNT_ID, andUSER_IDcan originate from user input. The API key is explicitly stored “as-is,” while no strict character validation is specified for the account or user identifiers. Although the URL receives basic normalization, the instructions only require anhttp://orhttps://prefix and do not reject shell metacharacters.These values are then represented as direct substitutions in a shell command. The skill does not require use of an argument-array execution API, shell escaping, or platform-specific safe quoting. If the implementing agent constructs a command string as shown and sends it to a shell, metacharacters in a supplied value can terminate or alter the intended command.
Validation of
AGENT_PREFIXdoes not protect the other command arguments. Treating an API key as an opaque value is a ...[truncated 1463 chars]- Remediation
View remediation
Remediation Suggestions
- Execute programs through a tool API that accepts an executable and an argument array, with shell interpretation disabled. For example, pass
npx,-y, the package identifier,--base-url, and the URL as separate arguments. - Never build a shell command by concatenating user-controlled values.
- Validate
BASE_URLwith a proper URL parser. Permit only supported HTTP schemes, reject control characters, and explicitly define whether URL credentials, fragments, and unusual ports are allowed. - Define strict formats and length limits for
ACCOUNT_IDandUSER_ID, based on the actual OpenViking schema. - Treat API keys as opaque secrets but pass them only through safe argument arrays or, preferably, protected standard input or environment variables supported by the installer.
- If shell execution is unavoidable, apply platform-specific escaping using a well-tested library rather than handwritten quoting.
- Add explicit instructions prohibiting command-string substitution and test values containing spaces, quotes, semicolons, command substitutions, pipes, newlines, and Windows command separators.
- Avoid printing complete generated commands or subprocess output when it could disclose the API key.
- Execute programs through a tool API that accepts an executable and an argument array, with shell interpretation disabled. For example, pass
