Back to skill

Security audit

久吾消息网关

Security checks for vulnerabilities and agentic risk

Overview

This skill appears intended to send internal company messages, but it uses overbroad local configuration access and defaults to sending employee IDs and message contents over plaintext HTTP.

Review this before installing. Use it only in a trusted internal environment, avoid sending sensitive message contents unless the gateway is secured, set an approved HTTPS gateway if available, and consider changing the script so it reads only JIUWU_MESSAGE_GATEWAY_URL instead of loading entire OpenClaw .env files.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/send_message.py:20
Finding
Overbroad Loading of Sensitive OpenClaw Environment Files## Vulnerability Details **File Location**: `scripts/send_message.py`, lines 20–34 **Vulnerability Type**: `T05: Unauthorized Access and Privilege Escalation` **Risk Level**: Medium ```python def load_openclaw_env(): """加载OpenClaw的.env配置文件""" env_paths = [ Path.home() / ".openclaw" / "workspace" / ".env", Path.home() / ".openclaw" / ".env", ] for env_path in env_paths: if env_path.exists(): with open(env_path, 'r', encoding='utf-8') as f: for line in f: line = line.strip() if line and not line.startswith('#') and '=' in line: key, value = line.split('=', 1) os.environ.setdefault(key, value) ``` ### Technical Analysis The Skill requires only `JIUWU_MESSAGE_GATEWAY_URL`, but `load_openclaw_env()` reads every key-value pair from two shared OpenClaw `.env` files and inserts all of them into the process environment. These configuration files may contain unrelated API keys, authentication tokens, database credentials, or service secrets. Loading every entry violates least privilege because the declared message-sending functionality does not require access to unrelated configuration values. No direct secret transmission or intentional credential theft was identified. However, once loaded, the additional secrets become accessible to any other code running in the same Python process. This is particularly relevant when `send_message` is imported as a library, as documented by the Skill, rather than run in a dedicated process. ### Attack Path 1. The OpenClaw `.env` files contain both the gateway URL and unrelated sensitive credentials. 2. The Skill is imported into a process that also contains compromised, untrusted, or vulnerable Python code. 3. A call to `send_message()` invokes `get_gateway_url()`, which invokes `load_openclaw_env()`. 4. The loader reads ...[truncated 894 chars]
Remediation
## Remediation Suggestions - Prefer requiring `JIUWU_MESSAGE_GATEWAY_URL` to be supplied directly through the existing process environment. - If `.env` fallback behavior is necessary, parse and return only the value of `JIUWU_MESSAGE_GATEWAY_URL`. - Do not copy unrelated values into `os.environ`. - Apply restrictive filesystem permissions to any `.env` file containing credentials. - Consider using a dedicated configuration file containing only this Skill's non-secret gateway setting. - Document the exact configuration value read by the Skill and avoid implying that broad access to shared secret stores is required. A safer implementation would inspect lines only until it finds the exact `JIUWU_MESSAGE_GATEWAY_URL` key and return that value without mutating the process environment.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/send_message.py:37
Finding
Sensitive Internal Messages Transmitted Through an Unauthenticated Plaintext HTTP Gateway## Vulnerability Details **File Location**: `scripts/send_message.py`, lines 37–69 **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: Medium ```python def get_gateway_url(): """获取消息网关服务器地址""" load_openclaw_env() return os.environ.get("JIUWU_MESSAGE_GATEWAY_URL", "http://192.168.1.213:5000") def send_message(code: str, text: str, title: str = None, timeout: int = 30) -> dict: """ 发送消息到久吾消息网关 Args: code: 接收人工号,多个工号用英文逗号分隔 text: 消息内容 title: 消息标题(可选) timeout: 超时时间(秒,默认30) Returns: dict: 包含 success, data, message 字段的响应 """ gateway_url = get_gateway_url() url = f"{gateway_url}/api/MessageGateway/SendMessagePost" payload = { "code": code, "text": text } if title: payload["title"] = title data = json.dumps(payload).encode('utf-8') req = urllib.request.Request( url, data=data, headers={ 'accept': 'text/plain', 'Content-Type': 'application/json-patch+json' }, method='POST' ) try: with urllib.request.urlopen(req, timeout=timeout) as response: ``` The corresponding documented default is also present in `SKILL.md`, line 12: ```markdown 网关地址从环境变量 `JIUWU_MESSAGE_GATEWAY_URL` 读取,默认为 `http://192.168.1.213:5000`。可在 `~/.openclaw/workspace/.env` 或 `~/.openclaw/.env` 中配置。 ``` ### Technical Analysis The default gateway uses unencrypted HTTP. The request contains employee identifiers, message contents, and an optional title, all of which may be sensitive internal information. Plaintext HTTP provides neither transport confidentiality nor server authentication. The code also adds no application-level authentication or request-integrity mechanism. Furthermore, `JIUWU_MESSAGE_GATEWAY_URL` is accepted without scheme or hostname validation. A modified enviro ...[truncated 1933 chars]
Remediation
## Remediation Suggestions - Require an `https://` gateway URL and reject plaintext HTTP. - Remove the plaintext default; fail securely when no approved gateway is configured. - Validate the parsed URL before sending: - Require the HTTPS scheme. - Require a nonempty hostname. - Reject embedded credentials and unexpected URL components. - Optionally allowlist the approved enterprise gateway hostname and port. - Retain Python's default TLS certificate and hostname verification, and configure the enterprise trust chain correctly rather than disabling verification. - Add gateway authentication, such as a narrowly scoped service token or mutually authenticated TLS. - Add request integrity and replay protections if the gateway protocol supports them. - Protect the configuration source from unauthorized modification and avoid logging message bodies or authentication material. - Update `SKILL.md` to document only the secure endpoint and the required authentication controls.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (6)

Credential Access

High
Category
Privilege Escalation
Content
def load_openclaw_env():
    """加载OpenClaw的.env配置文件"""
    env_paths = [
        Path.home() / ".openclaw" / "workspace" / ".env",
        Path.home() / ".openclaw" / ".env",
    ]
Confidence
90% confidence
Finding
Accessing ~/.openclaw/workspace/.env is a form of credential and secret harvesting because .env files commonly contain API keys, tokens, and internal service credentials. Even though this code currently uses the file to source configuration, granting a messaging skill the ability to read a shared workspace secret store is overbroad and increases the chance of secret exposure or abuse.

Credential Access

High
Category
Privilege Escalation
Content
"""加载OpenClaw的.env配置文件"""
    env_paths = [
        Path.home() / ".openclaw" / "workspace" / ".env",
        Path.home() / ".openclaw" / ".env",
    ]

    for env_path in env_paths:
Confidence
89% confidence
Finding
Accessing ~/.openclaw/.env similarly exposes user-level secrets outside the skill’s messaging-only scope. This makes the skill more dangerous in context because a simple notification tool should not need to enumerate or ingest a broad personal configuration store that may contain unrelated credentials for other tools and services.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill exposes capabilities to read environment configuration, access files, and send network requests, but it does not declare any explicit tool scope or permissions boundary. This makes the skill harder to govern and review, and increases the chance it will be invoked with more capability than users or operators expect, especially since it transmits data to a gateway.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The activation text uses broad phrases like sending notifications, reminding colleagues, or messaging employees, which can match ordinary user requests and trigger the skill unintentionally. Because the skill performs an external side effect by sending messages to real internal recipients, accidental activation could cause unauthorized or mistaken communications.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill documentation does not clearly warn users that recipient employee IDs and message contents will be transmitted over HTTP to an internal gateway. This reduces informed consent and may expose sensitive internal data to interception or mishandling, especially because the documented default endpoint uses plain HTTP rather than HTTPS.

Context-Inappropriate Capability

Low
Confidence
93% confidence
Finding
The skill reads workspace- and user-level .env files and imports every key into the process environment, even though its stated purpose is only to send internal messages. This broad configuration loading creates unnecessary access to potentially sensitive secrets and expands the skill’s privilege surface; if the process, logs, errors, or downstream code are compromised, unrelated credentials may be exposed or misused.

Static analysis

No suspicious patterns detected.