Vulnerability in homeassistant-cli (CVE-2026-40602)
Summary
Vulnerability in homeassistant-cli (CVE-2026-40602). Confidential information can be exposed externally. Exploitable via ImmutableSandboxedEnvironment. Mitigation: upgrade to 1.0.0 or later.
Original description
The description as published by the source.
Impact
Up to 1.0.0 of home-assitant-cli (or hass-cli for short) an unrestricted environment was used to handle Jninja2 templates instead of a sandboxed one. The user-supplied input within Jinja2 templates was rendered locally with no restrictions. This gave users access to Python's internals and extended the scope of templating beyond the intended usage.
E. g., it was possible to render a template with hass-cli template bad-template.j2 --local that contained entries like
{%- set b = environ.__globals__['__builtins__'] -%}
{%- set os = b['__import__']('os') -%}
{%- set bio = b['__import__']('builtins') -%}
...
or other malicious Jinja2 expressions. This can lead to arbitrary code execution on the local machine.
In a two step process an adversary could trick/convince an user to download third-party templates which contain harmful code (e. g., perform data manipulation or establish a remote shell) then to render those templates unchecked/reviewed/verified with --local.
The issue only affect the local machine and not a remote Home Assistant instance. It also requires user interventions.
Patches
1.0.0 uses ImmutableSandboxedEnvironment and restricts the usage of environment variables.
Workarounds
Evaluate the Jninja2 templates manually or tool-based before rendering with hass-cli.
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2026-40602 has been found in homeassistant-cli.
Attackers can target a specific entry point like ImmutableSandboxedEnvironment over the network to misuse the product.
Confidential information can be exposed externally.
What to do: upgrade homeassistant-cli to 1.0.0 or later.
If unsure, ask your IT team or search "homeassistant-cli CVE-2026-40602" on the vendor's site.
CVE-2026-40602 (homeassistant-cli) — CWE-1336
Attack vector: local
Attack surface: ImmutableSandboxedEnvironment
Patched: 1.0.0 — apply immediately
Workaround: Evaluate the Jninja2 templates manually or tool-based before rendering with hass-cli.
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
A vulnerability (CWE-1336) exists in homeassistant-cli. Attackers reach the vulnerable code path via ImmutableSandboxedEnvironment.
Check the vendor advisory for the affected versions of homeassistant-cli. Attack surface: ImmutableSandboxedEnvironment.
Severity: ?. Confidential information can be exposed externally.
Update to 1.0.0.
Workaround: Evaluate the Jninja2 templates manually or tool-based before rendering with hass-cli.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'homeassistant-cli' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r 'homeassistant-cli' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
homeassistant-cliを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply temporary workaround mitigate
Evaluate the Jninja2 templates manually or tool-based before rendering with `hass-cli`.パッチが適用されるまでの応急処置として、Evaluate the Jninja2 templates manually or tool-based before rendering with
hass-cli. を実施。回避策の副作用 (機能低下) を確認した上で。 -
3Apply patch patch
Upgrade homeassistant-cli to 1.0.0ステージング環境で 1.0.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
4Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
References
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com