CVE-2021-46871: phoenix_html allows Cross-site Scripting in HEEx class attributes
6.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.27507%
CWE
Published
1/10/2023
Updated
4/6/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| phoenix_html | npm | < 3.0.4 | 3.0.4 |
| phoenix_html | erlang | < 3.0.4 | 3.0.4 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The GitHub commit 62a0139 shows critical changes in tag.ex's class attribute handling:
- The class_value/1 function was modified to apply attr_escape to its output
- The build_attrs/1 function's logic was reordered to handle boolean attributes first, but more importantly, class list processing now flows through the escaped class_value
- Test cases were added to verify escaping of dangerous characters in class attributes This indicates the root cause was missing output encoding when constructing class attribute values, which is a direct XSS vector when user-controlled data is inserted into class attributes.