Skip to content

Nuxt Devtools has a Path Traversal: '../filedir'

High severity GitHub Reviewed Published Aug 5, 2024 in nuxt/nuxt • Updated Aug 6, 2024

Package

npm @nuxt/devtools (npm)

Affected versions

< 1.3.9

Patched versions

1.3.9

Description

Summary

Nuxt Devtools is missing authentication on the getTextAssetContent RPC function which is vulnerable to path traversal. Combined with a lack of Origin checks on the WebSocket handler, an attacker is able to interact with a locally running devtools instance and exfiltrate data abusing this vulnerability.

In certain configurations an attacker could leak the devtools authentication token and then abuse other RPC functions to achieve RCE.

Details

The getTextAssetContent function does not check for path traversals (source), this could allow an attacker to read arbitrary files over the RPC WebSocket.

The WebSocket server does not check the origin of the request (source) leading to CSWSH. This may be intentional to allow certain configurations to work correctly.

Nuxt Devtools authentication tokens are placed within the home directory of the current user (source).

In the scenario that:

  • The user has a Nuxt3 Project running
  • Devtools is enabled and running
  • The project is placed within the users home directory.
  • The user visits a malicious webpage
  • User has authenticated with devtools at least once

The malicious webpage can connect to the Devtools WebSocket, perform a directory traversal brute force to find the authentication token, then use the authenticated writeStaticAssets function to create a new Component, Nitro Handler or app.vue file which will run automatically as the file is changed.

PoC

POC will exploit the Devtools server on localhost:3000 (you may need to manually restart the server as the restart hook does not always work).

POC: https://devtools-exploit.pages.dev

  1. Create a new project with nuxt.new.
  2. Place the project inside your home directory.
  3. Run pnpm run dev.
  4. Open the POC page.

The POC will:

  • Identify devtools version.
  • Leak your devtools token.
  • Create a new server handler with an insecure eval.

Impact

  • All new Nuxt projects by default (devtools is enabled) are vulnerable to arbitrary file read.
  • Certain Nuxt configurations are vulnerable to Remote Code Execution

References

@danielroe danielroe published to nuxt/nuxt Aug 5, 2024
Published to the GitHub Advisory Database Aug 5, 2024
Reviewed Aug 5, 2024
Published by the National Vulnerability Database Aug 5, 2024
Last updated Aug 6, 2024

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

EPSS score

0.044%
(11th percentile)

CVE ID

CVE-2024-23657

GHSA ID

GHSA-rcvg-rgf7-pppv

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.