Back to skill

Security audit

Gateway Guardian

Security checks for vulnerabilities and agentic risk

Overview

This skill has a legitimate gateway-protection purpose, but it installs persistent services and has unsafe install/configuration paths that could run unintended commands.

Review this carefully before installing. Prefer a version that uses the bundled scripts only, pins or verifies any remote downloads, stores config in a non-executable format, validates notification IDs and bot names strictly, and clearly explains the persistent systemd services it will create.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:99
Finding

Shell Command Injection Through Unsafely Generated guardian.conf

Content
View full analysis
"$SKILL_DIR/guardian.conf" << GUARDIANCONF # Auto-generated by gateway-guardian installer. Do not upload to GitHub. # Fallback notification target (used when dynamic session detection fails) FALLBACK_CHANNEL={FALLBACK_CHANNEL} FALLBACK_TARGET={FALLBACK_TARGET} # Notification language: zh (Chinese) | en (English) LOCALE={LOCALE} # Bot display name used in staff/team notifications BOT_NAME={BOT_NAME} # Team group/channel notification (optional) # Leave empty to disable. Supported formats: # Feishu: oc_xxx # Telegram: -100xxxxxxxxxx (supergroup/channel numeric id) # Discord: 123456789012345678 (channel id, digits only) # Only effective if the channel is configured and running in OpenClaw. STAFF_GROUP_CHAT_ID= GUARDIANCONF ``` The generated file is subsequently loaded as executable shell code: ```bash _GUARDIAN_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" [ -f "$_GUARDIAN_LIB_DIR/guardian.conf" ] && source "$_GUARDIAN_LIB_DIR/guardian.conf" ``` ### Technical Analysis The installer instructs the Agent to insert user-controlled `BOT_NAME` and conversation-derived notification values directly into an unquoted heredoc. An unquoted heredoc performs command substitution, backtick substitution, and parameter expansion while it is being processed. For example, if a value is inserted as: ```bash BOT_NAME=$(touch /tmp/gateway-guardian-injection) ``` the command substitution can execute immediate ...[truncated 1744 chars]
Remediation
View remediation
"$SKILL_DIR/guardian.conf" <<'GUARDIANCONF' ... GUARDIANCONF ``` 3. Pass values separately rather than replacing placeholders inside executable shell text. 4. If shell configuration is unavoidable, serialize each value with `printf '%q'` before writing it. 5. Enforce strict allowlists: - `FALLBACK_CHANNEL`: one of explicitly supported channel names. - `LOCALE`: exactly `zh` or `en`. - Notification IDs: channel-specific anchored regular expressions. - `BOT_NAME`: a conservative length and character allowlist. 6. Reject newlines, control characters, backticks, dollar signs, semicolons, shell redirection characters, and command-substitution syntax. 7. Create the file with restrictive permissions, such as mode `0600`. 8. Add tests using values containing `$(...)`, backticks, quotes, newlines, semicolons, backslashes, and redirection operators. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:258
Finding

Command and Configuration Injection in Team Group Update Flow

Content
View full analysis
` or `set guardian group: `: 1. Extract the group ID from the message 2. Determine the channel based on ID format: - Starts with `oc_` → feishu - Starts with `-100` → telegram - Pure digits → discord 3. Update `guardian.conf`: ```bash SKILL_DIR="$HOME/.openclaw/workspace/skills/gateway-guardian" sed -i "s|^STAFF_GROUP_CHAT_ID=.*|STAFF_GROUP_CHAT_ID={extracted_id}|" "$SKILL_DIR/guardian.conf" ``` ``` The modified file is subsequently executed as shell configuration: ```bash _GUARDIAN_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" [ -f "$_GUARDIAN_LIB_DIR/guardian.conf" ] && source "$_GUARDIAN_LIB_DIR/guardian.conf" ``` ### Technical Analysis The group identifier is extracted from a user message and interpolated directly into a double-quoted `sed` command. The instructions describe how to infer a channel from common identifier prefixes, but they do not explicitly require rejecting values that contain additional characters or malformed content. This creates two related injection surfaces: 1. Shell metacharacters introduced when the placeholder is replaced can alter the generated shell command. 2. `sed` replacement metacharacters, including the delimiter, backslashes, and `&`, can change the replacement behavior or inject additional content into `guardian.conf`. Because `guardian.conf` is later loaded with `source`, any injected shell statement becomes executable code. Newline injection is particularly dangerous because it can append an independent command beneath the `STAFF_GROUP_CHAT_ID` assignment. ### Attack Path 1. An attacker sends a crafted `set guardian group:` message containi ...[truncated 1085 chars]
Remediation
View remediation

T03 · Remote Payload Retrieval and Execution

Warning
Location
SKILL.md:87
Finding

Mutable Remote Scripts Are Downloaded and Persistently Executed Without Integrity Verification

Content
View full analysis
~/.config/systemd/user/openclaw-config-watcher.service << EOF [Unit] Description=OpenClaw Gateway Guardian - File Watcher After=openclaw-gateway.service [Service] Type=simple ExecStart=/bin/bash $SKILL_DIR/config-watcher.sh Restart=always RestartSec=3 [Install] WantedBy=default.target EOF ``` ```bash cat > ~/.config/systemd/user/openclaw-recovery.service << EOF [Unit] Description=OpenClaw Gateway Guardian - Crash Recovery After=network.target [Service] Type=oneshot ExecStart=/bin/bash $SKILL_DIR/gateway-recovery.sh EOF ``` ```bash systemctl --user daemon-reload systemctl --user enable openclaw-config-watcher.service systemctl --user start openclaw-config-watcher.service ``` ### Technical Analysis The installation procedure downloads executable shell scripts from the mutable `main` branch. It does not pin an immutable commit, verify a cryptographic checksum, validate a release signature, or compare the downloaded files against the reviewed package. Therefore, the code that is ultimately executed can differ from the code reviewed during this audit. Compromise of the upstream repository, maintainer account, release process, or content-delivery path could replace any downloaded script with arbitrary code. Files are downloaded ...[truncated 1764 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (41)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · CHANGELOG.md (reported line 135)May include surrounding context.

bash
touch ~/.openclaw/.guardian-maintenance   # pause monitoring
npm install -g openclaw@latest            # upgrade
rm ~/.openclaw/.guardian-maintenance      # resume → upgrade notification sent automatically

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · README.en.md (reported line 153)May include surrounding context.

bash
systemctl --user stop openclaw-config-watcher.service
systemctl --user disable openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-recovery.service
rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf
systemctl --user daemon-reload

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · README.md (reported line 156)May include surrounding context.

bash
systemctl --user stop openclaw-config-watcher.service
systemctl --user disable openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-recovery.service
rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf
systemctl --user daemon-reload

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

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

bash
systemctl --user stop openclaw-config-watcher.service
systemctl --user disable openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-recovery.service
rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf
systemctl --user daemon-reload

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · README.en.md (reported line 154)May include surrounding context.

md
systemctl --user stop openclaw-config-watcher.service
systemctl --user disable openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-recovery.service
rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf
systemctl --user daemon-reload
systemctl --user reset-failed openclaw-gateway.service 2>/dev/null

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · README.md (reported line 157)May include surrounding context.

md
systemctl --user stop openclaw-config-watcher.service
systemctl --user disable openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-recovery.service
rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf
systemctl --user daemon-reload
systemctl --user reset-failed openclaw-gateway.service 2>/dev/null

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

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

md
systemctl --user stop openclaw-config-watcher.service
systemctl --user disable openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-config-watcher.service
rm -f ~/.config/systemd/user/openclaw-recovery.service
rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf
systemctl --user daemon-reload
systemctl --user reset-failed openclaw-gateway.service 2>/dev/null

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · README.en.md (reported line 155)May include surrounding context.

systemctl --user disable openclaw-config-watcher.service rm -f ~/.config/systemd/user/openclaw-config-watcher.service rm -f ~/.config/systemd/user/openclaw-recovery.service rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf systemctl --user daemon-reload systemctl --user reset-failed openclaw-gateway.service 2>/dev/null

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · README.md (reported line 158)May include surrounding context.

systemctl --user disable openclaw-config-watcher.service rm -f ~/.config/systemd/user/openclaw-config-watcher.service rm -f ~/.config/systemd/user/openclaw-recovery.service rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf systemctl --user daemon-reload systemctl --user reset-failed openclaw-gateway.service 2>/dev/null

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

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

systemctl --user disable openclaw-config-watcher.service rm -f ~/.config/systemd/user/openclaw-config-watcher.service rm -f ~/.config/systemd/user/openclaw-recovery.service rm -f ~/.config/systemd/user/openclaw-gateway.service.d/recovery.conf systemctl --user daemon-reload systemctl --user reset-failed openclaw-gateway.service 2>/dev/null

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

Scanner excerpt · README.en.md (reported line 163)May include surrounding context.

Config backups in ~/.openclaw/config-backups/ are kept after uninstall. To delete them:

bash
rm -rf ~/.openclaw/config-backups/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

Scanner excerpt · README.md (reported line 166)May include surrounding context.

Config backups in ~/.openclaw/config-backups/ are kept after uninstall. To delete them:

bash
rm -rf ~/.openclaw/config-backups/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

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

Config backups in ~/.openclaw/config-backups/ are kept after uninstall. To delete them:

bash
rm -rf ~/.openclaw/config-backups/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

Scanner excerpt · README.en.md (reported line 163)May include surrounding context.

Config backups in ~/.openclaw/config-backups/ are kept after uninstall. To delete them:

bash
rm -rf ~/.openclaw/config-backups/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

Scanner excerpt · README.md (reported line 166)May include surrounding context.

Config backups in ~/.openclaw/config-backups/ are kept after uninstall. To delete them:

bash
rm -rf ~/.openclaw/config-backups/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

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

Config backups in ~/.openclaw/config-backups/ are kept after uninstall. To delete them:

bash
rm -rf ~/.openclaw/config-backups/

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · config-lib.sh (reported line 268)May include surrounding context.

sh
else
        cp "$CONFIG" "$tmp" 2>/dev/null || { echo "cannot read config file"; return 1; }
        if ! cp "$file" "$CONFIG" 2>/dev/null; then
            cp "$tmp" "$CONFIG"; rm -f "$tmp"
            echo "cannot copy file to config"; return 1
        fi
        result=$(timeout 30 openclaw config validate 2>&1)

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · config-lib.sh (reported line 273)May include surrounding context.

sh
fi
        result=$(timeout 30 openclaw config validate 2>&1)
        exit_code=$?
        cp "$tmp" "$CONFIG" && rm -f "$tmp"
    fi

    if [ $exit_code -ne 0 ] || echo "$result" | grep -qi "error\|invalid\|failed"; then

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

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).

Content

Scanner excerpt · config-lib.sh (reported line 291)May include surrounding context.

sh
count=$(ls "$TIMESTAMP_DIR/" | wc -l)
    if [ "$count" -gt "$MAX_BACKUPS" ]; then
        ls -t "$TIMESTAMP_DIR/" | tail -n +$((MAX_BACKUPS + 1)) | \
            while IFS= read -r f; do rm -f "$TIMESTAMP_DIR/$f"; done
    fi
    log "💾 Backup saved: $(basename "$bak")"
}

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · CHANGELOG.md (reported line 12)May include surrounding context.

md
- **SKILL.md: guardian.conf placeholder resolution** — added explicit table showing how to
  resolve `FALLBACK_CHANNEL` and `FALLBACK_TARGET` from conversation context before writing
  the conf file; Step 4 now clearly states placeholders must be substituted before running
- **inotify-tools install**: added non-sudo fallback and manual install prompt for
  environments without elevated permissions

---

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · README.en.md (reported line 124)May include surrounding context.

md
- **SKILL.md: guardian.conf placeholder resolution** — added explicit table showing how to
  resolve `FALLBACK_CHANNEL` and `FALLBACK_TARGET` from conversation context before writing
  the conf file; Step 4 now clearly states placeholders must be substituted before running
- **inotify-tools install**: added non-sudo fallback and manual install prompt for
  environments without elevated permissions

---

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · README.md (reported line 127)May include surrounding context.

md
- **SKILL.md: guardian.conf placeholder resolution** — added explicit table showing how to
  resolve `FALLBACK_CHANNEL` and `FALLBACK_TARGET` from conversation context before writing
  the conf file; Step 4 now clearly states placeholders must be substituted before running
- **inotify-tools install**: added non-sudo fallback and manual install prompt for
  environments without elevated permissions

---

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Using a predictable file in /tmp as a coordination flag can enable tampering by other local processes or users on the same host. If the scripts trust that flag without ownership and symlink checks, an attacker may spoof restart state, suppress or alter notifications, or interfere with guardian control flow.

Content

Scanner excerpt · CHANGELOG.md (reported line 151)May include surrounding context.

md
- Startup validation is also skipped while maintenance mode is active

- **Upgrade-aware notifications**
  - New managed restart flag type `upgrade` (write `echo "upgrade" > /tmp/guardian-managed-restart` before upgrading)
  - When gateway recovers after an upgrade, notification reads "OpenClaw upgrade detected — gateway restarted automatically" instead of the generic restart message
  - Distinguishes planned upgrade restarts from crash recovery and manual restarts

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The notification text tells users to forward the full alert back to the AI, and the example includes timestamps, backup names, and recent operational logs. This encourages exfiltration of environment and diagnostic details into model context, where they may be retained, processed by other tools, or used to guide further system actions.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This repeated instruction reinforces a workflow where users disclose recovery alerts directly to the AI, increasing the likelihood that sensitive runtime details are pasted into chat. Because the surrounding examples include failure context and service state, the practice meaningfully raises the chance of unnecessary information disclosure.

Content

No source excerpt is available for this finding.