T09 · Insecure Skill Coding Practices
- Location
scripts/notify.py:105- Finding
Configurable remote gateway can receive arbitrary named secrets over plaintext HTTP
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This restart skill has a legitimate operational purpose, but it can automatically restart infrastructure, run broadly configured local commands, and transmit credentials or notifications with insufficient scoping.
Review carefully before installing. Use only in a controlled OpenClaw environment, require explicit operator confirmation before restart, keep the gateway host loopback-only unless you fully trust the remote endpoint, avoid arbitrary auth_token_env values, restrict diagnostics and verify commands to known OpenClaw commands, and protect ~/.openclaw/.env plus restart context files with strict permissions.
scripts/notify.py:105Configurable remote gateway can receive arbitrary named secrets over plaintext HTTP
scripts/notify.py:145Gateway and Telegram credentials are exposed through process command-line arguments
scripts/guardian.py:746Guardian diagnostics and postcheck context allow arbitrary non-shell command execution
scripts/restart.py:90Predictable shared temporary lock permits symlink-based file overwrite
scripts/restart.py:523Authenticated HTTP restart path is unreachable and causes orchestrator failure
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
A skill advertised as an operational restart utility but apparently focused on parsing YAML/frontmatter and config structures creates a misleading trust boundary. In this context, the danger is not the parsing itself but that users and reviewers may underestimate the true implementation gap and approve a tool that lacks promised safeguards.
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
If a previous restart failed and the lock wasn't cleaned up:
rm -f /tmp/restart-guard.lock
Or use --force flag with restart.py.
The helper accesses credentials from a predictable local secret file under the user's home directory. In a skill execution context, automatic credential harvesting from disk materially increases the risk of unauthorized secret use and downstream exfiltration through the notification channels defined later in the file.
def dotenv_get(key):
env_path = os.path.expanduser("~/.openclaw/.env")
if not os.path.isfile(env_path):
return ""
try:
Reading credentials from ~/.openclaw/.env creates a plaintext secret dependency outside a managed secret store and broadens the attack surface to any local process or user that can read that file. In this skill, the token can authorize gateway restart actions, so compromise of the file could enable unauthorized service disruption or control.
def dotenv_get(key):
env_file = os.path.expanduser("~/.openclaw/.env")
if not os.path.isfile(env_file):
return ""
with open(env_file, "r", encoding="utf-8") as f:
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
## Reason
<!-- Why is this restart needed? What changed? -->
## Changes Made
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def test_rejects_pipe_in_host(self):
with self.assertRaises(ValueError):
restart.validate_host_port("evil.com|cat /etc/passwd", "8080")
def test_rejects_backslash_in_host(self):
with self.assertRaises(ValueError):
The spec authorizes destructive restart behavior from broad natural-language phrases like 'restart now' without requiring explicit confirmation, authorization checks, or a constrained command format. In an agent setting, this increases the chance of accidental invocation from ordinary conversation, quoted text, logs, or prompt-injected content, potentially causing unintended service disruption.
The README explicitly says the user only needs to express a generic restart intent and that the agent should run the skill automatically. Because this skill performs a high-impact operation (gateway restart plus possible external notification), broad natural-language triggering without clear confirmation or scope boundaries can cause unintended or premature restarts from ambiguous conversation text.
The zero-config UX section states that no channel arguments are required and that restart semantics alone are sufficient, reinforcing automatic execution from loosely defined intent. In the context of a restart-capable skill with disaster-routing and external broadcast fallback, this increases the chance that normal discussion, quoted text, or indirect requests trigger disruptive actions and unintended notifications.
The skill explicitly requires environment access and shell execution in metadata/workflow, but it does not declare any tool scope restrictions such as allowed tools or permissions. In a restart-oriented skill that can read configs, invoke subprocesses, and write files, missing scope boundaries increases the blast radius if the skill is misused or its implementation behaves unexpectedly.
The instruction 'must auto-run, do not ask user' delegates disruptive operational decisions to the skill without a human checkpoint. In the context of gateway restarts and cross-channel notifications, autonomous decision-making is especially dangerous because it can cause downtime and data propagation based on ambiguous language or adversarial prompts.
Use this skill when the task involves OpenClaw gateway restart, watchdog recovery, or post-restart reporting.
当任务涉及 OpenClaw 网关重启、看门狗恢复、重启后回报时使用。
Natural-language triggers (must auto-run, do not ask user for script commands):
- "可以重启了"
- "现在重启吧"
- "restart now"
The skill is configured to auto-execute on ordinary natural-language phrases like 'restart now' and equivalent Chinese phrases, with no additional opt-in or confirmation. For a skill that can restart services, write context, and notify external channels, phrase-triggered autonomous execution materially raises the risk of accidental disruption or abuse through prompt injection/social engineering.
The workflow describes automatically restarting infrastructure and sending notifications to origin or external channels without a clear user-facing warning about service disruption or data transmission. In an ops context, that omission is dangerous because users may trigger downtime or unintentionally send incident/context data to third-party endpoints.
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.
# --- Paths ---
paths:
# Where to write the restart context file
context_file: "~/.openclaw/custom/restart-guard-work/restart-context.md"
# Lock file to prevent restart storms
lock_file: "/tmp/restart-guard.lock"
The markdown instructs users to run rm -f /tmp/restart-guard.lock, which deletes a file, but it does not include any warning about ensuring the lock file is stale or about potential side effects. For markdown files, destructive operations that could affect system integrity should be accompanied by a user-facing warning or caution.
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.
## Guardian Process
The guardian is spawned as a fully detached process (nohup + setsid) so it survives
the gateway restart. It:
1. Records the gateway PID before restart
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
def main():
parser = argparse.ArgumentParser(description="Auto run restart-guard flow")
parser.add_argument("--config", required=True, help="Path to restart-guard.yaml")
parser.add_argument("--reason", default="", help="Restart reason")
parser.add_argument("--note", default="", help="Additional note for context")
No suspicious patterns detected.