chore(deps): update dependency nuxt to v3.12.4 [security] #422
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
3.12.3
->3.12.4
GitHub Vulnerability Alerts
CVE-2024-34343
Summary
The
navigateTo
function attempts to blockthejavascript:
protocol, but does not correctly use API's provided byunjs/ufo
. This library also contains parsing discrepancies.Details
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. Parsingjavascript: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 theisScriptProtocol
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.PoC
POC - https://stackblitz.com/edit/nuxt-xss-navigateto?file=app.vue
Attempt payload X, then attempt payload Y.
Impact
XSS, access to cookies, make requests on user's behalf.
Recommendations
As always with these bugs, the
URL
constructor provided by the browser is always the safest method of parsing a URL.Given the cross-platform requirements of nuxt/ufo a more appropriate solution is to make parsing consistent between functions, and to adapt parsing to be more consistent with the WHATWG URL specification.
Note
I've reported this vulnerability here as it is unclear if this is a bug in ufo or a misuse of the ufo library.
This ONLY has impact after SSR has occured, the
javascript:
protocol within a location header does not trigger XSS.CVE-2024-34344
Summary
Due to the insufficient validation of the
path
parameter in the NuxtTestComponentWrapper, an attacker can execute arbitrary JavaScript on the server side, which allows them to execute arbitrary commands.Details
While running the test, a special component named
NuxtTestComponentWrapper
is available.https://github.com/nuxt/nuxt/blob/4779f5906fa4d3c784c2e2d6fe5a5c5f181faaec/packages/nuxt/src/app/components/nuxt-root.vue#L42-L43
This component loads the specified path as a component and renders it.
https://github.com/nuxt/nuxt/blob/4779f5906fa4d3c784c2e2d6fe5a5c5f181faaec/packages/nuxt/src/app/components/test-component-wrapper.ts#L9-L27
There is a validation for the
path
parameter to check whether the path traversal is performed, but this check is not sufficient.https://github.com/nuxt/nuxt/blob/4779f5906fa4d3c784c2e2d6fe5a5c5f181faaec/packages/nuxt/src/app/components/test-component-wrapper.ts#L15-L19
Since
import(...)
usesquery.path
instead of the normalizedpath
, a non-normalized URL can reach theimport(...)
function.For example, passing something like
./components/test
normalizespath
to/root/directory/components/test
, butimport(...)
still receives./components/test
.By using this behavior, it's possible to load arbitrary JavaScript by using the path like the following:
Since
resolve(...)
resolves the filesystem path, not the URI, the above URI is treated as a relative path, butimport(...)
sees it as an absolute URI, and loads it as a JavaScript.PoC
whoami
is written to/tmp/test
Demonstration video: https://www.youtube.com/watch?v=FI6mN8WbcE4
Impact
Users who open a malicious web page in the browser while running the test locally are affected by this vulnerability, which results in the remote code execution from the malicious web page.
Since web pages can send requests to arbitrary addresses, a malicious web page can repeatedly try to exploit this vulnerability, which then triggers the exploit when the test server starts.
Release Notes
nuxt/nuxt (nuxt)
v3.12.4
Compare Source
👉 Changelog
compare changes
🔥 Performance
resolveId
in layers (#27971)🩹 Fixes
noScripts
(#27972)/
as fallback if page can't be identified (e6109b226)html-validate
(#28024)unhead
key for ad-hoc module options (#28088)getNuxtVersion
returnsstring
(#28125)scroll-padding-top
in scrollBehavior (#28083)useAsyncData
returns undefined (#28154)getCachedData
null response (d10cea11b)app/
assrcDir
if it doesn't exist (#28176)serverDir
within layers using v4 compat (#28177)getCachedData
to return undefined (#28187)addEventListener
to register cookie store listener (#28193)set-cookie
headers (#28211)💅 Refactors
postcss
module loading (#27946)_registeredComponents
from ssrContext (#27819)errx
to handle dev log traces (#28027)📖 Documentation
nuxtApp.runWithContext
(#28000)pending
variable from data fetching docs (#28011)layers/
directory (#28128)✅ Tests
typeCheck
test in minimal build (#28166)🤖 CI
❤️ Contributors
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.