GHSA-wm7q-rxch-43mx: Serve Byass Due To Validation Before Vulnerability

HIGH
Published
Advisory Summary

GHSA-wm7q-rxch-43mx is a HIGH byass due to validation before vulnerability (General Security Weakness) affecting Serve libraries in the npm ecosystem. The issue involves byass due to validation before canonicalization in serve. Remediation is available by upgrading affected packages to version 6.5.2.

GHSA-wm7q-rxch-43mx at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-wm7q-rxch-43mx
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Serve
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-wm7q-rxch-43mx

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

serve fixed: 6.5.2
npm install serve@6.5.2
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 serve

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-wm7q-rxch-43mx, inspect your project dependencies using npm:

npm ls serve

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

Note: The npm ls serve 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 General Security Weakness. In Serve, 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 `serve` before 6.5.2 are vulnerable to the bypass of the ignore functionality. The bypass is possible because validation happens before canonicalization of paths and filenames. Example: Here we have a server that ignores the file test.txt. ``` const serve = require('serve') const server = serve(__dirname, { port: 1337, ignore: ['test.txt'] }) ``` Using the URL encoded form of a letter (%65 instead of e) attacker can bypass the ignore control accessing the file. `curl http://localhost:1337/t%65st.txt` Additionally this technique can be used to get directory listings of ignored directories. ## Recommendation Update to version 6.5.2 or later.

GHSA-wm7q-rxch-43mx Affected Serve Versions

1 component(s)
Fixed Versions:
6.5.2
Product / Package Ecosystem Affected Versions Fixed Version
serve
npm
< 6.5.2
6.5.2

References

Frequently Asked Questions

What is GHSA-wm7q-rxch-43mx?
GHSA-wm7q-rxch-43mx is a security vulnerability in Serve involving Byass due to validation before canonicalization in serve under General Security Weakness.
Which Serve versions are affected?
Affected versions include releases prior to 6.5.2 across affected packages: serve.
What version fixes GHSA-wm7q-rxch-43mx?
Upgrading to 6.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is serve affected?
Yes, serve is affected in releases prior to 6.5.2. Upgrade your dependency to 6.5.2 or later.
What CWE is associated with GHSA-wm7q-rxch-43mx?
GHSA-wm7q-rxch-43mx is classified under General Security Weakness.
How can I check npm dependencies for GHSA-wm7q-rxch-43mx?
Run the dependency tree command: 'npm ls serve'. 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-wm7q-rxch-43mx",
  "modified" : "2020-08-31T18:29:10Z",
  "published" : "2020-09-01T19:38:33Z",
  "aliases" : [ ],
  "summary" : "Byass due to validation before canonicalization in serve",
  "details" : "Versions of `serve` before 6.5.2 are vulnerable to the bypass of the ignore functionality. The bypass is possible because validation happens before canonicalization of paths and filenames.\n\n\n\nExample:\nHere we have a server that ignores the file test.txt.\n```\nconst serve = require('serve')\nconst server = serve(__dirname, {\n      port: 1337,\n      ignore: ['test.txt']\n})\n```\n\nUsing the URL encoded form of a letter (%65 instead of e) attacker can bypass the ignore control accessing the file. \n\n`curl http://localhost:1337/t%65st.txt`\n\nAdditionally this technique can be used to get directory listings of ignored directories.\n\n\n## Recommendation\n\nUpdate to version 6.5.2 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "serve"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.5.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/308721"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/594"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:29:10Z",
    "nvd_published_at" : null
  }
}