Every CVE Search/ Get API key

CVE-2026-40602

hass-cli: Handling of user-supplied Jinja2 templates

5.6 MediumFix available

The Home Assistant Command-line interface (hass-cli) is a command-line tool for Home Assistant. Up to 1.0.0 of home-assitant-cli 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. This vulnerability is fixed in 1.0.0.

Attack profile

How easy it is to exploit

Attack vector
Local
Complexity
High
Privileges needed
High
User interaction
Required

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
None

Exploit likelihood

0.10%Up 0.1 points since Apr 22, 2026
90%50%10%1%

What each source reports

CVE List Score used 5.6

hass-cli: Handling of user-supplied Jinja2 templates

The Home Assistant Command-line interface (hass-cli) is a command-line tool for Home Assistant. Up to 1.0.0 of home-assitant-cli 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. This vulnerability is fixed in 1.0.0.

Record
CVE-2026-40602
CVSS 3.1
5.6 MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
Weakness
CWE-94, CWE-1336
Updated
2026-11-02
EUVDEUVD-2026-24211 5.6

The Home Assistant Command-line interface (hass-cli) is a command-line tool for Home Assistant. Up to 1.0.0 of home-assitant-cli 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. This vulnerability is fixed in 1.0.0.

Record
EUVD-2026-24211
CVSS 3.1
5.6 MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
Updated
2026-11-02
GitHub AdvisoriesGHSA-33qf-q99x-wpm8 5.6

Home Assistant Command-line Interface: Handling of user-supplied Jinja2 templates

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.

Record
GHSA-33qf-q99x-wpm8
CVSS 3.1
5.6 MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
Weakness
CWE-94, CWE-1336
Updated
2026-11-02
NVD 5.6

The Home Assistant Command-line interface (hass-cli) is a command-line tool for Home Assistant. Up to 1.0.0 of home-assitant-cli 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. This vulnerability is fixed in 1.0.0.

Record
CVE-2026-40602
CVSS 3.1
5.6 MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
Weakness
CWE-94, CWE-1336
Updated
2026-11-02
OSV 5.6

hass-cli: Handling of user-supplied Jinja2 templates

The Home Assistant Command-line interface (hass-cli) is a command-line tool for Home Assistant. Up to 1.0.0 of home-assitant-cli 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. This vulnerability is fixed in 1.0.0.

Record
CVE-2026-40602
CVSS 3.1
5.6 MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
Weakness
CWE-1336, CWE-94
Updated
2026-11-02
OSVGHSA-33qf-q99x-wpm8 5.6

Home Assistant Command-line Interface: Handling of user-supplied Jinja2 templates

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.

Record
GHSA-33qf-q99x-wpm8
CVSS 3.1
5.6 MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
Weakness
CWE-1336, CWE-94
Updated
2026-11-02
OSVPYSEC-2026-2518 5.6

Home Assistant Command-line Interface: Handling of user-supplied Jinja2 templates

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.

Record
PYSEC-2026-2518
CVSS 3.1
5.6 MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
homeassistant-cli
PyPI
before 1.0.0
1.0.0
homeassistant-cli
PyPI
before 1.0.0, plus listed versions
0.0.10.0.20.1.00.2.00.3.0
Show 36 moreShow less
0.3.10.4.00.4.20.4.30.4.40.5.00.6.00.7.00.8.00.8.0.dev201905261357080.8.0.dev201906050856550.8.0.dev201906062033430.8.0.dev201906201811320.8.0.dev201908302337470.8.0.dev201908310134120.8.0.dev201909041321470.8.0.dev201909041503330.8.0.dev201909041503590.8.0.dev201909041504210.8.0.dev201909041505220.8.0.dev201909041505330.8.0.dev201909041505530.8.0.dev201909041506200.8.0.dev201909051338250.8.0.dev201909051403010.8.0.dev201910202142210.8.0.dev201910202246290.8.0.dev201910312010510.9.00.9.0.dev201911172240530.9.0.dev201911172315240.9.10.9.20.9.30.9.40.9.6
1.0.0

History

History
RecordedChangedSources
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-40602 is a medium vulnerability (CVSS 5.6) in Home-assistant-ecosystem Home Assistant Command-line Interface, published April 16, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.10%, the 0th percentile. Fixed in homeassistant-cli 1.0.0.

References

MoveEnter Open