DOM Expressions has a Cross-Site Scripting (XSS) vulnerability due to improper use of string.replace
High severity
GitHub Reviewed
Published
Feb 21, 2025
in
ryansolid/dom-expressions
•
Updated Feb 25, 2025
Description
Published by the National Vulnerability Database
Feb 21, 2025
Published to the GitHub Advisory Database
Feb 25, 2025
Reviewed
Feb 25, 2025
Last updated
Feb 25, 2025
Note
This advisory was originally emailed to [email protected] by @nsysean.
To sum it up, the use of javascript's
.replace()
opens up to potential XSS vulnerabilities with the special replacement patterns beginning with$
.Particularly, when the attributes of
Meta
tag from solid-meta are user-defined, attackers can utilise the special replacement patterns, either$'
or `$`` to achieve XSS.The solid-meta package has this issue since it uses
useAffect
and context providers, which injects the used assets in the html header. "dom-expressions" uses.replace()
to insert the assets, which is vulnerable to the special replacement patterns listed above.This effectively means that if the attributes of an asset tag contained user-controlled data, it would be vulnerable to XSS. For instance, there might be meta tags for the open graph protocol in a user profile page, but if attackers set the user query to some payload abusing
.replace()
, then they could execute arbitrary javascript in the victim's web browser. Moreover, it could be stored and cause more problems.References