Skip to main content

home-assistant-cli CVE-2026-40602

MEDIUM
Code Injection (CWE-94)
2026-04-16 https://github.com/home-assistant-ecosystem/home-assistant-cli GHSA-33qf-q99x-wpm8
5.6
CVSS 3.1 · Vendor: https://github.com/home-assistant-ecosystem/home-assistant-cli
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Attacker crafts malicious Jinja2 template with __globals__ traversal
  2. Delivery
    Distributes template via community forum or social engineering
  3. Exploit
    Victim downloads and saves template file locally
  4. Execution
    Victim runs hass-cli template file.j2 --local
  5. Persist
    Unsandboxed renderer grants access to Python __builtins__
  6. Impact
    Attacker-controlled code executes as local user

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Three specific conditions must all be met for exploitation: first, the victim must have home-assistant-cli installed at a version prior to 1.0.0; second, the victim must obtain a maliciously crafted Jinja2 template file distributed by the attacker via social engineering (e.g., community forums, a compromised template repository, or a phishing message); third, the victim must explicitly invoke the --local flag - hass-cli template <file.j2> --local - which triggers local Python-side rendering rather than delegating to the remote Home Assistant server. The --local flag is the critical gating condition: without it, template rendering occurs server-side and this code path is never reached. Exploitation is bounded strictly to the local machine; no network path to the victim is required by the attacker beyond delivering the template file. Authentication requirements are not applicable in the traditional sense - the attacker exploits the victim's own legitimate local session.

Impact

Despite the SSVC "Technical Impact: total" designation, the aggregate risk signal is low-to-moderate. The CVSS 3.1 score of 5.6 correctly reflects the local attack vector (AV:L), high complexity (AC:H), required user interaction (UI:R), and absence of availability impact. EPSS at 0.02% (4th percentile) aligns with SSVC's "Exploitation: none" - no active exploitation activity has been observed. The attack is not automatable per SSVC, and scope is strictly limited to the local machine. One notable inconsistency: the provided CVSS vector includes PR:H, but the description indicates the attacker requires no privileges on the victim's system - the attacker merely distributes a file and relies on social engineering; PR:N is more accurate from the attacker's perspective. SSVC's "Technical Impact: total" reflects that successful exploitation achieves full code execution, but this must be weighed against three hard prerequisites: installation of a pre-1.0.0 build, receipt of a malicious template, and deliberate use of the --local rendering flag.

Exploit ScenarioDerived

An attacker publishes a malicious .j2 template to a Home Assistant community forum or GitHub Gist, advertising it as a useful automation helper. The template contains Jinja2 expressions that traverse environ.__globals__['__builtins__'] to import the os module and open a reverse shell to an attacker-controlled host. A Home Assistant user running a pre-1.0.0 version of hass-cli downloads the template and executes hass-cli template malicious.j2 --local, triggering arbitrary Python code execution under the user's local account with full access to the file system, environment variables, and network.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 24, 2026

Unsandboxed Jinja2 template rendering in home-assistant-cli before version 1.0.0 enables arbitrary code execution on the local machine when a user processes a maliciously crafted template with the --local flag. Exploitation chains two steps - an attacker distributes a crafted .j2 template and social-engineers the victim into rendering it locally - allowing traversal of Python's __globals__ and __builtins__ to invoke arbitrary OS commands. No public exploit has been identified and CISA KEV does not list this CVE, consistent with SSVC's assessment of zero current exploitation; despite the "Technical Impact: total" SSVC rating, real-world risk is substantially limited by the multi-step social engineering preconditions.

RemediationAI

Upgrade home-assistant-cli to version 1.0.0 or later using pip install --upgrade homeassistant-cli; this is the vendor-released patch confirmed by PR #453 (https://github.com/home-assistant-ecosystem/home-assistant-cli/pull/453) and advisory GHSA-33qf-q99x-wpm8. Version 1.0.0 switches to ImmutableSandboxedEnvironment and restricts environment variable access to an explicit allowlist. If upgrade is not immediately possible, the vendor-suggested workaround is to manually or tool-based inspect all Jinja2 templates before rendering with --local - specifically audit for expressions referencing __globals__, __builtins__, __import__, or class traversal patterns (__mro__, __subclasses__). This workaround relies on human review and is error-prone, particularly for complex or obfuscated templates; it should be treated as a temporary measure only. Avoid rendering templates from untrusted or unverified external sources under any circumstances.

Affected Packages

pypi homeassistant-cli fix: 1.0.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The flaw exists in homeassistant_cli/plugins/template.py, where Jinja2's standard Environment class was used without sandboxing restrictions. Jinja2's default environment exposes Python object internals, enabling template authors to chain attribute lookups through environ.__globals__['__builtins__'] to reach __import__ and load arbitrary Python modules including os. The vulnerable package (pip/homeassistant-cli < 1.0.0; CPE: pkg:pip/homeassistant-cli) also bound os.environ.get directly as a template global, providing unrestricted read access to all environment variables - including potentially sensitive values like HASS_TOKEN or HASS_SUPERVISOR_TOKEN. CWE-94 (Code Injection) is the accurate root cause: user-controlled template content was evaluated in an interpreter context without input restriction. The patch replaces jinja2.Environment with jinja2.sandbox.ImmutableSandboxedEnvironment and introduces a SAFE_ENV_VARS allowlist (HASS_SERVER, LANG, TZ) for environment variable access.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/home-assistant-ecosystem/home-assistant-cli) PRIMARY 5.6 MEDIUM
AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
vuln.today AI 6.3 MEDIUM

Attacker needs no system privileges - delivery is via social engineering of a file; PR:N corrects the vendor's PR:H; AV:L and AC:H reflect local rendering and social engineering complexity; no availability impact per advisory.

3.1 AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
4.0 AV:L/AC:H/AT:P/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/home-assistant-ecosystem/home-assistant-cli).

CVSS VectorVendor: https://github.com/home-assistant-ecosystem/home-assistant-cli

Attack Vector
Local
Attack Complexity
High
Privileges Required
High
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

Lifecycle Timeline

2
Patch released
Apr 16, 2026 - 22:00 nvd
Patch available
CVE Published
Apr 16, 2026 - 21:28 nvd
MEDIUM 5.6

DescriptionCVE.org

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

`j2
{%- 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.

Threat Intelligence Overview

EPSS Score
0.0%
Top 96% exploitable
Prevalence
Low
niche CLI tool used by Home Assistant power users
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Total

Priority Score

28
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Affected Products (CPE)CVE.org

pkg:pip/homeassistant-cli

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy