CVE-2024-34343 Cross-site Scripting (XSS) in navigateTo if used after SSR in nuxt

Medium 6.3 Published Updated

Attackers can execute arbitrary JavaScript via crafted URLs in Nuxt applications after Server-Side Rendering due to flawed protocol validation.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2024-34343?

CVE-2024-34343 is a medium-severity cross-site scripting vulnerability in nuxt, published on 5 Aug 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Nuxt is a free and open-source framework to create full-stack web applications and websites with Vue.js. The `navigateTo` function attempts to blockthe `javascript:` protocol, but does not correctly use API's provided by `unjs/ufo`. This library also contains parsing discrepancies. The function first tests to see if the specified URL has a protocol. This uses the unjs/ufo package for URL parsing. This function works effectively, and returns true for a javascript: protocol. After this, the URL is parsed using the parseURL function. This function will refuse to parse poorly formatted URLs. Parsing javascript:alert(1) returns null/"" for all values. Next, the protocol of the URL is then checked using the isScriptProtocol function. This function simply checks the input against a list of protocols, and does not perform any parsing. The combination of refusing to parse poorly formatted URLs, and not performing additional parsing means that script checks fail as no protocol can be found. Even if a protocol was identified, whitespace is not stripped in the parseURL implementation, bypassing the isScriptProtocol checks. Certain special protocols are identified at the top of parseURL. Inserting a newline or tab into this sequence will block the special protocol check, and bypass the latter checks. This ONLY has impact after SSR has occured, the `javascript:` protocol within a location header does not trigger XSS. This issue has been addressed in release version 3.12.4 and all users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-79

Which versions are affected by CVE-2024-34343?

2 open source packages ship an affected version, including nuxt. It affects 1 product.

PackageAffectedFixed in
nuxt npmAll versions3.12.4
nuxt npmAll versions3.12.4

Products include Nuxt Nuxt.

How do I fix CVE-2024-34343?

Upgrade nuxt to 3.12.4 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-2024-34343 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-34343 exists.

Sources

Also known as CLSA-2026-1775781170, CLSA-2026-1775781171, CLSA-2026-1775781180, GHSA-vf6r-87q4-2vjf.

Is CVE-2024-34343 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free