Skip to content
Heist/ feed
Back to feed
Medium

hass-cli: Handling of user-supplied Jinja2 templates

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-40602
Confirmed fixed CVEs
Not specified
Updated in this feed
3 Nov 2026, 01:12 UTC · Revision 1

Source evidence

hass-cli: Handling of user-supplied Jinja2 templates

core-osv · Original source

Published 21 Apr 2026, 17:40 UTC

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.

osv:CVE-2026-40602
Complete source record
{
  "id": "66fa0dd8a27a0c4c7ef4c314de899b1085e5d7e761d699b6714d32e680b626f9",
  "url": "https://osv.dev/vulnerability/CVE-2026-40602",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "hass-cli: Handling of user-supplied Jinja2 templates",
    "summary": "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.",
    "evidence": "osv:CVE-2026-40602",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-40602",
      "aliases": [
        "CVE-2026-40602",
        "GHSA-33qf-q99x-wpm8",
        "PYSEC-2026-2518"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/home-assistant-ecosystem/home-assistant-cli",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "539fb0be61e0834eddfd252afaa7fadd169397f1"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "1.0.0"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "cpe": "cpe:2.3:a:home-assistant-ecosystem:home_assistant_command-line_interface:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "1.0.0"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "0.9.6",
            "0.9.5",
            "0.9.4",
            "0.9.3",
            "0.9.2",
            "0.9.1",
            "0.9.0",
            "0.8.0",
            "0.7.0",
            "0.5.0",
            "untagged-833e7f9176e1e602853d",
            "0.4.4",
            "0.4.1",
            "0.4.0",
            "0.3.1",
            "0.3.0",
            "0.1.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-40602.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:24.973312995Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40602.json",
        "https://github.com/home-assistant-ecosystem/home-assistant-cli/security/advisories/GHSA-33qf-q99x-wpm8",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-40602",
        "https://github.com/home-assistant-ecosystem/home-assistant-cli/pull/453"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-1336",
          "CWE-94"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40602.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-40602",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 491483,
  "published_at": "2026-04-21T17:40:10.251+00:00"
}