GHSA-g39v-cvjh-8fpf

Suggest an improvement
Source
https://github.com/advisories/GHSA-g39v-cvjh-8fpf
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-g39v-cvjh-8fpf/GHSA-g39v-cvjh-8fpf.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-g39v-cvjh-8fpf
Published
2026-05-14T20:17:23Z
Modified
2026-05-14T20:37:44.881920Z
Severity
  • 6.5 (Medium) CVSS_V3 - CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N CVSS Calculator
Summary
Home Assistant MCP Server: YAML config backups written under www/ are served unauthenticated at /local/
Details

Summary

When ENABLE_YAML_CONFIG_EDITING=true, every ha_config_set_yaml call backs up the pre-edit file to <config>/www/yaml_backups/, which Home Assistant serves at /local/ with no authentication. Anyone who can reach the HA web interface can download the most recent pre-edit configuration.yaml (or other YAML file) — typically containing plaintext MQTT passwords, REST credentials, webhook IDs, geofence coordinates, and shell_command definitions — with zero credentials.

Details

The backup feature is good — do_backup defaults to True and protects users from a bad edit. The issue is the location:

  • custom_components/ha_mcp_tools/__init__.py:596backup_dir = config_dir / "www" / "yaml_backups"
  • custom_components/ha_mcp_tools/__init__.py:602backup_file = backup_dir / f"{safe_name}.{timestamp}.bak"
  • custom_components/ha_mcp_tools/__init__.py:606-607,692-693 — backup path returned to caller and logged at INFO

<config>/www/ is /local/ and HA serves it unauthenticated by design (intended for static dashboard assets). An attacker discovers the path three ways: (1) it's returned to the MCP client in result["backup_path"]; (2) it's logged at INFO and recoverable via ha_get_logs; (3) the timestamp format is %Y%m%d_%H%M%S — 86,400 candidates per day, enumerable. Backups accumulate (no rotation), so a long-running install holds a chronological history.

Preconditions: ENABLE_YAML_CONFIG_EDITING=true (off by default), at least one YAML edit made, and the attacker can reach HA's port 8123 (LAN, or internet via Nabu Casa / reverse proxy).

PoC

A pytest E2E test against a fresh Docker HA container with the custom component installed (using the project's existing ha_container_with_fresh_config fixture):

[1] ha_config_set_yaml(yaml_path="template", action="add", ...) → success=True
[1] backup_path = 'www/yaml_backups/configuration.yaml.20260505_171335.bak'
[2] GET http://<ha>:8123/local/yaml_backups/configuration.yaml.20260505_171335.bak
    (no Authorization header)
[2] HTTP 200, 440 bytes — the full pre-edit configuration.yaml
[control] GET /api/config without auth → HTTP 401

The control proves the result is meaningful: the same instance returns 401 for an authenticated endpoint; only /local/ is unauthenticated by HA design.

Impact

CWE-552 (Files or Directories Accessible to External Parties). Affects users with ENABLE_YAML_CONFIG_EDITING=true who have made at least one YAML edit. Anyone who can reach HA port 8123 reads the most recent pre-edit config without credentials. CVSS 6.5 medium (AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N); 7.5 high if HA is internet-exposed.

Resolution

Fixed in 7.4.1.dev456 (PR #1180). The fix relocates new backups to <config>/.ha_mcp_tools_backups/ (config root, not served by /local/) and adds a one-time migration on integration setup that moves any pre-existing exposed backups, surfaces a persistent notification telling the user to rotate exposed secrets, and removes the legacy directory if empty.

The fix ships in the next biweekly stable release and is available immediately on the dev channel. Updating to a release containing the fix is sufficient — no manual action required for users who upgrade.

Manual cleanup (for users who cannot upgrade yet)

If you used ha_config_set_yaml on a vulnerable version and cannot wait for the next stable release, manually remove the exposed backups:

rm -rf <config>/www/yaml_backups/

Then rotate any secrets that may have been in the YAML files those backups captured (MQTT/REST credentials, webhook IDs, shell_command definitions, geofence coordinates). The directory is reachable at http(s)://<ha-host>:8123/local/yaml_backups/ until removed. After the next addon/package upgrade containing the fix, the integration will run this cleanup automatically and surface a persistent notification with the same rotation guidance.

Database specific
{
    "github_reviewed_at": "2026-05-14T20:17:23Z",
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-552"
    ],
    "nvd_published_at": null,
    "severity": "MODERATE"
}
References

Affected packages

PyPI / ha-mcp

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
7.5.0

Affected versions

3.*
3.3.0
3.3.1
3.3.2
3.4.0
3.4.2
3.4.3
3.5.0
3.5.1
3.6.0
3.6.1
3.6.2
3.7.0
4.*
4.0.0
4.0.1
4.1.0
4.2.0
4.3.0
4.4.0
4.5.0
4.6.0
4.7.0
4.7.1
4.7.2
4.7.3
4.7.4
4.7.5
4.7.6
4.7.7
4.8.0
4.8.1
4.8.2
4.8.3
4.8.4
4.8.5
4.9.0
4.10.0
4.11.0
4.11.1
4.11.2
4.11.3
4.11.4
4.11.5
4.11.6
4.11.7
4.11.8
4.11.9
4.12.0
4.13.0
4.14.0
4.14.1
4.14.2
4.15.0
4.15.1
4.16.0
4.16.1
4.16.2
4.17.0
4.17.1
4.18.0
4.18.1
4.18.2
4.19.0
4.20.0
4.21.0
4.22.0
4.22.1
5.*
5.0.0
5.0.2
5.0.3
5.0.4
5.0.5
5.0.6
5.1.0
6.*
6.0.0
6.1.0
6.2.0
6.3.0
6.3.1
6.4.0
6.5.0
6.6.0
6.6.1
6.7.0
6.7.1
6.7.2
7.*
7.0.0
7.1.0
7.2.0
7.3.0
7.4.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-g39v-cvjh-8fpf/GHSA-g39v-cvjh-8fpf.json"