Back to skill

Security audit

HeartAI

Security checks for vulnerabilities and agentic risk

Overview

HeartAI is a disclosed remote community integration, but users should understand it registers an agent, stores an API key locally, and sends potentially sensitive mental-health content to HeartAI servers.

Before installing, be comfortable with a local setup script registering your agent with HeartAI, sending an agent name derived from your environment/config/hostname if you do not set one, and storing a HeartAI API key in your home directory. Treat posts, comments, chats, and heartbeat data as information sent to a remote mental-health community service; avoid sharing sensitive content unless you trust that service's privacy practices.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/setup.sh:15
Finding

Unescaped Agent Name Allows JSON Request-Body Injection

Content
View full analysis
/dev/null || echo "") fi [ -z "$AGENT_NAME" ] && AGENT_NAME=$(hostname | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g') echo "🤖 Registering $AGENT_NAME on HeartAI..." RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$HEARTAI_URL/api/agents/register" \ -H "Content-Type: application/json" \ -d "{\"agentName\": \"$AGENT_NAME\", \"description\": \"OpenClaw Agent\"}") ``` ### Technical Analysis The script obtains `AGENT_NAME` from the `OPENCLAW_AGENT_NAME` environment variable or the local `~/.openclaw/config.yaml` file and directly interpolates it into a JSON string. It does not apply JSON escaping or enforce an allowlist before constructing the request. An agent name containing quotation marks, backslashes, or JSON structural characters can terminate the intended string and add or alter properties in the registration payload. Shell command injection is not established because the expansion occurs inside a quoted shell argument; however, JSON request-body injection and malformed-request denial of service are possible. For example, an agent name shaped like: ```text name", "description": "attacker-controlled ``` would cause the script to construct a request body whose semantic content differs from the fixed registration object intended by the developer, subject to how the receiving server handles duplicate or modified properties. ### Attack Path 1. An attacker gains the ability to set `OPENCLAW_AGENT_NAME` in the setup process environment or modify the current user's `~/.openclaw/config.yaml`. 2. The attacker su ...[truncated 1110 chars]
Remediation
View remediation
/dev/null 2>&1; then echo "❌ jq is required to construct the registration request safely." exit 1 fi if [[ ! "$AGENT_NAME" =~ ^[a-zA-Z0-9._-]{1,64}$ ]]; then echo "❌ Invalid agent name." exit 1 fi PAYLOAD=$(jq -n \ --arg agentName "$AGENT_NAME" \ --arg description "OpenClaw Agent" \ '{agentName: $agentName, description: $description}') RESPONSE=$(curl --silent --show-error \ -w "\n%{http_code}" \ -X POST "$HEARTAI_URL/api/agents/register" \ -H "Content-Type: application/json" \ --data-binary "$PAYLOAD") ``` Apply the following additional hardening measures: 1. Enforce a documented allowlist and maximum length for agent names. 2. Use a YAML-aware parser rather than `grep` when reading `config.yaml`. 3. Reject control characters and unexpected multiline values. 4. Keep server-side schema validation enabled so unknown properties, malformed names, and duplicate sensitive fields are rejected. 5. Add tests covering quotation marks, backslashes, newlines, Unicode characters, oversized values, and attempted JSON-property injection. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description presents the skill as a community interaction feature, but the documented behavior also includes automatic remote registration, deriving identity from local environment/configuration, and storing API credentials locally. That mismatch is dangerous because users may approve a seemingly harmless social skill without understanding it will execute setup logic, establish an external account, and persist secrets on disk.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/setup.sh (reported line 39)May include surrounding context.

sh
chmod 600 "$KEY_FILE"
    echo "✅ Done! API Key saved to $KEY_FILE"
  else
    echo "❌ Could not extract API Key from response"
    exit 1
  fi
elif [ "$HTTP_CODE" = "409" ]; then

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill instructs the user to run a shell script (bash {baseDir}/scripts/setup.sh) but does not declare any tool scope or permissions that would make shell execution explicit. This creates a transparency and consent problem: the skill can trigger local code execution and likely performs networked registration and secret handling without clear permission boundaries.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The setup flow states that an API key will be saved to ~/.openclaw/secrets/heartai_api_key, and subsequent examples send user-generated content to a remote service, but this is not surfaced as a clear warning. In a mental-health context, that omission is particularly risky because sensitive emotional disclosures, chats, and community posts may be transmitted off-device while persistent credentials are stored locally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script derives an agent identifier from environment, local config, or hostname and sends it to a remote registration endpoint without meaningful disclosure beyond a status message. This leaks system- or user-identifying metadata to an external service and performs account creation automatically, which is risky in an agent skill context where setup scripts may run with little user scrutiny.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

This curl call sends data to an external internet service to register the agent and receive credentials. External transmission is not inherently malicious, but in this skill it is security-relevant because it creates a remote account and exchanges identifying information and secrets during setup.

Content

Scanner excerpt · scripts/setup.sh (reported line 24)May include surrounding context.

sh
echo "🤖 Registering $AGENT_NAME on HeartAI..."

RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$HEARTAI_URL/api/agents/register" \
  -H "Content-Type: application/json" \
  -d "{\"agentName\": \"$AGENT_NAME\", \"description\": \"OpenClaw Agent\"}")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script automatically writes a newly issued API key to disk in the user's home directory without explicit prior consent or an interactive warning. Even though the file is permissioned to 600, persisting credentials locally increases exposure to later compromise, accidental backup/sync leakage, or unintended reuse by other local processes running as the same user.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

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

Content

Scanner excerpt · scripts/setup.sh (reported line 36)May include surrounding context.

sh
if [ -n "$API_KEY" ]; then
    mkdir -p "$SECRETS_DIR"
    echo -n "$API_KEY" > "$KEY_FILE"
    chmod 600 "$KEY_FILE"
    echo "✅ Done! API Key saved to $KEY_FILE"
  else
    echo "❌ Could not extract API Key from response"

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The description and usage examples prominently mix English with Chinese and provide only Chinese sample content such as posts, comments, and chat messages. There is no statement that users may interact in other languages or that Chinese is a justified region-specific requirement, which can violate language/locale policy expectations.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.