{"id":"CVE-2026-32112","aliases":["CVE-2026-32112","GHSA-pf93-j98v-25pv","PYSEC-2026-2508"],"related":[],"kind":"vulnerability","state":"published","title":"ha-mcp has XSS via Unescaped HTML in OAuth Consent Form","summary":"ha-mcp is a Home Assistant MCP Server. Prior to 7.0.0, the ha-mcp OAuth consent form renders user-controlled parameters via Python f-strings with no HTML escaping. An attacker who can reach the OAuth endpoint and convince the server operator to follow a crafted authorization URL could execute JavaScript in the operator's browser. This affects only users running the beta OAuth mode (ha-mcp-oauth), which is not part of the standard setup and requires explicit configuration. This vulnerability is fixed in 7.0.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"ha-mcp is a Home Assistant MCP Server. Prior to 7.0.0, the ha-mcp OAuth consent form renders user-controlled parameters via Python f-strings with no HTML escaping. An attacker who can reach the OAuth endpoint and convince the server operator to follow a crafted authorization URL could execute JavaScript in the operator's browser. This affects only users running the beta OAuth mode (ha-mcp-oauth), which is not part of the standard setup and requires explicit configuration. This vulnerability is fixed in 7.0.0.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe ha-mcp OAuth consent form renders user-controlled parameters via Python f-strings with no HTML escaping. An attacker who can reach the OAuth endpoint and convince the server operator to follow a crafted authorization URL could execute JavaScript in the operator's browser. This affects only users running the beta OAuth mode (`ha-mcp-oauth`), which is not part of the standard setup and requires explicit configuration.\n\n### Details\n\n**Unescaped f-string rendering**\n\n`consent_form.py` builds HTML using Python f-strings. No call to `html.escape()` exists anywhere in the file. The following values are rendered unescaped:\n\n- `client_name` / `client_id` — in HTML element context (lines 299, 303)\n- `client_id`, `redirect_uri`, `state` — in HTML attribute context (lines 310–312), where a `\"` character breaks out of `value=\"\"`\n- `error_message`, `error`, `error_description` — in error display paths (lines 36–40, 496–497)\n\nAn attacker can register a client with a malicious `client_name` via the `/register` (DCR) endpoint, which accepts `client_name` without sanitization. If the server operator then visits a crafted authorization URL for that client, the payload executes in their browser.\n\n**Open Dynamic Client Registration**\n\nDCR is enabled by default with no initial access token required. This is intentional: Claude.ai and ChatGPT must self-register on first use, which is the standard MCP OAuth flow (RFC 7591). Requiring a pre-shared token would break those integrations. Registration alone grants no access — authorization requires an explicit action by the server operator.\n\n### Impact\n\n**Affected configuration:** OAuth mode only (`ha-mcp-oauth`, requires `MCP_BASE_URL`). This mode is in beta and is not included in the main setup documentation. The vast majority of ha-mcp users run stdio mode, which is not affected.\n\n**Attack requirements:**\n1. The attacker can reach the ha-mcp OAuth endpoint (it binds to `0.0.0.0` in HTTP mode)\n2. The attacker registers a malicious client via `/register`\n3. The attacker convinces the **server operator** — the person who set up ha-mcp — to follow a crafted authorization URL for an unrecognized application\n\nStep 3 is a meaningful social engineering bar: the consent form displays the (unfamiliar) application name, and the operator has no legitimate reason to authorize an OAuth client they didn't initiate through Claude.ai or ChatGPT. Normal usage involves being redirected to the consent form from one of those platforms, not from an external link.\n\nIf exploited, a JavaScript payload could exfiltrate data entered into the consent form, including the Home Assistant Long-Lived Access Token.\n\n### Fix\n\nUpgrade to 7.0.0","format":"markdown","source":"ghsa"},{"lang":"es","text":"ha-mcp es un servidor MCP de Home Assistant. Antes de la versión 7.0.0, el formulario de consentimiento OAuth de ha-mcp renderiza parámetros controlados por el usuario a través de f-strings de Python sin escape HTML. Un atacante que pueda alcanzar el endpoint OAuth y convencer al operador del servidor de seguir una URL de autorización manipulada podría ejecutar JavaScript en el navegador del operador. Esto afecta solo a los usuarios que ejecutan el modo OAuth beta (ha-mcp-oauth), que no forma parte de la configuración estándar y requiere configuración explícita. Esta vulnerabilidad está corregida en la versión 7.0.0.","source":"nvd"}],"published":"2026-03-11T20:42:30.381Z","modified":"2026-07-13T16:42:31.702Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","score":4.7,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 7.0.0","status":"affected"}],"vendor":"homeassistant-ai","product":"ha-mcp","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"7.0.0"}],"ecosystem":"PyPI","package":"ha-mcp","purl":"pkg:pypi/ha-mcp","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"7.0.0"}],"vendor":"homeassistant-ai","product":"home_assistant_mcp_server","cpe":"cpe:2.3:a:homeassistant-ai:home_assistant_mcp_server:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"7.0.0"}],"ecosystem":"PyPI","package":"ha-mcp","purl":"pkg:pypi/ha-mcp","source":"pysec"}],"references":[{"url":"https://github.com/homeassistant-ai/ha-mcp/security/advisories/GHSA-pf93-j98v-25pv","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-32112","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/homeassistant-ai/ha-mcp","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/ha-mcp","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-pf93-j98v-25pv","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-03-12T14:05:22.619Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-32112","url":"https://www.cve.org/CVERecord?id=CVE-2026-32112","licence":"CVE Terms of Use","modified":"2026-03-12T14:05:47.508Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-pf93-j98v-25pv","url":"https://github.com/advisories/GHSA-pf93-j98v-25pv","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:31.702Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-32112","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-32112","licence":"Public domain","modified":"2026-06-17T10:35:09.480Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2508","url":"https://osv.dev/vulnerability/PYSEC-2026-2508","licence":"CC-BY-4.0","modified":"2026-07-13T16:31:56.109Z"}],"updatedAt":"2026-11-25T22:59:15.788Z","epss":{"score":0.00217,"percentile":0.12941,"date":"2026-12-02T12:00:21.000Z"}}