Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update dependency nuxt to v3.12.4 [security] #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Aug 5, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
nuxt (source) 3.12.2 -> 3.12.4 age adoption passing confidence

GitHub Vulnerability Alerts

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(...) uses query.path instead of the normalized path, a non-normalized URL can reach the import(...) function.
For example, passing something like ./components/test normalizes path to /root/directory/components/test, but import(...) still receives ./components/test.

By using this behavior, it's possible to load arbitrary JavaScript by using the path like the following:

data:text/javascript;base64,Y29uc29sZS5sb2coMSk

Since resolve(...) resolves the filesystem path, not the URI, the above URI is treated as a relative path, but import(...) sees it as an absolute URI, and loads it as a JavaScript.

PoC

  1. Create a nuxt project and run it in the test mode:
npx nuxi@latest init test
cd test
TEST=true npm run dev
  1. Open the following URL:
http://localhost:3000/__nuxt_component_test__/?path=data%3Atext%2Fjavascript%3Bbase64%2CKGF3YWl0IGltcG9ydCgnZnMnKSkud3JpdGVGaWxlU3luYygnL3RtcC90ZXN0JywgKGF3YWl0IGltcG9ydCgnY2hpbGRfcHJvY2VzcycpKS5zcGF3blN5bmMoIndob2FtaSIpLnN0ZG91dCwgJ3V0Zi04Jyk
  1. Confirm that the output of 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.

CVE-2024-34343

Summary

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.

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. 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.

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.


Release Notes

nuxt/nuxt (nuxt)

v3.12.4

Compare Source

3.12.4 is the next regularly scheduled patch release.

👉 Changelog

compare changes

🔥 Performance
  • vite: Start warmups after nitro build (#​27963)
  • vite: Avoid extra resolve call for resolveId in layers (#​27971)
  • kit,nuxt,schema,vite,webpack: Use explicit exports (#​27998)
🩹 Fixes
  • schema: Resolve public alias correctly (#​27975)
  • nuxt: Omit rendering payload prefetch when noScripts (#​27972)
  • nuxt: Add / as fallback if page can't be identified (e6109b226)
  • ui-templates: Validate templates with html-validate (#​28024)
  • schema: Don't constrain postcss plugin options (#​28045)
  • kit: Remove exports from v4 branch (5c8312e9b)
  • nuxt: Use unhead key for ad-hoc module options (#​28088)
  • nuxt: Use native vue-router composables (#​28114)
  • kit: Ensure getNuxtVersion returns string (#​28125)
  • nuxt: Always prerender at least one page with crawler (#​28131)
  • nuxt: Consider doc scroll-padding-top in scrollBehavior (#​28083)
  • nuxt: Only warn when useAsyncData returns undefined (#​28154)
  • nuxt: Revert change to getCachedData null response (d10cea11b)
  • schema: Don't use app/ as srcDir if it doesn't exist (#​28176)
  • kit: Normalise serverDir within layers using v4 compat (#​28177)
  • nuxt: Allow getCachedData to return undefined (#​28187)
  • nuxt: Use addEventListener to register cookie store listener (#​28193)
  • nuxt: Merge route meta properties with scanned meta (#​28170)
  • nuxt: Prevent duplicate set-cookie headers (#​28211)
💅 Refactors
  • schema,vite,webpack: Rework postcss module loading (#​27946)
  • nuxt: Remove _registeredComponents from ssrContext (#​27819)
  • nuxt: Use errx to handle dev log traces (#​28027)
📖 Documentation
  • Fix link (83bd4fde9)
  • Fix Cloudflare spelling (#​27989)
  • Update example to use nuxtApp.runWithContext (#​28000)
  • Remove deprecated pending variable from data fetching docs (#​28011)
  • Clarify xrsp danger (#​28053)
  • Deprecate pending and emphasis undefined (#​28113)
  • Update phrasing in route announcer (#​28108)
  • Use code groups for install commands in module guide (#​28094)
  • Capitalize text (#​28056)
  • Mention content in upgrade guide v4 folder structure (#​28090)
  • Remove a resolved issue from view transition docs (#​28091)
  • Clarify navigateTo is not for nitro routes (#​28092)
  • Warn about nested islands (#​28062)
  • Add info about layers/ directory (#​28128)
  • Codemods for migrating to Nuxt 4 (#​28072)
✅ Tests
  • Add typeCheck test in minimal build (#​28166)
🤖 CI
  • Run prepare step before linting docs (f8fbefb42)
  • Run prepare step before linting docs (d629b82b3)
❤️ Contributors

v3.12.3

Compare Source

3.12.3 is the next regularly scheduled patch release.

👉 Changelog

compare changes

🔥 Performance
  • nuxt,vite: Use native fs utils rather than fs-extra (#​27787)
  • schema: Use chokidar when a custom srcDir is provided (#​27871)
  • nuxt: Ensure prefetchComponents is treeshaken on server (#​27905)
🩹 Fixes
  • nuxt: Flag async data promise as cancelled only if defined (#​27690)
  • schema: Handle backwards compat for dir.app (0c73cb734)
  • nuxt: Support hoisting types of subpath imports (#​27720)
  • nuxt: Resolve routes when navigateTo called with open (#​27742)
  • nuxt: Handle subpaths more correctly (d7402a799)
  • nuxt: Delay navigation until user input is acknowledged (#​27743)
  • nuxt: Resolve aliases used in nitro plugin paths (#​27741)
  • schema: Do not use full path assets/public aliases (d0518650f)
  • nuxt: Defer registering inp handler until nuxt is mounted (866a5319a)
  • nuxt: Add refresh type in server component refs (#​27778)
  • nuxt: Extract all-literal page meta (#​27821)
  • kit: Handle loading nuxt 4+ (cf251bd48)
  • nuxt: Handle external links to named route objects (#​27829)
  • nuxt: Use URL to encode redirected URLs (#​27822)
  • nuxt: Don't use app version when verifying nuxt deps (#​27864)
  • nuxt: Prompt to set compatibility date with latest nitro (#​27893)
  • nuxt: Add #vue-router alias for backwards compat (#​27896)
  • nuxt: Move app augments to core nuxt types (#​27900)
  • nuxt: Pass augmented pages to child paths (ecb35d3a2)
  • nuxt: Use pascal name when loading server component (#​27928)
  • nuxt: Improve async data warning (#​27874, #​27934)
  • nuxt: Allow configuring server components in modules (#​27936)
  • vite: Omit css ?raw from head when in dev mode (#​27940)
  • kit,nuxt: Ensure webworker types are available (4cab71d66)
  • nuxt: Seed crawler when prerendering pages (#​27955)
  • vite: Fix type issue with legacy dev bundler (f9fa1a3e9)
  • nuxt: Improve dx around compatibility date prompt (#​27965)
💅 Refactors
  • kit,nuxt: Use performance.now to measure time (d14f7ec46)
📖 Documentation
  • Add referral query variable to Vue School Links (#​27670)
  • Fix variable name (#​27675)
  • Clarify how transitions are configured globally (#​27679)
  • Remove outdated recommendation (#​27691)
  • Add refreshCookie on useCookie doc page (#​27744)
  • Sync changes from main branch (e7fbc9f81)
  • Remove outdated tip (#​27773)
  • Warn about awaiting useFetch/AsyncData in wrappers (#​27785)
  • Update some code groups with package manager examples (#​27791)
  • Hint to use runtime config (#​27859)
  • Use internal link (#​27883)
  • Update links to vue-router docs (#​27895)
  • Use internal link (#​27894)
  • Remove warning about type checking (#​27911)
  • compatibilityVersion is available in the latest release (#​27919)
  • Update roadmap + readme (748bc751d)
  • Update Nuxt 3 -> Nuxt or Nuxt 3+ (3c16c890c)
  • Update reference to nightly release for testing nuxt 4 (5d2dc9714)
  • Remove duplicate server-side notice in runtime config (#​27929)
  • Warn about ref unwrapping when auto-importing refs (#​27933)
  • Mention layers in directory guide (c222fe7aa)
🏡 Chore
✅ Tests
  • schema: Normalize snapshot paths for windows (#​27654)
  • nuxt: Normalize paths for windows (#​27653)
  • Bump timeout for node-compat test (228b8b889)
  • Slightly improve test reliability (#​27811)
🤖 CI
  • Update changelog from 3.x branch updates (2b6967fbb)
  • Add 3x tag instead (c0ef279f2)
  • Run workflows against 3.x branch as well (31255a14d)
  • Use correct SHA calculation for release-pr action (#​27604)
  • Resolve bash syntax error (#​27789)
  • Only run scorecards against main branch (7abd982f8)
  • Raise renovate prs against 3.x branch too (f176c150a)
  • Ignore @vitejs/plugin-vue again (56660cbdd)
  • Prevent more than one release from occurring at same time (71705550f)
  • Don't run changelog update on 2.x branch (1be639364)
❤️ 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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the maintenance label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants