Back to skill

Security audit

Homeassistant Mcp

Security checks for vulnerabilities and agentic risk

Overview

This Home Assistant skill needs review because it handles powerful smart-home access tokens and private camera data through hard-coded, plaintext shell commands.

Only install this if you intentionally trust the fixed Home Assistant endpoint, understand that a long-lived token may be passed through shell commands over HTTP, and are comfortable with camera snapshots and entity mappings being read or written in the workspace. Prefer a version that uses user-configured HTTPS endpoints, scoped credentials, native MCP tools, and explicit handling for saved images.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:7
Finding
Long-Lived Access Token Transmitted to a Hard-Coded Endpoint over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 7–27 **Vulnerability Type**: Plaintext credential transmission and hard-coded network destination **Risk Level**: Critical ### Vulnerable Code ```markdown The MCP server endpoint is `http://220.0.0.5:8123/api/mcp`. Ensure the connection is configured with the correct Long-Lived Access Token. ``` ```markdown Always use `exec` with `curl` to the REST API to get camera snapshots: `curl -s -H "Authorization: Bearer <TOKEN>" "http://220.0.0.5:8123/api/camera_proxy/camera.<entity_id>" -o /home/clawd/.openclaw/workspace/<filename>.jpg` ``` ```markdown - If MCP tools timeout, fallback to the REST API: `curl -H "Authorization: Bearer <TOKEN>" http://220.0.0.5:8123/api/states/<entity_id>` ``` ### Technical Analysis The Skill instructs the Agent to transmit a Home Assistant long-lived bearer token to the hard-coded IP address `220.0.0.5` using unencrypted HTTP. Because HTTP does not provide transport confidentiality or endpoint authentication, the authorization header, requested entity identifiers, camera images, and Home Assistant responses may be observed or modified by the destination operator or an attacker positioned on the network path. A bearer token grants access based solely on possession. Any party that captures the token can reuse it until it is revoked or expires. The declared integration does not require a fixed external IP address: a generic Home Assistant Skill should obtain its endpoint from explicit user configuration and should use authenticated HTTPS. Consequently, the hard-coded destination and plaintext token transmission exceed the minimum privileges and network exposure required for the declared functionality. The use of `exec` and `curl` also bypasses protections that may exist in the native MCP integration, including endpoint restrictions, credential isolation, and structured authorization controls. ### Attack Path 1. A user installs or activates the Skill and configu ...[truncated 1403 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the hard-coded `220.0.0.5` address and require the Home Assistant endpoint to be supplied through explicit, user-controlled configuration. 2. Require authenticated HTTPS for every request carrying credentials or sensitive Home Assistant data. Reject plaintext HTTP endpoints unless the user explicitly enables a narrowly scoped local-development exception. 3. Validate configured endpoints and default to loopback or expected private-network destinations where appropriate. Clearly warn users before communicating with public IP addresses. 4. Do not expose tokens in Agent-generated shell commands. Use a credential-safe MCP or HTTP integration that injects authorization data without placing it in generated command text, logs, or process arguments. 5. Prefer the native MCP integration instead of bypassing it through unrestricted `exec` and `curl`. If REST fallback is necessary, implement it as a constrained tool with destination allowlisting and fixed API paths. 6. Use a dedicated, least-privileged Home Assistant credential with only the permissions required by the Skill. Avoid administrator-level tokens. 7. Rotate and revoke any token that may already have been transmitted using these instructions, then review Home Assistant logs for suspicious API use. 8. Protect camera snapshots with restrictive file permissions and delete them promptly after use. ]]>

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:30
Finding
Unnecessary Access to Persistent Agent Memory Outside the Skill Package<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 30–31 **Vulnerability Type**: Excessive access to persistent workspace data **Risk Level**: Medium ### Vulnerable Code ```markdown ## Key Entities Review `/home/clawd/.openclaw/workspace/memory/home-assistant-entities.md` for a full list of areas and key entities. ``` ### Technical Analysis The Skill directs the Agent to read a fixed file from persistent workspace memory outside the Skill package. That file may contain household topology, room names, entity identifiers, device inventory, or other retained context. This access is broader than necessary because the Skill already identifies `homeassistant__GetLiveContext` as the mechanism for obtaining exposed entities. Reading persistent memory bypasses the narrower interface and brings stored information into the active Agent context without an explicit, task-specific user authorization step. The instruction does not write to or poison memory, so it is not classified as Agent Memory Poisoning. The issue is unauthorized or excessive read access that violates least-privilege boundaries. ### Attack Path 1. The Skill is loaded for a Home Assistant-related request. 2. The Agent follows the instruction to read `/home/clawd/.openclaw/workspace/memory/home-assistant-entities.md`. 3. Household entity mappings and any other information present in that file enter the active Agent context. 4. The information may then be used in subsequent tool requests or included in network communications, including requests to the endpoint configured elsewhere in the Skill. 5. If the file contains information beyond what the current task requires, that unrelated persistent data is unnecessarily exposed. ### Impact Assessment The primary impact is disclosure of persistent household metadata, potentially including room layout, device names, entity identifiers, camera names, and security-sensitive automation details. Such information can improve an attacker's ab ...[truncated 396 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the unconditional instruction to read the persistent workspace-memory file. 2. Obtain entity information through `homeassistant__GetLiveContext` or another constrained Home Assistant interface that returns only entities authorized for the current integration. 3. If a local mapping file is genuinely required, ask for explicit user consent before reading it and explain what information will be accessed and why. 4. Restrict any file access to a Skill-specific data directory rather than a shared persistent-memory location. 5. Read only the minimum records necessary for the current request and avoid placing unrelated memory contents into prompts, logs, or network requests. 6. Apply restrictive filesystem permissions and ensure the mapping file contains no credentials, access tokens, private camera URLs, or unrelated retained context. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (5)

Credential Access

High
Category
Privilege Escalation
Content
## Credentials
The MCP server endpoint is `http://220.0.0.5:8123/api/mcp`.
Ensure the connection is configured with the correct Long-Lived Access Token.

## Best Practices
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Intent-Code Divergence

Medium
Confidence
85% confidence
Finding
The skill presents itself as using Home Assistant's native MCP integration, but then directs the agent to avoid broken MCP camera tooling and fall back to REST via exec. That mismatch encourages security-boundary bypasses and undermines assumptions that interactions stay within audited MCP controls.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill explicitly instructs the agent to bypass the intended MCP interface and use arbitrary shell execution with curl against Home Assistant APIs. This expands the attack surface from constrained tool use to general command execution, increases the chance of token leakage in command lines or logs, and enables filesystem writes of sensitive camera images.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The instructions normalize passing a bearer token to curl and writing camera snapshots to a fixed local path without safeguards. This can expose credentials via shell history, process inspection, logs, or prompt artifacts, while persisting sensitive home imagery on disk where other processes or users may access it.

Natural-Language Policy Violations

Low
Confidence
62% confidence
Finding
This line gives a mandatory presentation instruction ('display it using the `MEDIA:<path>` directive') rather than offering a user choice in how results are returned. While not a language policy issue, it is a natural-language constraint embedded in the skill instructions that may override user preference for output format.

Static analysis

No suspicious patterns detected.