Back to skill

Security audit

Heartbeat Ollama Guard

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-aligned but installs a persistent service that rewrites OpenClaw configuration and includes unsafe setup and notification handling that users should review carefully.

Install only if you intentionally want an always-running local guard that can overwrite OpenClaw heartbeat configuration. Prefer safer Ollama installation steps instead of curl piped to sh, review the generated guard files, keep heartbeat-guard.conf.json writable only by your user, and use --uninstall if you no longer want the background service.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
Findings (3)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:42
Finding

Unverified Remote Installer Is Piped Directly into a Shell

Content
View full analysis
Remediation
View remediation
' printf '%s %s\n' '' 'ollama-install.sh' | sha256sum -c - less ollama-install.sh sh ollama-install.sh ``` The checksum must be obtained through a trusted, independently authenticated release channel rather than from the same mutable response as the installer. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
heartbeat_ollama_guard.py:99
Finding

Unescaped Notification Data Can Be Interpreted as AppleScript Code

Content
View full analysis
Remediation
View remediation

T06 · System Persistence

Warning
Location
heartbeat_ollama_guard.py:458
Finding

Setup Installs a Cross-Session Persistent Configuration-Rewriting Service

Content
View full analysis
ProgramArguments /usr/bin/python3 {guard_script} KeepAlive RunAtLoad ... """ ``` The Linux service is configured to restart and is installed into the default user target: ```python SYSTEMD_CONTENT = """\ [Unit] Description=OpenClaw Heartbeat Guard After=network.target [Service] Type=simple ExecStart=/usr/bin/python3 {guard_script} Restart=always RestartSec=10 StandardOutput=append:{lib_dir}/heartbeat-guard-stdout.log StandardError=append:{lib_dir}/heartbeat-guard-stderr.log [Install] WantedBy=default.target """ ``` Setup writes and enables the service: ```python def deploy_systemd() -> bool: SYSTEMD_SERVICE.parent.mkdir(parents=True, exist_ok=True) content = SYSTEMD_CONTENT.format( guard_script=GUARD_SCRIPT, lib_dir=LIB_DIR, ) try: SYSTEMD_SERVICE.write_text(content) except Exception as e: print(f" [ERROR] 写 systemd service 失败: {e}") return False run(["systemctl", "--user", "daemon-reload"], capture_output=True) run(["systemctl", "--user", "enable", "openclaw-heartbeat-guard"], capture_output=True) r = run(["systemctl", "--user", "start", "openclaw-heartbeat-guard"], capture_output=True) return r.returncode == 0 ``` The persistent daemon periodically rewrites configured JSON paths when their values differ: ```python actual = get_nested(cfg_data, dot_path) if actual == expected: continue set_nested(cfg_data, dot_path, expected) if save_json(cfg_path, cfg_data): log(f"[REVERT] 已回滚 {cfg_path.name} {dot_path} → {expecte ...[truncated 2432 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (34)

External Script Fetching

High
Category
Supply Chain
Confidence
98% confidence
Finding

The documentation instructs users to fetch and execute a remote shell script directly from the internet using curl piped to sh. This is dangerous because any compromise of the remote server, DNS/TLS interception, or malicious upstream change results in immediate arbitrary code execution on the user's machine.

Content

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

Linux:

bash
curl -fsSL https://ollama.com/install.sh | sh

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The '| sh' construct is a classic command-chaining risk because it turns downloaded content into immediate code execution without verification or review. In this skill's context, the danger is amplified because the command is presented as a normal setup step, increasing the chance that users execute it reflexively.

Content

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

Linux:

bash
curl -fsSL https://ollama.com/install.sh | sh

External Script Fetching

High
Category
Supply Chain
Confidence
95% confidence
Finding

The generated README instructs users to install software by piping a remote script directly into a shell (curl ... | sh). This bypasses normal verification and makes users vulnerable to supply-chain compromise, MITM in misconfigured environments, or malicious changes on the remote host, especially because the command is presented as a recommended installation step in a trusted setup guide.

Content

Scanner excerpt · generate_readme_cn.py (reported line 82)May include surrounding context.

python
p2 = doc.add_paragraph(style="List Bullet")
    p2.add_run("Linux:").bold = True
    p2.add_run("  curl -fsSL https://ollama.com/install.sh | sh")

    doc.add_paragraph()
    doc.add_paragraph("第二步:运行安装向导")

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 603)May include surrounding context.

python
print("  请先安装 Ollama:")
        print("    macOS:  brew install ollama")
        print("            或访问 https://ollama.com 下载")
        print("    Linux:  curl -fsSL https://ollama.com/install.sh | sh")
        print()
        print("  安装完成后,重新运行:")
        print("    python3 heartbeat_ollama_guard.py --setup")

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file forces a single language for all user-facing instructions and safety disclosures, which can violate language/locale policy when no opt-in or alternative language is provided. There is no indication that the skill is intended only for a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

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 · SKILL.md (reported line 95)May include surrounding context.

md
| 写入 openclaw.json | 仅 `heartbeat.model` + `models.providers.local` 字段 |
| 守卫守护进程 | 纯本地,60s 轮询,**无网络请求** |
| macOS 系统通知 | 仅守卫检测到未授权改动时触发 |
| 不需要 sudo | ✅ |
| 不读取对话内容 | ✅ |
| 不访问外部 API | ✅ |

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The skill installs persistent user-level background execution via LaunchAgent/systemd to monitor and overwrite configuration changes every 60 seconds. Persistence is security-relevant because it survives the initial run, continues modifying files without fresh user consent, and can be repurposed or abused if the installed script or config is later tampered with.

Content

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

md
| `~/.openclaw/workspace/.lib/heartbeat-guard.py` | 守卫守护进程脚本 |
| `~/.openclaw/workspace/.lib/heartbeat-guard.conf.json` | 守卫授权配置 |
| `~/.openclaw/workspace/.lib/heartbeat-guard.log` | 守卫运行日志 |
| `~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist` | macOS LaunchAgent |
| `~/.config/systemd/user/openclaw-heartbeat-guard.service` | Linux systemd |
| `~/.openclaw/workspace/.lib/.hog_backups/` | openclaw.json 备份 |

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
76% confidence
Finding

This manifest describes broad capabilities such as '一键安装' and automatic configuration/guard behavior, but does not specify explicit invocation conditions, boundaries, or exclusion cases. In a manifest file, this lack of trigger specificity can make it unclear when the skill should be selected versus other system-management skills.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring explicitly states it generates a Chinese README, and the document content is written in Chinese throughout. Under the policy, forcing a specific language without user opt-in or a documented justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · generate_readme_cn.py (reported line 177)May include surrounding context.

python
("~/.openclaw/workspace/.lib/heartbeat-guard.py", "守卫守护进程脚本(由安装向导生成)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.conf.json", "守卫授权配置(含所有受保护实例)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.log", "守卫运行日志"),
        ("~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist", "macOS LaunchAgent 配置"),
        ("~/.config/systemd/user/openclaw-heartbeat-guard.service", "Linux systemd 服务"),
        ("~/.openclaw/workspace/.lib/.hog_backups/", "openclaw.json 自动备份目录"),
    ]

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 461)May include surrounding context.

python
("~/.openclaw/workspace/.lib/heartbeat-guard.py", "守卫守护进程脚本(由安装向导生成)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.conf.json", "守卫授权配置(含所有受保护实例)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.log", "守卫运行日志"),
        ("~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist", "macOS LaunchAgent 配置"),
        ("~/.config/systemd/user/openclaw-heartbeat-guard.service", "Linux systemd 服务"),
        ("~/.openclaw/workspace/.lib/.hog_backups/", "openclaw.json 自动备份目录"),
    ]

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 463)May include surrounding context.

python
("~/.openclaw/workspace/.lib/heartbeat-guard.py", "守卫守护进程脚本(由安装向导生成)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.conf.json", "守卫授权配置(含所有受保护实例)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.log", "守卫运行日志"),
        ("~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist", "macOS LaunchAgent 配置"),
        ("~/.config/systemd/user/openclaw-heartbeat-guard.service", "Linux systemd 服务"),
        ("~/.openclaw/workspace/.lib/.hog_backups/", "openclaw.json 自动备份目录"),
    ]

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 492)May include surrounding context.

python
("~/.openclaw/workspace/.lib/heartbeat-guard.py", "守卫守护进程脚本(由安装向导生成)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.conf.json", "守卫授权配置(含所有受保护实例)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.log", "守卫运行日志"),
        ("~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist", "macOS LaunchAgent 配置"),
        ("~/.config/systemd/user/openclaw-heartbeat-guard.service", "Linux systemd 服务"),
        ("~/.openclaw/workspace/.lib/.hog_backups/", "openclaw.json 自动备份目录"),
    ]

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 523)May include surrounding context.

python
("~/.openclaw/workspace/.lib/heartbeat-guard.py", "守卫守护进程脚本(由安装向导生成)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.conf.json", "守卫授权配置(含所有受保护实例)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.log", "守卫运行日志"),
        ("~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist", "macOS LaunchAgent 配置"),
        ("~/.config/systemd/user/openclaw-heartbeat-guard.service", "Linux systemd 服务"),
        ("~/.openclaw/workspace/.lib/.hog_backups/", "openclaw.json 自动备份目录"),
    ]

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 689)May include surrounding context.

python
("~/.openclaw/workspace/.lib/heartbeat-guard.py", "守卫守护进程脚本(由安装向导生成)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.conf.json", "守卫授权配置(含所有受保护实例)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.log", "守卫运行日志"),
        ("~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist", "macOS LaunchAgent 配置"),
        ("~/.config/systemd/user/openclaw-heartbeat-guard.service", "Linux systemd 服务"),
        ("~/.openclaw/workspace/.lib/.hog_backups/", "openclaw.json 自动备份目录"),
    ]

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 834)May include surrounding context.

python
("~/.openclaw/workspace/.lib/heartbeat-guard.py", "守卫守护进程脚本(由安装向导生成)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.conf.json", "守卫授权配置(含所有受保护实例)"),
        ("~/.openclaw/workspace/.lib/heartbeat-guard.log", "守卫运行日志"),
        ("~/Library/LaunchAgents/com.openclaw.heartbeat-guard.plist", "macOS LaunchAgent 配置"),
        ("~/.config/systemd/user/openclaw-heartbeat-guard.service", "Linux systemd 服务"),
        ("~/.openclaw/workspace/.lib/.hog_backups/", "openclaw.json 自动备份目录"),
    ]

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This Python skill presents its primary docstring, usage guidance, prompts, status messages, and warnings in Chinese, which imposes a specific language on users. The file does not provide any opt-in, alternative locale, or justification that the skill is intended only for a Chinese-speaking or region-specific environment.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The script is explicitly designed to install persistent user-level components via LaunchAgent or systemd user services, causing code to run automatically after setup. Persistence is security-relevant because it creates a long-lived background process that continuously monitors and rewrites configuration, and users may not fully understand that behavior or be able to easily detect tampering if the script or its config is later modified.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 40)May include surrounding context.

python
GUARD_BACKUP_DIR= LIB_DIR / ".hog_backups"

LAUNCHAGENT_LABEL  = "com.openclaw.heartbeat-guard"
LAUNCHAGENT_PLIST  = Path.home() / "Library" / "LaunchAgents" / f"{LAUNCHAGENT_LABEL}.plist"
SYSTEMD_SERVICE    = Path.home() / ".config" / "systemd" / "user" / "openclaw-heartbeat-guard.service"

OPENCLAW_PROVIDER_KEY = "local"

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The script is explicitly designed to install persistent user-level components via LaunchAgent or systemd user services, causing code to run automatically after setup. Persistence is security-relevant because it creates a long-lived background process that continuously monitors and rewrites configuration, and users may not fully understand that behavior or be able to easily detect tampering if the script or its config is later modified.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 40)May include surrounding context.

python
GUARD_BACKUP_DIR= LIB_DIR / ".hog_backups"

LAUNCHAGENT_LABEL  = "com.openclaw.heartbeat-guard"
LAUNCHAGENT_PLIST  = Path.home() / "Library" / "LaunchAgents" / f"{LAUNCHAGENT_LABEL}.plist"
SYSTEMD_SERVICE    = Path.home() / ".config" / "systemd" / "user" / "openclaw-heartbeat-guard.service"

OPENCLAW_PROVIDER_KEY = "local"

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 244)May include surrounding context.

python
def run(cmd, **kw) -> subprocess.CompletedProcess:
    return subprocess.run(cmd, **kw)


def get_nested(obj: dict, dotted_path: str):

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

The embedded plist content defines a persistent LaunchAgent that will auto-run the guard on login and keep it alive. Even though this appears intended for a defensive use case, persistence materially increases risk if the deployed script or configuration is replaced or abused, because it ensures recurring execution without further user action.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 459)May include surrounding context.

python
# ── launchagent / systemd ──────────────────────────────────────────────────────

PLIST_CONTENT = """\
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 461)May include surrounding context.

python
PLIST_CONTENT = """\
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 515)May include surrounding context.

python
PLIST_CONTENT = """\
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 571)May include surrounding context.

python
PLIST_CONTENT = """\
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · heartbeat_ollama_guard.py (reported line 573)May include surrounding context.

python
PLIST_CONTENT = """\
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>