T09 · Insecure Skill Coding Practices
- Location
tools.json:7- Finding
Shell Command Injection Through Bash Tool Templates
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill’s gift-customization purpose is coherent, but its tool wiring and endpoint controls create real review-level risks around command execution and credential/file exposure.
Install only if you trust the publisher and can run it in a constrained environment. Use dedicated Leewow and Feishu credentials with minimal permissions, avoid passing untrusted text into tool parameters, do not allow arbitrary Feishu or Leewow API base URLs, and keep sensitive files outside any path the skill can upload or follow through symlinks.
tools.json:7Shell Command Injection Through Bash Tool Templates
scripts/feishu_direct.py:200Feishu App Credentials Can Be Exfiltrated to a Caller-Controlled Endpoint
scripts/generate.py:40Workspace Path Validation Can Be Bypassed to Upload Files Outside the Workspace
scripts/get_status.py:204Unrestricted Remote Image Fetching Enables SSRF and Resource Exhaustion
The STS credential endpoint is built from an environment variable and then fetched without any allowlist, scheme validation, or host verification. If an attacker can influence LEEWOW_API_BASE, they can redirect the request to an attacker-controlled server, causing the code to trust forged temporary cloud credentials and upload files to attacker-controlled storage or leak operational metadata via SSRF-style outbound requests.
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 skill's stated role is customization assistance, but the described behavior includes fetching arbitrary remote image URLs, reading local files, uploading content to Feishu, and caching image metadata locally. This combination creates clear data-exfiltration and SSRF-style risk: an agent could be induced to read local images or retrieve attacker-controlled remote content and relay it into external messaging channels.
The skill's stated role is customization assistance, but the described behavior includes fetching arbitrary remote image URLs, reading local files, uploading content to Feishu, and caching image metadata locally. This combination creates clear data-exfiltration and SSRF-style risk: an agent could be induced to read local images or retrieve attacker-controlled remote content and relay it into external messaging channels.
The skill is coded to access a local ~/.openclaw/.env file, which is a credential/configuration source outside the immediate function's declared inputs. In a multi-skill or shared workstation environment, this creates an unauthorized credential access pattern and can expose secrets unrelated to browsing templates.
from pathlib import Path
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 existence check and subsequent read of ~/.openclaw/.env confirms intentional access to a shared secret store rather than narrowly scoped input parameters. In the context of an agent skill that also spawns child processes and performs external network actions, broad local secret access is especially dangerous because it can feed into exfiltration or unintended propagation paths.
# 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:
Using os.environ.copy() clones the entire current environment into the child process, potentially including unrelated API keys, tokens, and local secrets loaded earlier from ~/.openclaw/.env. This is a classic over-broad credential propagation issue that expands the blast radius of any subprocess compromise or diagnostic exposure.
)
batch_file = handle.name
child_env = os.environ.copy()
child_env["FEISHU_APP_ID"] = app_id
child_env["FEISHU_APP_SECRET"] = app_secret
child_env["FEISHU_RECEIVE_ID"] = receive_id
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import json
import os
# 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 advertises and documents capabilities that involve shell execution, filesystem access, environment-variable use, and network operations, yet it declares no explicit tool scope or permission boundaries. This makes the skill over-privileged by default and increases the chance that an agent can invoke sensitive operations such as reading workspace files, using secrets, cloning repositories, or sending data to external services without clear policy constraints.
The 'When to Use' section includes generic phrases such as 'gift ideas', 'create something personalized', and 'customize this design', which overlap with common conversation and are not tightly scoped to this specific skill. The file does not provide negative examples or explicit exclusion conditions to reduce accidental activation.
The skill automatically reads ~/.openclaw/.env and imports any key/value pairs into its environment, even though that file may contain unrelated secrets for other skills or services. This broad credential loading violates least privilege and can expose sensitive local configuration to code paths in this skill or its child processes.
The browse flow schedules continued outbound messaging in a detached subprocess after the main function returns. In an agent-skill context, background actions that continue after the triggering request can surprise users, bypass normal oversight, and make abuse or accidental over-sending harder to detect.
The code writes a JSON batch file to disk containing recipient identifiers and card contents before sending them later. Persisting message data to a workspace directory without access controls, encryption, or user disclosure can leak private content and metadata to other local processes or users on the host.
Feishu app credentials and recipient metadata are copied into the child process environment, which may be visible to local inspection tools, crash reports, or unrelated descendant code. In this skill, that risk is amplified because the subprocess is detached and opaque, reducing visibility into how long the credentials remain available.
The code launches a detached subprocess to continue sending Feishu cards in the background. Although it does not invoke a shell and uses a fixed executable/argument list, it creates an execution path that persists beyond the user-visible action, suppresses stdout/stderr, and relies on inherited runtime state, which increases stealth and reduces auditability if abused or if upstream inputs are compromised.
child_env["FEISHU_RECEIVE_ID_TYPE"] = receive_id_type
child_env["FEISHU_OPEN_BASE"] = domain
subprocess.Popen(
[sys.executable, os.path.abspath(__file__), "--send-card-batch-file", batch_file],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
This Python file is in scope for SQP-3, which applies to all file types. The hardcoded subtitles and fallback description are written in Chinese while the surrounding renderer output is otherwise English, and there is no user opt-in, locale selection, or justification for enforcing that language.
This code fetches temporary credentials from a remote endpoint and uploads a local file to cloud object storage, which can transmit user or system data off-host. There is no confirmation prompt, print/log statement, or inline comment/docstring in the upload function warning that local files will be sent to external services.
This function uploads arbitrary local files to cloud object storage and returns a public URL, which can become an exfiltration path if untrusted input can control file_path or invoke the uploader on sensitive files. In a customization skill that handles user images this behavior is expected, but it is still dangerous because the code applies no path restrictions, file-type validation beyond extension-based content type, or access control checks at this layer.
}.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}"
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
return self._token
def _send_message(self, payload: dict[str, Any]) -> dict[str, Any]:
response = requests.post(
f"{self.domain}/open-apis/im/v1/messages",
params={"receive_id_type": self.receive_id_type},
headers={
The helper accepts an arbitrary image_ref and, if it is not a local file, performs requests.get(image_ref) to any URL. That gives the skill general outbound network reach and can be abused for SSRF-style access to internal services, metadata endpoints, or other unintended hosts before relaying content onward to Feishu.
Remote image URLs are fetched server-side and then uploaded to Feishu without any visible consent, warning, or policy gate. In this skill context, that is risky because user-provided or tool-provided URLs may cause unintended third-party data transfer and conceal the fact that the service is retrieving external content on the operator's behalf.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
with self._lock:
if self.token:
return self.token
response = requests.post(
f"{self.domain}/open-apis/auth/v3/tenant_access_token/internal",
json={"app_id": self.app_id, "app_secret": self.app_secret},
timeout=30,
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
with self._lock:
if self.token:
return self.token
response = requests.post(
f"{self.domain}/open-apis/auth/v3/tenant_access_token/internal",
json={"app_id": self.app_id, "app_secret": self.app_secret},
timeout=30,