Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS0ycndqLTd4cTgtNGd4NM4AA-a5
Qwik has a potential mXSS vulnerability due to improper HTML escaping
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:
- If the string is an attribute value:
"
->"
&
->&
- Other characters -> No conversion
- Otherwise:
<
-><
>
->>
&
->&
- 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
Permalink: https://github.com/advisories/GHSA-2rwj-7xq8-4gx4JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0ycndqLTd4cTgtNGd4NM4AA-a5
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 4 months ago
Updated: 4 months ago
CVSS Score: 6.3
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L
Identifiers: GHSA-2rwj-7xq8-4gx4, CVE-2024-41677
References:
- https://github.com/QwikDev/qwik/security/advisories/GHSA-2rwj-7xq8-4gx4
- https://github.com/QwikDev/qwik/commit/7e742eb3a1001542d795776c0317d47df8b9d64e
- https://github.com/QwikDev/qwik/blob/v1.5.5/packages/qwik/src/core/render/ssr/render-ssr.ts#L1182-L1208
- https://nvd.nist.gov/vuln/detail/CVE-2024-41677
- https://github.com/advisories/GHSA-2rwj-7xq8-4gx4
Blast Radius: 18.2
Affected Packages
npm:@builder.io/qwik
Dependent packages: 166Dependent repositories: 771
Downloads: 53,918 last month
Affected Version Ranges: < 1.7.3
Fixed in: 1.7.3
All affected versions: 0.0.6, 0.0.7, 0.0.8, 0.0.10, 0.0.11, 0.0.14, 0.0.15, 0.0.16, 0.0.18, 0.0.19, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.100, 0.0.101, 0.0.102, 0.0.103, 0.0.104, 0.0.105, 0.0.106, 0.0.107, 0.0.108, 0.0.109, 0.0.110, 0.0.112, 0.0.113, 0.9.0, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.17.5, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.21.0, 0.22.0, 0.22.1, 0.23.0, 0.24.0, 0.25.0, 0.100.0, 0.101.0, 0.102.0, 0.103.0, 0.104.0, 0.105.0, 0.106.0, 0.107.0, 1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.2.8, 1.2.9, 1.2.10, 1.2.11, 1.2.12, 1.2.13, 1.2.14, 1.2.15, 1.2.16, 1.2.17, 1.2.18, 1.2.19, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.6.0, 1.7.0, 1.7.1, 1.7.2
All unaffected versions: 1.7.3, 1.8.0, 1.9.0, 1.9.1