{"id":"CVE-2026-117645","aliases":["CVE-2026-117645","EEF-CVE-2026-117645"],"related":[],"kind":"vulnerability","state":"published","title":"Phoenix.HTML vulnerable to attribute injection via unvalidated attribute names in attributes_escape/1","summary":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') vulnerability in phoenixframework phoenix_html allows an attacker who controls attribute names to inject attributes and script into rendered HTML via Phoenix.HTML.attributes_escape/1.\n\nattributes_escape/1 in lib/phoenix_html.ex escapes attribute values but not attribute names. key_escape/1 passes a binary key through html_escape, which neutralizes quotes and angle brackets but not whitespace, so a key such as x onmouseover ends the attribute and starts a new one. An atom key is only dasherized, so any character passes, including quotes and >. Nested data, aria and phx keys take the same paths. An application is affected when it builds attribute keys from untrusted input and renders them through HEEx <tag {@attrs}>, content_tag/3, or a direct call. Before 3.0.0 the same code lived in Phoenix.HTML.Tag.\n\nThis issue affects phoenix_html: from 1.0.0 before 3.3.5 and from 4.0.0 before 4.4.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') vulnerability in phoenixframework phoenix_html allows an attacker who controls attribute names to inject attributes and script into rendered HTML via Phoenix.HTML.attributes_escape/1.\n\nattributes_escape/1 in lib/phoenix_html.ex escapes attribute values but not attribute names. key_escape/1 passes a binary key through html_escape, which neutralizes quotes and angle brackets but not whitespace, so a key such as x onmouseover ends the attribute and starts a new one. An atom key is only dasherized, so any character passes, including quotes and >. Nested data, aria and phx keys take the same paths. An application is affected when it builds attribute keys from untrusted input and renders them through HEEx <tag {@attrs}>, content_tag/3, or a direct call. Before 3.0.0 the same code lived in Phoenix.HTML.Tag.\n\nThis issue affects phoenix_html: from 1.0.0 before 3.3.5 and from 4.0.0 before 4.4.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting') vulnerability in phoenixframework phoenix_html allows an attacker who controls attribute names to inject attributes and script into rendered HTML via `Phoenix.HTML.attributes_escape/1`.\n\n`attributes_escape/1` in `lib/phoenix_html.ex` escapes attribute values but not attribute names. `key_escape/1` passes a binary key through `html_escape`, which neutralizes quotes and angle brackets but not whitespace, so a key such as `x onmouseover` ends the attribute and starts a new one. An atom key is only dasherized, so any character passes, including quotes and `>`. Nested `data`, `aria` and `phx` keys take the same paths. An application is affected when it builds attribute keys from untrusted input and renders them through HEEx `<tag {@attrs}>`, `content_tag/3`, or a direct call. Before 3.0.0 the same code lived in `Phoenix.HTML.Tag`.\n\nThis issue affects phoenix_html: from 1.0.0 before 3.3.5 and from 4.0.0 before 4.4.0.\n\n## Details\n\n**1. Attribute rendering.** `Phoenix.HTML.attributes_escape/1` walks the key-value pairs through `build_attrs/1` and `nested_attrs/3` and emits each as `key_escape(k)=\"attr_escape(v)\"`. Values are escaped. Names are not checked against the HTML attribute-name grammar.\n\n**2. Binary names.** `key_escape/1` sends a binary through `Phoenix.HTML.Engine.html_escape/1`, which replaces `&`, `<`, `>`, `\"` and `'`. Whitespace passes. HTML uses whitespace to separate attributes, so `%{\"x onmouseover\" => \"alert(1)\"}` renders ` x onmouseover=\"alert(1)\"`: a harmless `x` attribute followed by an attacker-chosen event handler.\n\n**3. Atom names.** `key_escape/1` converts an atom with `Atom.to_string/1` and replaces `_` with `-`. Nothing is escaped, so `[{:\"x\\\" onclick=\\\"alert(1)\", \"y\"}]` renders ` x\" onclick=\"alert(1)=\"y\"` and `aria: [{:\"x\\\"><script>\", \"y\"}]` renders ` aria-x\"><script>=\"y\"`, which leaves the tag entirely. This path needs the application to create atoms from untrusted input, for example `Jason.decode!(body, keys: :atoms)` or `String.to_atom/1` on a parameter.\n\n**4. Reachability.** HEEx compiles `<div {@attrs}>` to a call to `Phoenix.HTML.attributes_escape/1` through `Phoenix.LiveView.HTMLEngine` and `Phoenix.LiveView.TagEngine`. `tag/2` and `content_tag/3` in `Phoenix.HTML.Tag` (phoenix_html 1.x to 3.x) and in `PhoenixHTMLHelpers.Tag` (4.x) render attributes the same way. Versions before 3.0.0 emitted the dasherized name without any escaping at all.\n\n## Proof of concept\n\n1. Install a vulnerable release, for example `Mix.install([{:phoenix_html, \"== 4.3.0\"}])`.\n2. Render a binary name containing a space: `Phoenix.HTML.attributes_escape(%{\"x onmouseover\" => \"alert(1)\"}) |> Phoenix.HTML.safe_to_string()` returns ` x onmouseover=\"alert(1)\"`.\n3. Render an atom name containing a quote: `Phoenix.HTML.attributes_escape([{:\"x\\\" onclick=\\\"alert(1)\", \"y\"}]) |> Phoenix.HTML.safe_to_string()` returns ` x\" onclick=\"alert(1)=\"y\"`.\n4. Render a nested atom name: `Phoenix.HTML.attributes_escape(aria: [{:\"x\\\"><script>\", \"y\"}]) |> Phoenix.HTML.safe_to_string()` returns ` aria-x\"><script>=\"y\"`.\n5. Place any of these maps in a HEEx template as `<div {@attrs}>` to deliver the injected attribute to a browser.\n\n## Impact\n\nAn attacker who can influence the attribute names an application renders can add event-handler attributes or close the tag and run script in the browser of every user who views the page.\n\n## Workarounds\n\nDo not derive attribute names from untrusted input. Where dynamic attribute keys are needed, check each key against an allow list, or against a pattern such as `^[a-zA-Z][a-zA-Z0-9:._-]*$`, before passing the map to `attributes_escape/1` or a HEEx `{@attrs}` expression. Do not create atoms from request data.","format":"markdown","source":"eef"}],"published":"2026-10-30T20:25:06.758Z","modified":"2026-11-25T06:30:17.903Z","severity":{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"Erlang Ecosystem Foundation","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"type":"semver","introduced":"1.0.0","fixed":"3.3.5","status":"affected"},{"type":"semver","introduced":"4.0.0","fixed":"4.4.0","status":"affected"}],"vendor":"phoenixframework","product":"phoenix_html","package":"phoenix_html","cpe":"cpe:2.3:a:phoenixframework:phoenix_html:*:*:*:*:*:*:*:*","repo":"https://github.com/phoenixframework/phoenix_html","source":"cvelist"},{"ranges":[{"type":"git","introduced":"6ad3a1d7960891a468d54636054a98e11dfb5111","fixed":"*","status":"affected"}],"vendor":"phoenixframework","product":"phoenix_html","package":"phoenixframework/phoenix_html","cpe":"cpe:2.3:a:phoenixframework:phoenix_html:*:*:*:*:*:*:*:*","repo":"https://github.com/phoenixframework/phoenix_html","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"1.0.0","status":"affected","fixed":"3.3.5"},{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.4.0"}],"ecosystem":"Hex","package":"phoenix_html","purl":"pkg:hex/phoenix_html","source":"eef"},{"ranges":[{"type":"git","introduced":"6ad3a1d7960891a468d54636054a98e11dfb5111","status":"affected","fixed":"a47dc8944a773b7e9273d9691dc6744ec793f1de"},{"type":"git","status":"affected","fixed":"d9e4e6b2d9be49e25fb6d6b4fdbb2008174f01a6"}],"repo":"https://github.com/phoenixframework/phoenix_html","source":"eef"}],"references":[{"url":"https://cna.erlef.org/cves/CVE-2026-117645.html","tags":["related","third-party-advisory","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-117645","tags":["related"],"sources":["cvelist","nvd"]},{"url":"https://github.com/phoenixframework/phoenix_html/commit/6ad3a1d7960891a468d54636054a98e11dfb5111","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/phoenixframework/phoenix_html/commit/a47dc8944a773b7e9273d9691dc6744ec793f1de","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/phoenixframework/phoenix_html/commit/d9e4e6b2d9be49e25fb6d6b4fdbb2008174f01a6","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://hex.pm/packages/phoenix_html","tags":["package"],"sources":["eef"]}],"credits":["Andrew Moore","Jonatan Männchen / EEF","Steffen Deusch"],"assigner":"EEF","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-11-06T16:01:55.707Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-117645","url":"https://www.cve.org/CVERecord?id=CVE-2026-117645","licence":"CVE Terms of Use","modified":"2026-11-20T05:59:50.999Z"},{"source":"eef","name":"Erlang Ecosystem Foundation","id":"EEF-CVE-2026-117645","url":"https://osv.dev/vulnerability/EEF-CVE-2026-117645","licence":"CC-BY-4.0","modified":"2026-11-25T06:30:17.903Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-117645","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-117645","licence":"Public domain","modified":"2026-11-20T06:17:18.850Z"}],"updatedAt":"2026-11-25T22:59:48.022Z","epss":{"score":0.00427,"percentile":0.38869,"date":"2026-12-01T12:00:22.000Z"}}