GHSA-5vj8-3v2h-h38v: Next Remote Code Execution Vulnerability

HIGH
CWE-20
Published
Advisory Summary

GHSA-5vj8-3v2h-h38v is a HIGH remote code execution vulnerability (CWE-20: Improper Input Validation) affecting Next libraries in the npm ecosystem. The issue involves remote code execution in next. Remediation is available by upgrading affected packages to version 5.1.0.

GHSA-5vj8-3v2h-h38v at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-5vj8-3v2h-h38v
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product Next
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-5vj8-3v2h-h38v

To remediate this vulnerability, upgrade all affected Next dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

next fixed: 5.1.0
npm install next@5.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls next

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-5vj8-3v2h-h38v, inspect your project dependencies using npm:

npm ls next

Analyze the terminal output to locate any version of Next in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.1.0), your application is affected.

Note: The npm ls next command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Next, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Versions of `next` prior to 5.1.0 are vulnerable to Remote Code Execution. The `/path:` route fails to properly sanitize input and passes it to a `require()` call. This allows attackers to execute JavaScript code on the server. Note that prior version 0.9.9 package `next` npm package hosted a different utility (0.4.1 being the latest version of that codebase), and this advisory does not apply to those versions. ## Recommendation Upgrade to version 5.1.0.

GHSA-5vj8-3v2h-h38v Affected Next Versions

1 component(s)
Fixed Versions:
5.1.0
Product / Package Ecosystem Affected Versions Fixed Version
next
npm
≥ 0.9.9
< 5.1.0
5.1.0

References

Frequently Asked Questions

What is GHSA-5vj8-3v2h-h38v?
GHSA-5vj8-3v2h-h38v is a security vulnerability in Next involving Remote Code Execution in next under CWE-20: Improper Input Validation.
Which Next versions are affected?
Affected versions include releases prior to 5.1.0 across affected packages: next.
What version fixes GHSA-5vj8-3v2h-h38v?
Upgrading to 5.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is next affected?
Yes, next is affected in releases prior to 5.1.0. Upgrade your dependency to 5.1.0 or later.
What CWE is associated with GHSA-5vj8-3v2h-h38v?
GHSA-5vj8-3v2h-h38v is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for GHSA-5vj8-3v2h-h38v?
Run the dependency tree command: 'npm ls next'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5vj8-3v2h-h38v",
  "modified" : "2022-04-28T19:57:43Z",
  "published" : "2020-09-04T18:04:08Z",
  "aliases" : [ ],
  "summary" : "Remote Code Execution in next",
  "details" : "Versions of `next` prior to 5.1.0 are vulnerable to Remote Code Execution. The `/path:` route fails to properly sanitize input and passes it to a `require()` call. This allows attackers to execute JavaScript code on the server. Note that prior version 0.9.9 package `next` npm package hosted a different utility (0.4.1 being the latest version of that codebase), and this advisory does not apply to those versions.\n\n## Recommendation\n\nUpgrade to version 5.1.0.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "next"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.9.9"
      }, {
        "fixed" : "5.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "PACKAGE",
    "url" : "https://github.com/vercel/next.js"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1538"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T19:02:46Z",
    "nvd_published_at" : null
  }
}