Back to skill

Security audit

Agent Heartbeat

Security checks for vulnerabilities and agentic risk

Overview

This heartbeat skill does what it says, but it gives workspace configuration broad shell, network, scheduled-run, and file-write power that users should review carefully before installing.

Install only if you trust the workspace and will review every heartbeat.yaml command, endpoint, output path, and cache path before running. Avoid hardcoded API keys, restrict the runtime account and environment variables, keep outputs inside a generated-artifacts directory, and do not enable cron to automatically act on summaries without user confirmation.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/heartbeat.js:88
Finding

Unrestricted Shell Command Execution from Workspace Configuration

Content
View full analysis
{ const start = Date.now(); try { const output = execSync(check.command, { encoding: 'utf8', timeout: timeoutMs, stdio: ['ignore', 'pipe', 'pipe'], shell: true, env: { ...process.env }, }).trim(); resolve({ ...check, ok: true, output, ms: Date.now() - start }); ``` ### Technical Analysis The `command` property is read from the workspace-controlled `heartbeat.yaml` configuration and passed directly to `execSync` with `shell: true`. No command allowlist, executable validation, configuration ownership check, or argument separation is applied. Because a shell interprets the entire value, the configuration can contain pipelines, substitutions, redirections, command separators, and arbitrary additional commands. The child process also receives a copy of the complete parent environment through `env: { ...process.env }`. Any API keys, tokens, credentials, or sensitive configuration stored in environment variables are therefore accessible to the configured command. Although command execution is part of the Skill's documented purpose, the configuration is effectively executable code. Treating an untrusted or insufficiently protected workspace configuration as ordinary data creates a command-injection boundary. The scheduled execution workflow documented in `SKILL.md:58-64` increases the exposure because a malicious configuration may execute repeatedly without interactive review. ### Attack Path 1. An attacker, compromised tool, malicious repository contribution, or other untrusted process gains the ability to create or modify `heartbeat.yaml`. 2. The attacker inserts a shell payload into a collector ...[truncated 1013 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/heartbeat.js:176
Finding

Indirect Prompt Injection Through Untrusted Collector Output

Content
View full analysis
{ const val = key.split('.').reduce((o, k) => o?.[k], parsed); return val !== undefined ? String(val) : ''; }); } catch {} } return result; } ``` From `scripts/heartbeat.js:282-307`: ```javascript // Full summary — write to file const now = new Date().toISOString(); let md = `# Heartbeat Summary\n_${now}_ (${totalMs}ms)\n\n`; if (needsAction) { md += `## ⚠️ Action Needed\n\n`; for (const a of alerts) { const icon = a.level === 'critical' ? '🔴' : a.level === 'error' ? '❌' : a.level === 'warn' ? '🟡' : '🔵'; md += `- ${icon} **${a.name}**: ${a.summary}\n`; } md += '\n'; } else { md += `All clear. ${summaryLines.length} checks passed.\n\n`; } md += `## Details\n\n`; for (const s of summaryLines) { const icon = s.triggered ? (s.level === 'critical' ? '🔴' : s.level === 'error' ? '❌' : '🟡') : '✅'; md += `- ${icon} ${s.name} (${s.ms}ms)${s.summary ? ': ' + s.summary : ''}\n`; } ``` From `scripts/heartbeat.js:326-329`: ```javascript const outDir = path.dirname(path.resolve(outputPath)); fs.mkdirSync(outDir, { recursive: true }); fs.writeFileSync(path.resolve(outputPath), md); ``` The documented Agent workflow in `SKILL.md:58-64` is: ```bash openclaw cron add \ --name heartbeat \ --cron "0 * * * *" \ --me ...[truncated 2410 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/heartbeat.js:219
Finding

Configuration-Controlled File Writes Can Escape the Workspace

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/heartbeat.js

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/heartbeat.js

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill defines and promotes execution of arbitrary shell commands from heartbeat.yaml and includes network-capable examples, but the skill metadata declares no tool scope or permission boundaries. In an agent environment, this makes the skill easier to invoke with capabilities users may not expect, increasing the risk of unintended command execution, environment access, and outbound requests.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The description uses very broad trigger phrases such as automated monitoring, debugging heartbeat failures, and consistent check-everything behavior, which can cause the skill to be selected for many routine tasks. Because the skill can run parallel commands, make network calls, and write output files, over-broad invocation raises the chance of unnecessary or surprising privileged actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The examples embed network requests and even show an API key header inline, without warnings about secret handling, logging exposure, or data exfiltration. This normalizes putting credentials directly in config and sending potentially sensitive monitoring data to external services, which is especially risky in an agent skill that may be copied verbatim.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documentation states that the heartbeat writes a structured summary to an output file, but it does not warn that existing files may be overwritten or modified. In practice, a misconfigured output path could clobber workspace content, alter agent state, or corrupt files relied on by other automation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest describes a unified heartbeat/checking system, but this reference file explicitly defines collectors and health checks as arbitrary command strings to execute, including examples that perform external HTTP requests with API keys. While monitoring often needs to gather data, documenting unrestricted shell execution and credentialed network access goes beyond the narrow, LLM-oriented summary purpose stated in the manifest.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The examples encourage embedding outbound curl commands with API-key headers in heartbeat checks without any warning about secret exposure, destination trust, logging, or data egress. In a monitoring skill that runs automatically and potentially in parallel, this increases the chance that users will copy insecure patterns that send credentials or sensitive metadata to external services without understanding the risk.

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/heartbeat.js:89