Back to skill

Security audit

Elegant Config Guardian

Security checks for vulnerabilities and agentic risk

Overview

This skill is a config-change helper, but its safety wrapper can run arbitrary shell commands and its rollback/ack protections are weaker than advertised.

Use this only if you fully trust the exact --apply-cmd being passed and can tolerate manual recovery of the OpenClaw gateway config. Review the command before running it, avoid privileged execution, and do not rely on the advertised ack/rollback behavior as a strong safety boundary without fixing the eval, temp-file, and rollback handling first.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/safe_apply.sh:27
Finding
Predictable Files in Shared Temporary Directory Permit Acknowledgment Bypass and Symlink Attacks## Vulnerability Details **File Location**: `scripts/safe_apply.sh`, lines 27-28, 38, and 49-54 **Vulnerability Type**: Predictable and insecure temporary-file handling **Risk Level**: Medium ### Vulnerable Code ```bash ACK_FILE="/tmp/openclaw-config-ack-${TS}.ok" STATUS_FILE="/tmp/openclaw-safe-status-${TS}.txt" ``` ```bash if ! openclaw gateway status >"$STATUS_FILE" 2>&1 || ! grep -q "RPC probe: ok" "$STATUS_FILE"; then ``` ```bash if [[ "$REQUIRE_ACK" -eq 1 ]]; then echo "[safe-apply] ack required within ${ACK_TIMEOUT}s" echo "[safe-apply] ack file: $ACK_FILE" echo "touch '$ACK_FILE'" elapsed=0 while [[ $elapsed -lt $ACK_TIMEOUT ]]; do if [[ -f "$ACK_FILE" ]]; then echo "[safe-apply] ack received" rm -f "$ACK_FILE" exit 0 fi ``` ### Technical Analysis Both temporary paths are generated directly under the shared `/tmp` directory using a timestamp with one-second resolution. These names are predictable and are not created atomically. The script does not use a private temporary directory, verify file ownership, reject symbolic links, or bind acknowledgment to an unpredictable token. The acknowledgment check accepts any object for which `[[ -f "$ACK_FILE" ]]` succeeds. Consequently, another local user can predict or race the timestamp and create the file before the check. The script then treats that file as an authorized manual acknowledgment. The status-file redirection also follows symbolic links. A local attacker who predicts the filename can pre-create it as a symbolic link. When the script runs, shell redirection may truncate or overwrite the symlink target using the invoking user's privileges. The target must still be writable by that user, but execution under a privileged account would increase the affected scope. ### Attack Path 1. A local attacker observes or estimates when the script will be started. 2. The attacker calculates the timestamp-base ...[truncated 1233 chars]
Remediation
## Remediation Suggestions - Create a private temporary directory atomically with `mktemp -d`, and ensure it is accessible only to the current user: ```bash TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-safe-apply.XXXXXXXX")" chmod 700 "$TMP_DIR" ACK_FILE="$TMP_DIR/ack" STATUS_FILE="$TMP_DIR/status" trap 'rm -rf -- "$TMP_DIR"' EXIT ``` - Use an unpredictable acknowledgment token or an authenticated communication channel rather than treating the existence of a predictable file as authorization. - If file acknowledgment remains necessary, verify that it is a regular file owned by the expected user and not a symbolic link. - Open output files using a mechanism that rejects existing files and symbolic links, or keep all files inside the private directory. - Remove temporary artifacts reliably through an `EXIT` trap, including after errors and received signals.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/safe_apply.sh:2
Finding
Apply Failures and Interruptions Can Bypass the Advertised Automatic Rollback## Vulnerability Details **File Location**: `scripts/safe_apply.sh`, lines 2, 33, 43-46, and 60-64 **Vulnerability Type**: Incomplete rollback and error-recovery handling **Risk Level**: Medium ### Vulnerable Code ```bash set -euo pipefail ``` ```bash cp "$CONFIG" "$BACKUP" echo "[safe-apply] backup: $BACKUP" eval "$APPLY_CMD" ``` ```bash if ! openclaw gateway status >"$STATUS_FILE" 2>&1 || ! grep -q "RPC probe: ok" "$STATUS_FILE"; then echo "[safe-apply] health check failed -> rollback" cp "$BACKUP" "$CONFIG" openclaw gateway restart >/dev/null 2>&1 || true sleep 2 exit 2 fi ``` ```bash echo "[safe-apply] ack timeout -> rollback" cp "$BACKUP" "$CONFIG" openclaw gateway restart >/dev/null 2>&1 || true sleep 2 exit 3 ``` ### Technical Analysis Rollback is implemented only in the explicit health-check failure and acknowledgment-timeout branches. No `EXIT`, `ERR`, `INT`, or `TERM` trap restores the backup after other unsuccessful exits. Because `set -e` is enabled, a nonzero result from `eval "$APPLY_CMD"` terminates the script immediately. If the apply command modifies the configuration and subsequently fails, the backup is not restored. Signals and unexpected failures after the backup can produce the same result. In the explicit rollback branches, gateway restart failures are suppressed with `|| true`. The script also does not run another health check after restoration. It can therefore report a rollback path through its exit status even though the restored configuration was not successfully loaded by the running gateway. ### Attack Path 1. The victim starts the script with an apply command capable of changing the target configuration. 2. The command writes a partial, invalid, or security-sensitive configuration change. 3. The command then exits with a nonzero status, either deliberately, because of malformed input, or because a later operation fails. 4. `set -e` termi ...[truncated 949 chars]
Remediation
## Remediation Suggestions - Install rollback handlers immediately after the backup is created. Track whether the change was explicitly committed, and restore the backup on every unsuccessful exit. - Handle `EXIT`, `INT`, and `TERM` so that command failures and interruptions follow the same recovery path. - Avoid relying solely on `set -e`; execute the apply operation in an explicit conditional: ```bash if ! bash -c "$APPLY_CMD"; then rollback exit 1 fi ``` - Prefer a patch file or a fixed executable with structured arguments over `eval` when feasible. - Implement rollback as a dedicated function that verifies every operation. - Do not suppress restart failures. If restart fails after restoration, report a distinct critical error. - Run the health probe again after rollback to confirm that the restored configuration is active and healthy. - Validate `ACK_TIMEOUT` as a nonnegative integer before entering the acknowledgment loop. - Write changes to a temporary file, validate them, and atomically replace the configuration only after validation succeeds.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (2)

Context-Inappropriate Capability

High
Confidence
97% confidence
Finding
The script executes caller-controlled input with `eval "$APPLY_CMD"`, which allows arbitrary shell execution rather than limiting behavior to safe config edits. In a skill advertised as a guarded mechanism for applying OpenClaw configuration changes, this makes the wrapper a generic code-execution surface and can lead to command injection, file tampering, credential access, or persistence under the invoking user's privileges.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
Because `--apply-cmd` is executed as shell code, users may reasonably assume this helper only applies safe OpenClaw config changes when in fact it will run arbitrary commands. The lack of a clear warning increases the chance of unsafe use, hidden abuse in automation, and accidental execution of attacker-influenced input under the trusted appearance of a safety tool.

Static analysis

No suspicious patterns detected.