Back to skill

Security audit

Agent Guardian

Security checks for vulnerabilities and agentic risk

Overview

This skill is a real monitoring/status tool, but it installs persistent host-level components and patches message-handling code in ways that can expose the host to unsafe command execution and overbroad control.

Review this carefully before installing. Only use it on a test or dedicated host, do not run the installer as root unless you fully accept the persistent service and cron changes, and avoid applying the QQ bot patch until the shell-based execSync calls, /tmp state files, root systemd unit, installer validation, and uninstall path are fixed.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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 (5)

T06 · System Persistence

Error
Location
scripts/install.sh:70
Finding

Persistent system service and scheduled task run with excessive privileges

Content
View full analysis
/dev/null | grep -v "$CRON_MARKER" > /tmp/crontab-guardian.tmp || true echo "*/$REPORT_INTERVAL * * * * $SCRIPT_DIR/smart-status-report.sh >> /tmp/status-report.log 2>&1 $CRON_MARKER" >> /tmp/crontab-guardian.tmp crontab /tmp/crontab-guardian.tmp rm -f /tmp/crontab-guardian.tmp if command -v systemctl &>/dev/null && command -v inotifywait &>/dev/null; then cat > /etc/systemd/system/agent-guardian-query.service << EOF [Unit] Description=Agent Guardian Status Query Daemon After=network.target [Service] Type=simple ExecStart=$SCRIPT_DIR/status-query-daemon.sh Restart=always RestartSec=5 User=root [Install] WantedBy=multi-user.target EOF systemctl daemon-reload systemctl enable agent-guardian-query.service 2>/dev/null systemctl restart agent-guardian-query.service fi ``` ### Technical Analysis The installer creates two cross-session persistence mechanisms: 1. A recurring crontab entry that invokes `smart-status-report.sh`. 2. A boot-enabled systemd service configured with `Restart=always`. Scheduling and background monitoring are consistent with the Skill's declared status-reporting functionality. However, running the query daemon explicitly as `root` and installing it as a system-wide service exceed the minimum privileges needed to read Skill-owned state and invoke the OpenClaw command-line client. The service executes its script directly from the Skill installation directory. If that directory or script can later be modified by a less-privileged account, the systemd service turns such write access into persistent root code execution. The installer also provides no corresponding uninstall or rollback procedure. ### Attack Path 1. The installer is executed with sufficient privileges to write und ...[truncated 840 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/patches/qqbot.md:18
Finding

Remote command injection through QQ Bot message hooks

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/install.sh:16
Finding

Installer input can inject cron entries and corrupt configuration

Content
View full analysis
/tmp/agent-guardian-config.json << EOF { "channel": "$CHANNEL", "target": "$TARGET", "report_interval": $REPORT_INTERVAL, "watchdog_interval": $WATCHDOG_INTERVAL, "installed_at": "$(date -Iseconds)", "skill_dir": "$SKILL_DIR" } EOF ``` ```bash CRON_MARKER="# agent-guardian" crontab -l 2>/dev/null | grep -v "$CRON_MARKER" > /tmp/crontab-guardian.tmp || true echo "*/$REPORT_INTERVAL * * * * $SCRIPT_DIR/smart-status-report.sh >> /tmp/status-report.log 2>&1 $CRON_MARKER" >> /tmp/crontab-guardian.tmp crontab /tmp/crontab-guardian.tmp ``` ### Technical Analysis The installer accepts channel, target, and interval values without format validation. It interpolates them directly into both JSON and a crontab file. A report interval containing newline characters can terminate the intended cron line and add an additional scheduled command. The resulting file is then activated by `crontab`. If installation is performed as root, the injected cron command also runs as root. Similarly, quotes, backslashes, or newlines in `CHANNEL` or `TARGET` can produce malformed or attacker-modified JSON because the script does not use a JSON encoder. `WATCHDOG_INTERVAL` and `REPORT_INTERVAL` are inserted as unquoted JSON values, allowing structural modification of the generated object. ### Attack Path 1. The installer is invoked interact ...[truncated 834 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/update-work-state.sh:8
Finding

Task descriptions are interpolated into executable Python source

Content
View full analysis
"`. 3. The shell expands `$TASK` inside t ...[truncated 604 chars]
Remediation
View remediation
&2; exit 1 ;; esac python3 "$SCRIPT_DIR/update-work-state.py" \ "$STATUS" "$TASK" "$IS_ERROR" "$NOW" ``` The Python script should then use: ```python status, task, is_error, now = sys.argv[1:5] ``` - Write the JSON atomically to a temporary file in a protected state directory and replace the destination only after serialization succeeds. - Add tests with quotes, backslashes, newlines, semicolons, and Python expressions in task descriptions. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/status-query-daemon.sh:11
Finding

Privileged daemon trusts predictable files in shared temporary storage

Content
View full analysis
/tmp/status-query-daemon.pid ``` ```bash log "Daemon started (PID $$)" touch "$TRIGGER_FILE" while true; do inotifywait -q -e modify "$TRIGGER_FILE" 2>/dev/null if [ -f "$TRIGGER_FILE" ]; then TARGET=$(python3 -c " import json with open('$TRIGGER_FILE') as f: d = json.load(f) print(d.get('from', '')) " 2>/dev/null) if [ -n "$TARGET" ]; then log "Trigger from $TARGET" send_status "$TARGET" fi fi done ``` The installer also uses a predictable shared temporary path: ```bash crontab -l 2>/dev/null | grep -v "$CRON_MARKER" > /tmp/crontab-guardian.tmp || true echo "*/$REPORT_INTERVAL * * * * $SCRIPT_DIR/smart-status-report.sh >> /tmp/status-report.log 2>&1 $CRON_MARKER" >> /tmp/crontab-guardian.tmp crontab /tmp/crontab-guardian.tmp rm -f /tmp/crontab-guardian.tmp ``` ### Technical Analysis The systemd unit runs `status-query-daemon.sh` as root, but the daemon exchanges commands through a predictable file in world-shared `/tmp`. It does not verify the file's owner, mode, type, or origin, and it accepts the `from` field as an outbound message target without confirming that the value matches an authorized identity. A local attacker can pre-create the trigger path before the service starts, retain write access to it, and then supply arbitrary trigger JSON. Symbolic-link and replacement races are also possible because path validation and atomic file creation are absent. The installer independently redirects privileged output into the predictable `/tmp/crontab-guardian.tmp` path. If an attacke ...[truncated 1369 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (43)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The described installation model includes crontab changes, systemd service creation, package installation, writes under /etc/systemd/system, and persistent background execution, yet those system-level effects are not transparently surfaced in the declared behavior. Hidden persistence and privileged modification materially increase risk because they can survive restarts and alter host behavior outside normal skill boundaries.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The described installation model includes crontab changes, systemd service creation, package installation, writes under /etc/systemd/system, and persistent background execution, yet those system-level effects are not transparently surfaced in the declared behavior. Hidden persistence and privileged modification materially increase risk because they can survive restarts and alter host behavior outside normal skill boundaries.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The described installation model includes crontab changes, systemd service creation, package installation, writes under /etc/systemd/system, and persistent background execution, yet those system-level effects are not transparently surfaced in the declared behavior. Hidden persistence and privileged modification materially increase risk because they can survive restarts and alter host behavior outside normal skill boundaries.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The described installation model includes crontab changes, systemd service creation, package installation, writes under /etc/systemd/system, and persistent background execution, yet those system-level effects are not transparently surfaced in the declared behavior. Hidden persistence and privileged modification materially increase risk because they can survive restarts and alter host behavior outside normal skill boundaries.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The described installation model includes crontab changes, systemd service creation, package installation, writes under /etc/systemd/system, and persistent background execution, yet those system-level effects are not transparently surfaced in the declared behavior. Hidden persistence and privileged modification materially increase risk because they can survive restarts and alter host behavior outside normal skill boundaries.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The described installation model includes crontab changes, systemd service creation, package installation, writes under /etc/systemd/system, and persistent background execution, yet those system-level effects are not transparently surfaced in the declared behavior. Hidden persistence and privileged modification materially increase risk because they can survive restarts and alter host behavior outside normal skill boundaries.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The patch injects shell-based subprocess execution into message handling for routine text filtering. It builds shell commands with message-derived content and invokes external interpreters/scripts, unnecessarily expanding the attack surface to command injection, interpreter abuse, and denial-of-service risks in a channel integration that should not require shelling out.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The patch allows inbound chat content matching /new or /reset to trigger execution of a local shell script. That creates a conversation-driven command path from untrusted user input to host-side state-changing code, enabling abuse, repeated resets, and possible privilege or availability impacts depending on what the script does.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The patch injects execSync-based shell and Python execution directly into the QQ bot plugin, causing inbound and outbound message handling to spawn subprocesses on user-controlled content paths. This materially expands the bot's attack surface, creates command-execution and reliability risks, and modifies a third-party plugin in ways not justified by a simple guardian/status feature set.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The injected checkAndResetWorkState function lets message content trigger execution of a local reset script, effectively granting chat-driven operational control over bot state. Even if intended as convenience, binding administrative reset behavior to user input is dangerous because it can be abused to disrupt service or alter state unexpectedly.

Content

No source excerpt is available for this finding.

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 · scripts/install.sh (reported line 77)May include surrounding context.

sh
# 添加新条目
echo "*/$REPORT_INTERVAL * * * * $SCRIPT_DIR/smart-status-report.sh >> /tmp/status-report.log 2>&1 $CRON_MARKER" >> /tmp/crontab-guardian.tmp
crontab /tmp/crontab-guardian.tmp
rm -f /tmp/crontab-guardian.tmp
echo "✅ 系统 crontab 配置完成(每${REPORT_INTERVAL}分钟汇报)"

# ===== 6. 配置 systemd 守护进程(即时状态查询) =====

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill documentation clearly instructs execution of shell scripts, cron jobs, plugin patching, and filesystem interaction, but it declares no tool scope or permissions. This creates an authorization gap where a reviewer or runtime may underestimate the skill's capabilities, increasing the chance of unintended file modification or command execution when the skill is enabled.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill is triggered by broad complaint-like phrases such as users saying they waited too long or do not know what the agent is doing. Loose activation criteria can cause the skill to run during ordinary conversation, unexpectedly invoking shell-backed monitoring or state-changing workflows without clear user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill enforces Chinese-language consistency and outbound filtering without documented user choice, opt-in, or exception handling. Automatic rewriting of user-visible messages can distort meaning, suppress legitimate mixed-language content, and create integrity risks in technical or multilingual contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest advertises a 'language consistency filter' without any indication of user preference, consent, or opt-in. In an agent skill, forced language normalization can override user intent, alter meaning, or suppress multilingual communication, creating integrity and usability risks that may affect accessibility or cause the assistant to mis-handle user requests.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The document instructs integrators to persist user activity timestamps and inferred message language into predictable /tmp files, but provides no notice, retention limits, access controls, or isolation guidance. On multi-user systems, /tmp is typically shared and prone to unintended disclosure, tampering, or symlink abuse if files are not created safely, making this a real privacy and integrity risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document specifies a language filter that replaces English mixing in Chinese context and warns on fully English replies to Chinese users. This is a natural-language locale constraint, but the file does not indicate user opt-in, configurable language preference, or a documented region-specific justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The document instructs operators to patch external gateway source files and write state into host filesystem locations such as /tmp. In context this is not direct exploit code by itself, but it broadens the skill's scope from UX monitoring into invasive host modification, increasing persistence, coupling, and the chance of insecure deployment patterns.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The patch introduces hidden side effects—subprocess launches, script execution, and filesystem writes—during normal message processing without user or operator-facing warnings in the guide. This lack of transparency increases deployment risk because maintainers may apply the patch without understanding the new trust boundaries and host-level behaviors it adds.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document introduces a 'language consistency filter' and outbound language checks that alter or constrain replies based on detected user language. This is a natural-language policy concern because it imposes a language/locale behavior without any indication of user preference, opt-in, or justified region-specific requirement.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document records language metadata, queue data, and activity/status artifacts derived from user messages into predictable local files but omits privacy and retention guidance. Even if the stored content is partial or indirect, it can leak behavioral and message-derived data to other local processes or persist longer than intended.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest presents a general cross-channel guardian skill, but this script directly modifies and recompiles a specific QQ bot plugin under /root. That mismatch is security-relevant because it hides invasive platform-specific source patching behind a much broader and less alarming description, reducing operator awareness of the actual trust impact.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script silently edits gateway.ts and outbound.ts, inserts new runtime behavior, and instructs recompilation, all without interactive confirmation or a clear warning about the security and operational consequences. This is dangerous because operators may unknowingly deploy invasive code changes that affect message handling, subprocess execution, and local state management.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The injected behavior processes message content, launches subprocesses, writes tracking files, and alters outbound text, yet the script does not clearly disclose these actions to the installer. Hidden message processing and command execution are especially risky in a messaging bot because they affect untrusted inputs at runtime and may expose user data or destabilize service.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The injected code writes user activity timestamps, language metadata, and status-trigger artifacts into /tmp without disclosure or clear lifecycle controls. This creates unintended persistence of user-derived data, can leak operational state to other local processes, and introduces tampering opportunities if other components trust those files.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/apply-qqbot-patch.sh:30