Back to skill

Security audit

Closeli Open Device Event Query

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it says, but it handles sensitive device-event data and API credentials through a shared, mutable configuration file with weak destination controls.

Review this skill before installing. Use only a least-privilege, revocable API key; keep ~/.openclaw/.env permission-restricted; confirm AI_GATEWAY_HOST is the intended trusted HTTPS gateway; do not disable TLS verification in production; avoid passing the API key on the command line; and avoid storing unrelated secrets in the shared OpenClaw .env file.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (4)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
query_events.py:57
Finding

Overbroad Parsing of a Shared Credential File

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
query_events.py:101
Finding

Bearer Credential Disclosure Through Configurable Host and Optional TLS Verification

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
query_events.py:141
Finding

API Key Exposure Through Command-Line Arguments

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:49
Finding

Unpinned Third-Party Dependency Installation Guidance

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (23)

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

The skill explicitly depends on a shared plaintext credential file at ~/.openclaw/.env that is readable by all skills under the same user. In a multi-skill agent environment, this creates a strong credential-theft and lateral-movement risk because any compromised or malicious skill with file-read access can harvest the API key and reuse it against the gateway.

Content

Scanner excerpt · SKILL.md (reported line 8)May include surrounding context.

md
openclaw:
    requires:
      bins: ["python3"]
      configPaths: ["~/.openclaw/.env"]
    primaryEnv: "AI_GATEWAY_API_KEY"
---

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · SKILL.md (reported line 16)May include surrounding context.

md
`POST /api/event/query` is an AI-powered event query API that supports natural language queries and returns an AI summary and event list.

## ⚠️ 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.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · SKILL.md (reported line 18)May include surrounding context.

md
## ⚠️ 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.

1. When `code == 0` and `data.events` is not empty:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 13)May include surrounding context.

python
脚本只负责调用接口和裁剪数据,展示逻辑由 agent 根据 SKILL.md 规则完成。

配置来源(统一规则):
  - 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
  - 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
  - 不再读取任何 AI_GATEWAY_* 环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 14)May include surrounding context.

python
脚本只负责调用接口和裁剪数据,展示逻辑由 agent 根据 SKILL.md 规则完成。

配置来源(统一规则):
  - 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
  - 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
  - 不再读取任何 AI_GATEWAY_* 环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 57)May include surrounding context.

python
脚本只负责调用接口和裁剪数据,展示逻辑由 agent 根据 SKILL.md 规则完成。

配置来源(统一规则):
  - 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
  - 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
  - 不再读取任何 AI_GATEWAY_* 环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 85)May include surrounding context.

python
脚本只负责调用接口和裁剪数据,展示逻辑由 agent 根据 SKILL.md 规则完成。

配置来源(统一规则):
  - 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
  - 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
  - 不再读取任何 AI_GATEWAY_* 环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 141)May include surrounding context.

python
脚本只负责调用接口和裁剪数据,展示逻辑由 agent 根据 SKILL.md 规则完成。

配置来源(统一规则):
  - 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
  - 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
  - 不再读取任何 AI_GATEWAY_* 环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 146)May include surrounding context.

python
脚本只负责调用接口和裁剪数据,展示逻辑由 agent 根据 SKILL.md 规则完成。

配置来源(统一规则):
  - 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
  - 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
  - 不再读取任何 AI_GATEWAY_* 环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 149)May include surrounding context.

python
脚本只负责调用接口和裁剪数据,展示逻辑由 agent 根据 SKILL.md 规则完成。

配置来源(统一规则):
  - 持久化:~/.openclaw/.env (OpenClaw 客户端的"设置 API Key"会自动写入此文件)
  - 临时覆盖:仅 API_KEY 支持命令行 --api-key,覆盖 .env 中的同名配置
  - 不再读取任何 AI_GATEWAY_* 环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 60)May include surrounding context.

python
从 ~/.openclaw/.env 文件加载配置。
    这是 OpenClaw 客户端写入的持久化真值源,由所有 skill 共享。
    """
    env_path = Path.home() / ".openclaw" / ".env"
    if not env_path.exists():
        return {}
    result = {}

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · query_events.py (reported line 133)May include surrounding context.

python
从 ~/.openclaw/.env 文件加载配置。
    这是 OpenClaw 客户端写入的持久化真值源,由所有 skill 共享。
    """
    env_path = Path.home() / ".openclaw" / ".env"
    if not env_path.exists():
        return {}
    result = {}

Credential Access

High
Category
Privilege Escalation
Confidence
84% confidence
Finding

Allowing the API host to be sourced from a shared ~/.openclaw/.env file means any actor who can modify that file can redirect authenticated requests to an attacker-controlled endpoint. Because the script sends the bearer token in the Authorization header, this can lead to credential exfiltration and disclosure of queried event data, especially dangerous in a skill context that handles surveillance/event information.

Content

Scanner excerpt · query_events.py (reported line 94)May include surrounding context.

python
def get_api_host(env_vars):
    """
    获取网关地址:~/.openclaw/.env 中的 AI_GATEWAY_HOST,未配置则用默认值。
    """
    host = env_vars.get("AI_GATEWAY_HOST")
    return host.rstrip("/") if host else DEFAULT_API_HOST

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

Reading AI_GATEWAY_VERIFY_SSL from shared configuration permits disabling TLS certificate validation, which exposes the bearer token and event data to man-in-the-middle interception. In this skill, the returned data may include event summaries and media URLs, so weakening transport security materially increases confidentiality and integrity risk.

Content

Scanner excerpt · query_events.py (reported line 103)May include surrounding context.

python
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")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill declares file-read and network-reachable behavior but does not define explicit tool scope or allowed-tools boundaries in the manifest. In an agent environment, this increases the chance the skill is executed with broader capabilities than intended, enabling unintended access to local files such as shared credential material and outbound requests to attacker-controlled hosts if configuration is altered.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest says AI_GATEWAY_API_KEY is a primary environment source, while the documentation says AI_GATEWAY_* environment variables are intentionally ignored. This inconsistency can cause the agent or operator to supply credentials through an unexpected channel, leading to stale, wrong, or less-protected secrets being used and undermining trust in the security model.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

The skill relies on a persistent shared configuration file for credentials and host settings across sessions. Persistent shared state increases the blast radius of compromise: a malicious or compromised skill can read or alter the stored host or key once, and future invocations may continue using attacker-influenced configuration without user awareness.

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

md
### 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

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 70)May include surrounding context.

md
## 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 event query permission

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The request format specifies locale defaults to "zh_CN", which means the skill may force a specific language/locale behavior when the user does not explicitly choose one. The policy allows locale constraints only when the user is given a choice or the constraint is clearly justified as region-specific, which is not stated here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation at L015 states '不再读取任何 AI_GATEWAY_* 环境变量', which broadly claims those variables are no longer read. However, the code explicitly loads AI_GATEWAY_HOST and AI_GATEWAY_VERIFY_SSL from ~/.openclaw/.env in get_api_host and get_verify_ssl, and the docstring's '读取项' section also lists them. This is an internal documentation contradiction about configuration sources and behavior.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
95% confidence
Finding

The script supports AI_GATEWAY_VERIFY_SSL=false, creating an unsafe transport default path even if the nominal default is true. If a local attacker, another skill, or compromised client modifies the shared ~/.openclaw/.env, authenticated API traffic can be intercepted or redirected without certificate validation, exposing bearer tokens and sensitive device event results.

Content

Scanner excerpt · query_events.py (reported line 103)May include surrounding context.

python
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")

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The command-line argument for locale hard-codes a default of zh_CN, which forces a specific language/locale behavior when the user does not explicitly choose one. The policy allows locale constraints only when user choice or a clearly justified region-specific limitation is provided, which is not evident here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The display rules at L038 say that if there are more than 10 items, only the first 10 should be displayed, implying the script may return up to 10 for presentation. But the response documentation at L127 says the script has already trimmed the events array to the first 3 items. These statements conflict about the script's actual output behavior.

Content

No source excerpt is available for this finding.