/

CVE-2026-64825

Severity:

CRITICAL RISK

(9.3)

Path Traversal (CWE-22) in Home Assistant Backups

CVE-2026-64825

Deferred

Vulnerability type

Category:

Path Traversal / Directory Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write / Host Filesystem Compromise

Severity:

CRITICAL RISK

(9.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal flaw in Home Assistant Core's backup handling allows crafted backup archives to write files outside the intended backup directory during initial onboarding.

By abusing the backup name field to inject absolute paths, an unauthenticated attacker can cause arbitrary files to be written anywhere on the host filesystem, especially dangerous when Home Assistant runs as root.

Affected context

This vulnerability occurs in Home Assistant Core's backup restore logic during the initial onboarding period, when backups can be uploaded without prior authentication.

It affects environments where:

  • Backup archives are accepted and processed from untrusted clients
  • The backup metadata (e.g., backup.json) includes a user-supplied name field
  • That name is used to construct filesystem paths via pathlib.Path without sufficient normalization or validation

Risk is amplified when the Home Assistant process has broad filesystem permissions, such as running as root or sharing host volumes.

Exploit preconditions

  • Attack surface: Network-accessible Home Assistant instance exposed during the onboarding window
  • Required access: No prior authentication; ability to submit a crafted backup archive to the onboarding endpoint
  • Trigger point: Processing of backup.json within the uploaded archive, where the name field is combined with the configured backup directory using pathlib.Path.__truediv__
  • Why exploitation is possible: The code trusts the name value as a safe relative path, allowing absolute paths to override the configured backup directory and write attacker-controlled data to arbitrary locations on the host filesystem

Why this happens

The root cause is improper validation of user-controlled path components when constructing filesystem paths from backup metadata.

The backup restore logic combines a configured base backup directory with the name field from backup.json using pathlib.Path.__truediv__, assuming the result will remain within the intended directory.

However, when name is an absolute path, Path.__truediv__ discards the base directory and resolves to the attacker-specified location, leading to a classic CWE-22: Path Traversal scenario.

This pattern reflects a broader bug class where untrusted inputs are directly used in path construction without enforcing relative paths, canonicalization, or directory confinement checks.

Potential impact

  • Overwriting or creating arbitrary files on the host filesystem
  • Planting or modifying configuration files to alter Home Assistant behavior
  • Dropping web templates, scripts, or other artifacts that may later be executed by other components
  • Tampering with system or service files when running with elevated privileges, potentially leading to full host compromise
  • Persisting malicious content in locations that survive application restarts or upgrades

General mitigation guidance

Effective mitigation focuses on strictly constraining filesystem paths derived from user input and tightening the onboarding attack surface.

Common defensive patterns include:

  • Treating all backup metadata, including names, as untrusted and enforcing that they resolve to paths strictly under a predefined backup directory
  • Normalizing and canonicalizing constructed paths, then validating that the final resolved path begins with the intended base directory before any filesystem operation
  • Rejecting or sanitizing absolute paths and path elements such as .., path separators, or device-specific prefixes in user-supplied fields
  • Using dedicated, least-privilege filesystem locations for backup import and restore, separated from critical system or configuration directories
  • Running Home Assistant with reduced privileges and without full host filesystem access where possible, limiting the blast radius of any file-write issue
  • Designing onboarding flows to minimize unauthenticated file-handling capabilities and to require explicit user confirmation for restore actions

How teams detect issues like this

Organizations can detect similar issues by focusing on how paths are built and validated in file-handling code:

  • Static analysis patterns: Flag uses of pathlib.Path or os.path where untrusted data is directly appended or joined to a base directory without subsequent canonicalization and boundary checks
  • Code review signals: Look for backup/restore, upload, and import paths where metadata fields like name, filename, or path are used as-is in filesystem operations
  • Runtime monitoring: Enable logging around backup imports, especially unexpected absolute paths or unusual directory targets, and alert on anomalies
  • Policy enforcement: Establish secure coding guidelines requiring explicit path normalization and directory confinement checks for any feature that writes files based on client input

Automated code scanning tools and CI-integrated linters can be configured to highlight path concatenation patterns that lack validation, helping catch similar flaws early.

Sources

SourceLink
github.comgithub.com/home-assistant/core/commit/567fe858289876b68b8162a77bd46e1e1af79752
github.comgithub.com/home-assistant/core/pull/172368
github.comgithub.com/home-assistant/core/releases/tag/2026.6.0
vulncheck.comvulncheck.com/advisories/home-assistant-core-path-traversal-file-write-via-backup-upload

Frequently asked

questions

Yes. During the initial onboarding window, an attacker who can reach the Home Assistant instance over the network can submit a crafted backup archive to trigger arbitrary file writes.

The issue manifests in the unauthenticated onboarding flow, so attackers do not need valid credentials; they only require network access to the onboarding interface while it is available.

The safest pattern is to ensure all user-influenced paths are treated as relative, normalized, and strictly confined within an approved base directory.

This involves rejecting absolute paths, validating canonicalized paths against the intended root, and separating backup storage from sensitive host directories.

Preventing similar bugs involves adopting secure file-handling practices: never trusting user-supplied path components, enforcing directory boundaries after canonicalization, minimizing unauthenticated file operations, and incorporating automated checks in code review and CI to detect unsafe path construction patterns.

Find out what's already
exploitable in your codebase.