CVE-2025-27108 Cross-site Scripting vulnerability due to improper use of string.replace in dom-expressions
Attackers can execute arbitrary JavaScript in victim browsers via XSS in dom-expressions when user-controlled data is inserted into meta tags.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-27108?
CVE-2025-27108 is a high-severity cross-site scripting vulnerability in ryansolid dom-expressions, published on 21 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
dom-expressions is a Fine-Grained Runtime for Performant DOM Rendering. In affected versions the use of javascript's `.replace()` opens up to potential Cross-site Scripting (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. This issue has been addressed in version 0.39.5 and all users are advised to upgrade. There are no known workarounds for this vulnerability.
Which versions are affected by CVE-2025-27108?
2 open source packages ship an affected version, including dom-expressions. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
dom-expressions npm | All versions | 0.39.5 |
dom-expressions npm | All versions | 0.39.5 |
Products include Ryansolid Dom Expressions.
How do I fix CVE-2025-27108?
Upgrade dom-expressions to 0.39.5 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2025-27108 being exploited?
There is no known exploitation of CVE-2025-27108 in the wild and no public exploit code.
Sources
Also known as GHSA-hw62-58pr-7wc5.