Back to skill

Security audit

Smart Home Assistant

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a Home Assistant energy analyzer, but it has review-worthy security concerns around a long-lived token, plaintext HTTP defaults, broad Home Assistant state access, and control-capable automation drafts.

Review before installing. Use HTTPS for Home Assistant, use a dedicated least-privilege token if possible, and do not apply generated automations unless you have checked every switch action and target entity. Be aware that the skill reads all visible Home Assistant states during discovery, not only energy sensors.

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
fetcher.py:8
Finding

Home Assistant Bearer Token Transmitted over Plaintext HTTP

Content
View full analysis
dict[str, str]: return { "Authorization": f"Bearer {token}", "Content-Type": "application/json", } def fetch_states(ha_url: str, token: str) -> list[dict]: """Fetch all entity states from Home Assistant.""" url = f"{ha_url.rstrip('/')}/api/states" try: resp = httpx.get(url, headers=_headers(token), timeout=10.0) resp.raise_for_status() ``` The same authenticated request pattern is used for the area and device registries: ```python def fetch_area_registry(ha_url: str, token: str) -> list[dict]: """Fetch the area registry from Home Assistant.""" url = f"{ha_url.rstrip('/')}/api/config/area_registry" try: resp = httpx.get(url, headers=_headers(token), timeout=10.0) resp.raise_for_status() ``` ```python def fetch_entity_area_map(ha_url: str, token: str) -> dict[str, str]: """Build a mapping of entity_id to area name from HA device/area registries.""" url = f"{ha_url.rstrip('/')}/api/config/device_registry" try: resp = httpx.get(url, headers=_headers(token), timeout=10.0) resp.raise_for_status() ``` ### Technical Analysis The Skill sends a long-lived Home Assistant access token in an HTTP `Authorization` header. The shipped configuration and documentation use a plaintext `http://` URL, and the code does not validate the URL scheme or require transport encryption. When HTTP is used, both the bearer token and returned Home Assistant data are transmitted without confidentiality or server au ...[truncated 1829 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
fetcher.py:15
Finding

Energy-Only Skill Retrieves All Home Assistant Entity States

Content
View full analysis
list[dict]: """Fetch all entity states from Home Assistant.""" url = f"{ha_url.rstrip('/')}/api/states" try: resp = httpx.get(url, headers=_headers(token), timeout=10.0) resp.raise_for_status() except httpx.ConnectError as exc: raise ConnectionError( f"Cannot reach Home Assistant at {ha_url}: {exc}" ) from exc return resp.json() ``` From `pipeline.py:30-39`: ```python # Stage 1: FETCH raw_states = fetcher.fetch_states(config.ha_url, config.ha_token) filtered = fetcher.filter_energy_entities(raw_states) entity_area_map = fetcher.fetch_entity_area_map(config.ha_url, config.ha_token) # Stage 2: ANALYZE result = analyzer.analyze(filtered, entity_area_map) # Stage 3: FORMAT known_entity_ids = {e["entity_id"] for e in raw_states} ``` ### Technical Analysis The Skill declares an energy-analysis purpose and explicitly states that it should not be used for unrelated Home Assistant data such as locks or cameras. Nevertheless, it requests `/api/states`, which returns all entity states visible to the supplied account. Filtering to power and energy entities occurs only after the complete response has entered the Skill process. The pipeline also retains all entity identifiers to detect occupancy sensors when generating automation drafts. Complete device and area registries are requested for area mapping. Area mapping is relevant to the declared functionality, but retrieving all state records introduces unrelated household data into process memory and exceeds the Skill's energy-only data requirements. No evidence was found that the collected data is forwarded to an external third party. The issue ...[truncated 1608 chars]
Remediation
View remediation
` when practical. 3. If Home Assistant API limitations make an initial broad discovery request unavoidable, clearly disclose that all visible entity states are temporarily retrieved. 4. Immediately project broad responses into a minimal data structure containing only required power entities and discard `raw_states`. 5. Avoid retaining all entity IDs merely to detect occupancy sensors. Make occupancy entity IDs explicit configuration values or request only the configured IDs. 6. Minimize device and area registry data immediately after retrieval by retaining only identifiers and area names required for grouping. 7. Ensure application logs, error reporting, telemetry, and generated output never include raw API responses. 8. Separate analysis and automation-generation permissions or modes so ordinary summary requests do not collect occupancy-related metadata. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The skill is presented as read-only energy analysis, but it also generates automation payloads whose actions can turn devices on or off. That mismatch can mislead users or orchestrators into treating the skill as lower-risk than it is, creating a pathway for unintended operational control over smart-home devices.

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 38)May include surrounding context.

md
## Prerequisites

- A running Home Assistant instance accessible via network
- A long-lived access token (Settings > People > your user > Security > Long-Lived Access Tokens)
- Power monitoring entities with `unit_of_measurement` set to `W` or `kW`
- Areas configured in Home Assistant for room-level grouping

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 77)May include surrounding context.

md
## Prerequisites

- A running Home Assistant instance accessible via network
- A long-lived access token (Settings > People > your user > Security > Long-Lived Access Tokens)
- Power monitoring entities with `unit_of_measurement` set to `W` or `kW`
- Areas configured in Home Assistant for room-level grouping

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 38)May include surrounding context.

md
## Prerequisites

- A running Home Assistant instance accessible via network
- A long-lived access token (Settings > People > your user > Security > Long-Lived Access Tokens)
- Power monitoring entities with `unit_of_measurement` set to `W` or `kW`
- Areas configured in Home Assistant for room-level grouping

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill metadata explicitly says it must not be used for device control, but format_automation generates Home Assistant automations whose action calls switch. against derived switch entity IDs. That means an analysis-oriented skill can silently cross the boundary into operational control, enabling shutdown or toggling of devices based on power readings without clear user consent or scope alignment.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill manifest explicitly limits this skill to energy analysis and says it must not be used for device control, but the configuration defines an automated control action (turn_off) under a power threshold rule. That creates a scope violation where a monitoring skill can perform state-changing actions on Home Assistant devices, which could unexpectedly shut off appliances or critical equipment and bypass user intent or review.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares network and environment-based capabilities through metadata and documented behavior, but does not explicitly scope or constrain tool permissions. In an agent environment, missing least-privilege declarations can allow broader-than-necessary access to networked Home Assistant APIs and secrets, increasing the blast radius if the skill is misused or invoked unexpectedly.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documentation says the skill should not be used for direct device control, but it does not prominently warn that generated automations may still perform control actions like turning devices off or on. Users may paste or apply generated payloads without appreciating that they can cause real-world device state changes.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest limits this skill to monitoring/analyzing energy consumption and generating automations from power thresholds. This file implements generic environment-variable resolution for secrets and uses it to load a Home Assistant token, which is a broader credential-access capability not mentioned in the manifest and not inherently part of energy analysis itself.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The configuration loader accepts an automation action and defaults it to 'turn_off', which expands the skill from energy analysis into device control. That is dangerous because a skill advertised as analytics-only can silently be wired to perform state-changing actions, increasing the risk of unauthorized or unexpected shutdown of home devices if downstream code executes this action.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The function emits automations that call switch actions but provides no user-facing warning that generated output will control devices rather than merely analyze or notify. In a smart-home context, that can lead to unintended disruption of appliances or critical equipment if the JSON is applied automatically or trusted as harmless output.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring frames this function as creating automation JSON for threshold exceedance, which suggests monitoring behavior, but the implementation actually embeds an action that controls switches. This mismatch increases the risk that reviewers, integrators, or downstream agents will treat the output as safe analytical automation while it performs real-world actuation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.