Back to skill

Security audit

Home Assistant Control

Security checks for vulnerabilities and agentic risk

Overview

This Home Assistant skill is coherent and not malicious, but it needs Review because it can control physical devices with a long-lived token and may send that token over HTTP if configured that way.

Install only if you are comfortable giving the skill a Home Assistant token that can inspect and control your configured devices. Use HTTPS for any public or remote URL, keep the token narrowly permissioned where possible, avoid --yes for locks, alarms, covers, doors, or climate actions unless you explicitly requested that action, and treat generated reference files as private household metadata.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/ha_call.sh:42
Finding

Long-Lived Home Assistant Token Can Be Transmitted over Plaintext HTTP

Content
View full analysis
&2 exit 1 fi done attempt_request() { local base_url="$1" if [[ "$METHOD" == "GET" ]]; then curl -sS \ --connect-timeout 8 \ --max-time 20 \ -H "Authorization: Bearer $HA_TOKEN" \ -H "Content-Type: application/json" \ "$base_url$PATH_PART" else curl -sS -X "$METHOD" \ --connect-timeout 8 \ --max-time 20 \ -H "Authorization: Bearer $HA_TOKEN" \ -H "Content-Type: application/json" \ -d "$DATA" \ "$base_url$PATH_PART" fi } ``` ### Technical Analysis The URL validation explicitly accepts both HTTPS and plaintext HTTP destinations. Every request then places the long-lived Home Assistant token in the `Authorization` header. Plaintext HTTP provides neither transport confidentiality nor server authentication. Although HTTP can be reasonable for an intentionally trusted local Home Assistant network, the implementation does not restrict it to loopback, link-local, or private-network addresses. It can therefore send the token to a public or otherwise untrusted HTTP endpoint configured through `HA_URL`, `HA_URL_LOCAL`, or `HA_URL_PUBLIC`. The network operation itself is necessary for the declared functionality. In particular, `scripts/ha_entity_find.sh` legitimately calls `GET /api/states` and filters the returned entity data locally. The security issue is not the presence of network access, but the absence of sufficiently strict transport protection for the bearer credential. ### Attack Path 1. A user configures a Home Assistant URL using `http://`, or an attacker modifies the relevant enviro ...[truncated 1159 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/self_check.sh:87
Finding

Predictable Temporary Error File Enables Local Symlink Clobbering

Content
View full analysis
/tmp/ha_self_check_err.$$ || true)" # curl transport failure => try fallback if [[ "$HTTP_CODE" == "000" || -z "$HTTP_CODE" ]]; then LAST_TRANSPORT_ERR="$(cat /tmp/ha_self_check_err.$$ 2>/dev/null || true)" if [[ "$i" -lt $((${#CANDIDATES[@]} - 1)) ]]; then warn "Primary URL unreachable, trying fallback..." continue fi fi USED_URL="$base" break done rm -f /tmp/ha_self_check_err.$$ 2>/dev/null || true ``` ### Technical Analysis The script redirects curl diagnostics to `/tmp/ha_self_check_err.$$`, where `$$` is the shell process ID. Process IDs are predictable and the shared `/tmp` directory is normally writable by other local users. The shell opens the path for output without securely creating it first. If another local user pre-creates that pathname as a symbolic link, the redirection follows the link and truncates or overwrites its target using the privileges of the user running the Skill. The later `rm -f` only removes the pathname and does not prevent the earlier unsafe open. The script already uses `mktemp` safely for the response body, so the separate predictable error file is unnecessary. ### Attack Path 1. A local attacker predicts or observes a likely process ID for an upcoming `self_check.sh` execution. 2. The attacker creates `/tmp/ha_self_check_err.` as a symbolic link to a file writable by the victim account. 3. The victim runs `scripts/self_check.sh` with the predicted PID. 4. Shell redirection opens the symbolic-link target with truncation before curl starts. 5. The target file is truncated and may receive curl diagnostic text. 6. T ...[truncated 810 chars]
Remediation
View remediation
"$TMP_ERR" || true)" ``` 3. Read diagnostics from `"$TMP_ERR"` and rely on the existing `EXIT` trap for cleanup. 4. Set a restrictive `umask`, such as `umask 077`, before creating temporary files containing operational data. 5. Avoid constructing any temporary filename from process IDs, timestamps, usernames, or other predictable values. 6. Do not run the Skill as root or another privileged system account unless strictly necessary. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared purpose focuses on controlling and inspecting Home Assistant, but the skill also maintains local reference and naming-context files derived from Home Assistant data. This hidden persistence expands the data-handling surface by writing potentially sensitive household metadata to disk, which users may not expect from the description and which could be accessed later by other tools or sessions.

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

md
# Home Assistant Control

Use Home Assistant REST API with a long-lived access token.

## Requirements

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `scripts/ha_call.sh` and `scripts/self_check.sh` load env file only when `HA_ENV_FILE` is provided.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `scripts/ha_call.sh` and `scripts/self_check.sh` load env file only when `HA_ENV_FILE` is provided.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `scripts/ha_entity_find.sh` — search entities by partial entity id or friendly name.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `scripts/ha_entity_find.sh` — search entities by partial entity id or friendly name.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `scripts/ha_entity_find.sh` — search entities by partial entity id or friendly name.

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/self_check.sh (reported line 105)May include surrounding context.

sh
break
done

rm -f /tmp/ha_self_check_err.$$ 2>/dev/null || true

if [[ -z "$USED_URL" ]]; then
  err "No HTTP status returned from any configured URL."

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% 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 · README.md (reported line 37)May include surrounding context.

Example private env file

Create a private file (example ~/.openclaw/private/home-assistant.env), then set:

bash
export HA_ENV_FILE="$HOME/.openclaw/private/home-assistant.env"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises shell-based scripts and operational capabilities but does not declare any explicit tool scope or permissions boundary. In agent environments, missing scope declarations can let a broadly empowered runtime execute shell actions beyond what users or platform policy expect, increasing the risk of unintended command execution or misuse.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/ha_call.sh (reported line 54)May include surrounding context.

sh
local base_url="$1"

  if [[ "$METHOD" == "GET" ]]; then
    curl -sS \
      --connect-timeout 8 \
      --max-time 20 \
      -H "Authorization: Bearer $HA_TOKEN" \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script performs network calls with curl and includes an Authorization bearer token header, and POST requests may also send arbitrary JSON payload data. While the code validates inputs and logs fallback behavior, it provides no confirmation prompt, user-facing notice, or explanatory comment/docstring warning that credentials and potentially sensitive data will be transmitted to a remote endpoint.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/ha_safe_action.sh (reported line 28)May include surrounding context.

sh
Usage: ha_safe_action.sh <domain> <service> <entity_id> [json_payload] [options]

Options:
  --yes         Skip confirmation prompts
  --dry-run     Print payload only, do not execute
  -h, --help    Show this help

Static analysis

No suspicious patterns detected.