CVE-2024-41677
JSON

6.3medium

Cross-site Scripting (XSS) vulnerability due to improper HTML escaping in qwik

Severity
6.3medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.50% (higher than 44% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-2rwj-7xq8-4gx4

Description

Qwik is a performance focused javascript framework. A potential mutation XSS vulnerability exists in Qwik for versions up to but not including 1.6.0. Qwik improperly escapes HTML on server-side rendering. It converts strings according to the rules found in the `render-ssr.ts` file. It sometimes causes the situation that the final DOM tree rendered on browsers is different from what Qwik expects on server-side rendering. This may be leveraged to perform XSS attacks, and a type of the XSS is known as mXSS (mutation XSS). This has been resolved in qwik version 1.6.0 and @builder.io/qwik version 1.7.3. All users are advised to upgrade. There are no known workarounds for this vulnerability.

Affected

Product or packageVersionsReported by
QwikDev qwik@builder.io/qwik: < 1.7.3, qwik: < 1.6.0, before 1.6.0CVE List
@builder.io/qwik (npm)before 1.7.3GitHub Advisory Database
qwik qwikbefore 1.7.3NVD

All scores

GitHub_M6.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L
GitHub6.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

Qwik is a performance focused javascript framework. A potential mutation XSS vulnerability exists in Qwik for versions up to but not including 1.6.0. Qwik improperly escapes HTML on server-side rendering. It converts strings according to the rules found in the `render-ssr.ts` file. It sometimes causes the situation that the final DOM tree rendered on browsers is different from what Qwik expects on server-side rendering. This may be leveraged to perform XSS attacks, and a type of the XSS is known as mXSS (mutation XSS). This has been resolved in qwik version 1.6.0 and @builder.io/qwik version 1.7.3. All users are advised to upgrade. There are no known workarounds for this vulnerability.

GitHub Advisory Database
Summary

A potential mXSS vulnerability exists in Qwik for versions up to 1.6.0.

Details

Qwik improperly escapes HTML on server-side rendering. It converts strings according to the following rules:

https://github.com/QwikDev/qwik/blob/v1.5.5/packages/qwik/src/core/render/ssr/render-ssr.ts#L1182-L1208

  • If the string is an attribute value:
    • " -> &quot;
    • & -> &amp;
    • Other characters -> No conversion
  • Otherwise:
    • < -> &lt;
    • > -> &gt;
    • & -> &amp;
    • Other characters -> No conversion

It sometimes causes the situation that the final DOM tree rendered on browsers is different from what Qwik expects on server-side rendering. This may be leveraged to perform XSS attacks, and a type of the XSS is known as mXSS (mutation XSS).

PoC

A vulnerable component:

import { component$ } from "@builder.io/qwik";
import { useLocation } from "@builder.io/qwik-city";

export default component$(() => {
  
  // user input
  const { url } = useLocation();
  const href = url.searchParams.get("href") ?? "https://example.com";

  return (
    <div>
      <noscript>
        <a href={href}>test</a>
      </noscript>
    </div>
  );
});

If a user accesses the following URL,

http://localhost:4173/?href=</noscript><script>alert(123)</script>

then, alert(123) will be executed.

Impact

XSS

NVD (es)

Qwik es un framework de JavaScript centrado en el rendimiento. Existe una vulnerabilidad XSS de mutación potencial en Qwik para versiones hasta la 1.6.0, pero no incluida. Qwik escapa incorrectamente de HTML en la representación del lado del servidor. Convierte cadenas de acuerdo con las reglas que se encuentran en el archivo `render-ssr.ts`. A veces causa la situación en la que el árbol DOM final renderizado en los navegadores es diferente de lo que Qwik espera en el renderizado del lado del servidor. Esto se puede aprovechar para realizar ataques XSS, y un tipo de XSS se conoce como mXSS (mutación XSS). Esto se resolvió en qwik versión 1.6.0 y @builder.io/qwik versión 1.7.3. Se recomienda a todos los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-41677 changed 2024-08-08CVE Terms of Use
GitHub Advisory DatabaseGHSA-2rwj-7xq8-4gx4 changed 2024-08-06CC-BY-4.0
NVDCVE-2024-41677 changed 2026-06-17Public domain