T09 · Insecure Skill Coding Practices
- Location
get_live_url.py:77- Finding
Bearer Credential Exfiltration Through Unrestricted Gateway Configuration and Optional TLS Bypass
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches its stated device-live purpose, but it handles a sensitive API key from a shared persistent file and can send it to a configurable gateway with TLS verification disabled.
Review before installing. Use a least-privilege API key, keep AI_GATEWAY_VERIFY_SSL enabled, verify AI_GATEWAY_HOST is the intended trusted Closeli gateway, and ensure ~/.openclaw/.env is readable only by the intended OpenClaw service user. Avoid using this skill in environments where unrelated skills can modify the shared configuration file.
get_live_url.py:77Bearer Credential Exfiltration Through Unrestricted Gateway Configuration and Optional TLS Bypass
get_live_url.py:37Overbroad Parsing of a Shared Multi-Skill Credential File
The skill depends on a shared persistent credential file ~/.openclaw/.env containing AI_GATEWAY_API_KEY, and the document explicitly notes that all skills under the same user can read it. That creates a cross-skill credential exposure path where any compromised or overly broad skill can steal the API key and access device-related APIs.
openclaw:
requires:
bins: ["python3"]
configPaths: ["~/.openclaw/.env"]
primaryEnv: "AI_GATEWAY_API_KEY"
---
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
`POST /api/device/live` is used to obtain the H5 player live link for a specified device. The API verifies device ownership and then returns a player URL that can be opened directly in a browser.
## ⚠️ Display Rules (MUST be strictly followed)
The script outputs structured data in JSON format, which is the expected behavior. The display rules below are formatting instructions for the agent: the agent MUST parse the JSON output from the script, convert it into a user-friendly format according to the following rules before displaying it, and MUST NOT display the raw JSON directly.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
## ⚠️ Display Rules (MUST be strictly followed)
The script outputs structured data in JSON format, which is the expected behavior. The display rules below are formatting instructions for the agent: the agent MUST parse the JSON output from the script, convert it into a user-friendly format according to the following rules before displaying it, and MUST NOT display the raw JSON directly.
The script output includes the `_device_name` field (device name), which is used for display.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
获取指定设备的 H5 播放器直播链接。自动调用 device/list 获取设备名称。
配置来源(统一规则):
- 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
- 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
- 不再读取任何 AI_GATEWAY_* 环境变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
从 ~/.openclaw/.env 文件加载配置。
这是 OpenClaw 客户端写入的持久化真值源,由所有 skill 共享。
"""
env_path = Path.home() / ".openclaw" / ".env"
if not env_path.exists():
return {}
result = {}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
从 ~/.openclaw/.env 文件加载配置。
这是 OpenClaw 客户端写入的持久化真值源,由所有 skill 共享。
"""
env_path = Path.home() / ".openclaw" / ".env"
if not env_path.exists():
return {}
result = {}
The skill declares network and file-read capabilities implicitly but does not define an explicit tool/permission scope. In an agent environment, missing scope boundaries can let the runtime grant broader access than intended, increasing the blast radius if the skill is misused or the implementation changes.
The skill intentionally uses a single persistent shared .env file as the authoritative configuration source and ignores process environment overrides. This creates session persistence for credentials and host settings across runs and across skills, so stale, poisoned, or maliciously modified values can silently affect future executions.
### Configuration Source
The script reads `~/.openclaw/.env` as the single persistent configuration source. This file is shared by all skills and uses the format `KEY=VALUE` (one entry per line). OpenClaw clients write to this file when the user updates settings. The script does NOT read any `AI_GATEWAY_*` environment variables — env variables are intentionally ignored to avoid stale Gateway-process snapshots overriding the user's latest config.
## Security Notes
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
## Security Notes
- The shared credential file `~/.openclaw/.env` is readable by all skills under the same user. Ensure file permissions are restricted (e.g. `chmod 600 ~/.openclaw/.env`) and that only the OpenClaw service user has access. The IM clients write to this file under that user's home directory.
- TLS certificate verification is enabled by default. You MUST NOT disable it in production environments (disabling it introduces man-in-the-middle attack risks, and attackers may intercept API_KEY and device data)
- Before use, you MUST confirm that AI_GATEWAY_HOST points to a trusted domain
- You MUST use a least-privilege API_KEY to avoid reusing high-privilege credentials. This skill only requires permission to retrieve device live links
The script allows TLS certificate verification to be disabled via shared configuration, which can expose the Authorization bearer token and device live-stream traffic to man-in-the-middle attacks. Because this skill returns live playback links for device feeds, interception or tampering could lead to unauthorized surveillance access or credential compromise, making the context more sensitive than a generic API client.
def get_verify_ssl(env_vars):
"""
判断是否启用 TLS 证书验证。默认启用。
仅当 ~/.openclaw/.env 中显式设置 AI_GATEWAY_VERIFY_SSL=false 时禁用(仅开发环境)。
"""
val = env_vars.get("AI_GATEWAY_VERIFY_SSL", "true").lower()
return val not in ("false", "0", "no")