T09 · Insecure Skill Coding Practices
- Location
tools.json:7- Finding
Shell Command Injection Through Unsafely Interpolated Tool Parameters
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill has a real custom-gift workflow, but its shell tool definitions and file-handling could expose local files or credentials if misused.
Review before installing. Use this only with non-sensitive images, because inputs are uploaded to Leewow/COS and previews are stored in ~/.openclaw/workspace. Do not expose this skill to untrusted tool parameters until the shell command templates are replaced with safe argument execution, workspace path checks resolve symlinks, and ~/.openclaw/.env loading is restricted to required Leewow variables only.
tools.json:7Shell Command Injection Through Unsafely Interpolated Tool Parameters
scripts/generate.py:36Workspace Containment Check Can Be Bypassed to Upload Arbitrary Readable Files
scripts/get_status.py:79Unsanitized Task Identifier Permits Path Traversal During Preview Storage
scripts/browse.py:14Skill Loads Unrelated Secrets From a Shared Environment File
The code builds the STS credential endpoint from an environment variable and then performs an unauthenticated outbound request to that host. If an attacker can influence LEEWOW_API_BASE, they can redirect the request to an attacker-controlled server, supply forged temporary cloud credentials, and cause subsequent uploads to be sent to attacker-chosen storage, enabling data exfiltration and SSRF-like behavior.
return _sts_cache
url = LEEWOW_API_BASE + STS_ENDPOINT
resp = requests.get(url, timeout=15)
resp.raise_for_status()
data = resp.json()
if not data.get("tmpSecretId"):
The documented purpose is gift preview generation, but the skill also exposes COS presigning behavior that can mint signed access URLs for private objects and optionally rewrite them to another domain. Undocumented storage-signing functionality expands the trust boundary and can be abused to access or distribute private content beyond what users would reasonably expect.
The skill description omits a clear warning that user images are uploaded to an external third-party service for AI generation. This creates a significant consent and privacy risk, especially for personal or sensitive images that users might assume remain local.
The explicit logic to load ~/.openclaw/.env constitutes credential access behavior because it reads a file commonly used to store API keys and secrets. In this skill, that access is not tightly scoped to a single required value and therefore creates unnecessary exposure of sensitive data from the user's home environment.
import sys
from urllib.parse import urlparse
# Load environment variables from ~/.openclaw/.env
def _load_env_file():
env_path = os.path.expanduser("~/.openclaw/.env")
if os.path.exists(env_path):
The code path beginning at the existence check for ~/.openclaw/.env is part of a credential-harvesting pattern: it conditionally opens a secret-bearing dotfile in the user's home directory. Even though the script does not exfiltrate the file directly, reading such a file for a browsing utility is over-privileged and increases the risk of accidental disclosure or misuse of unrelated secrets.
# Load environment variables from ~/.openclaw/.env
def _load_env_file():
env_path = os.path.expanduser("~/.openclaw/.env")
if os.path.exists(env_path):
with open(env_path, 'r') as f:
for line in f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import os
import sys
# Load environment variables from ~/.openclaw/.env
def _load_env_file():
env_path = os.path.expanduser("~/.openclaw/.env")
if os.path.exists(env_path):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Load environment variables from ~/.openclaw/.env
def _load_env_file():
env_path = os.path.expanduser("~/.openclaw/.env")
if os.path.exists(env_path):
with open(env_path, 'r') as f:
for line in f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Load environment variables from ~/.openclaw/.env
def _load_env_file():
env_path = os.path.expanduser("~/.openclaw/.env")
if os.path.exists(env_path):
with open(env_path, 'r') as f:
for line in f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
},
{
"name": "cos_presign_url",
"description": "Generate a presigned URL for accessing COS (Tencent Cloud Object Storage) images. Useful for private buckets or when images need temporary access tokens.",
"executor": "bash",
"command": "python3 scripts/cos_presign.py '{{cos_url}}' --expired {{expired}} --json",
"parameters": {
The skill declares capabilities that read environment variables, access local files, and make network requests, but it does not declare any explicit tool scope or allowed-tools boundary. This weakens least-privilege guarantees and makes it harder for the platform to constrain what the skill can access, especially since it handles secrets and user-supplied images.
The description does not clearly warn users that uploaded and generated images are stored in the local workspace. This is a privacy and data-handling issue because users may provide personal photos without understanding that copies will persist on disk.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
## When to Use
- User wants to **send a gift** or **create something personalized**
- User says "browse products", "show me what I can customize", "gift ideas"
- User provides an **image** and wants to turn it into a product
- User says "make this into a mug/bag/shirt", "customize this design"
The activation guidance is broad enough to trigger on generic shopping or gift-related language, which can cause the agent to invoke the skill without clear user intent. Because the skill uploads images externally and writes files locally, overbroad activation increases the chance of unintended data transfer or workspace side effects.
The file includes imperative example output in Chinese such as '告诉我你想选哪个,我来帮你生成效果图!' and later '你的定制效果图出来啦', without offering a language choice or stating that this is region-specific behavior. This can violate language/locale policy by nudging the agent toward a fixed language regardless of the user's preferences.
The script reads all key-value pairs from ~/.openclaw/.env into process environment variables, which is broader than the stated purpose of browsing product templates. Accessing a user-home dotfile can expose unrelated secrets to this skill and expands its privilege surface unnecessarily; if later code, dependencies, or errors leak environment data, those credentials could be compromised.
This code fetches STS credentials from a remote backend and uploads a local file to cloud object storage, which transmits user/system data off-host. There is no confirmation prompt, logging/print statement, or inline comment/docstring near the upload function warning that the specified local file will be sent to external services.
The function uploads an arbitrary local file path to remote cloud storage and returns a public URL, which creates a direct exfiltration primitive. In this skill context, automatic download/upload of user-provided images is expected, but without path restrictions or provenance checks, any accessible local file could be sent off-platform if higher-level controls fail or are bypassed.
}.get(ext.lower(), "application/octet-stream")
with open(file_path, "rb") as fp:
client.put_object(Bucket=bucket, Body=fp, Key=key, ContentType=content_type)
return f"https://{bucket}.cos.{region}.myqcloud.com/{key}"
The script uploads a user-provided image to remote object storage and then sends that URL to an external API, but the script itself provides no explicit disclosure or consent checkpoint before transmission. In a skill that handles local user files, silent exfiltration to third-party services creates privacy and compliance risk, especially if users may assume processing is local.
The returned status text is hardcoded in Chinese and the embedded instructions dictate exact user-facing message content and formatting. This enforces a specific language/locale choice without offering the user an option or documenting a justified locale restriction.
The script emits embedded agent instructions in natural language that tell a downstream AI exactly how to handle attachments and messaging. This creates a prompt-injection/control-channel risk: untrusted tool output can steer agent behavior outside normal policy enforcement, especially if the caller treats tool stdout as authoritative instructions.
The completed-status message is hardcoded in Chinese, including the purchase prompt and follow-up text, with no indication that the user can choose a language or that the skill is intentionally limited to a Chinese-speaking context. This matches the locale-policy violation category because it imposes a specific language in natural-language output.
The skill metadata describes product browsing, preview generation, and status checking, but the manifest also exposes a separate URL-signing capability for Tencent COS. That capability can mint shareable access links to otherwise private objects and expands the skill's authority beyond the stated gift-generation purpose, creating a hidden data-access path users may not expect.
Generating presigned COS URLs is not justified by the stated custom-gift browsing and mockup flow, which already returns localImagePath and purchaseUrl through other tools. An unnecessary signing primitive increases attack surface by allowing the agent to expose private storage objects through temporary public links unrelated to the user's requested gift preview.
The tool explicitly advertises generating temporary access for private COS images but provides no warning that the resulting URL is a shareable bearer token that can expose private content to anyone who receives it. In a skill handling uploaded user images and generated previews, that omission can lead to inadvertent disclosure of user content.
The functions perform outbound network calls using requests.get and requests.post and attach authentication headers derived from the secret key, but there is no confirmation prompt, logging, or user-facing warning in these functions about transmitting signed request metadata. For code files, network calls that transmit user or system data should include some form of disclosure unless clearly covered elsewhere; this file only contains technical docstrings, not a user warning.