GHSA-gvff-25cc-4f66: Restify swagger jsdoc Path Traversal Vulnerability

HIGH
CWE-22
Published
Advisory Summary

GHSA-gvff-25cc-4f66 is a HIGH path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Restify swagger jsdoc libraries in the npm ecosystem. The issue involves path traversal in restify-swagger-jsdoc. Remediation is available by upgrading affected packages to version 3.2.1.

GHSA-gvff-25cc-4f66 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-gvff-25cc-4f66
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Restify swagger jsdoc
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-gvff-25cc-4f66

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

restify-swagger-jsdoc fixed: 3.2.1
npm install restify-swagger-jsdoc@3.2.1
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 restify-swagger-jsdoc

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-gvff-25cc-4f66, inspect your project dependencies using npm:

npm ls restify-swagger-jsdoc

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

Note: The npm ls restify-swagger-jsdoc 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Restify swagger jsdoc, 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 `restify-swagger-jsdoc` prior to 3.2.1 are vulnerable to Path Traversal. The package fails to properly sanitize URLs, which may allow attackers to access server files outside the `swagger-ui` folder by using relative paths. ## Recommendation Upgrade to version 3.2.1 or later.

GHSA-gvff-25cc-4f66 Affected Restify swagger jsdoc Versions

1 component(s)
Fixed Versions:
3.2.1
Product / Package Ecosystem Affected Versions Fixed Version
restify-swagger-jsdoc
npm
< 3.2.1
3.2.1

References

Frequently Asked Questions

What is GHSA-gvff-25cc-4f66?
GHSA-gvff-25cc-4f66 is a security vulnerability in Restify swagger jsdoc involving Path Traversal in restify-swagger-jsdoc under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Restify swagger jsdoc versions are affected?
Affected versions include releases prior to 3.2.1 across affected packages: restify-swagger-jsdoc.
What version fixes GHSA-gvff-25cc-4f66?
Upgrading to 3.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is restify-swagger-jsdoc affected?
Yes, restify-swagger-jsdoc is affected in releases prior to 3.2.1. Upgrade your dependency to 3.2.1 or later.
What CWE is associated with GHSA-gvff-25cc-4f66?
GHSA-gvff-25cc-4f66 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for GHSA-gvff-25cc-4f66?
Run the dependency tree command: 'npm ls restify-swagger-jsdoc'. 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-gvff-25cc-4f66",
  "modified" : "2020-08-31T18:44:58Z",
  "published" : "2020-09-03T17:15:56Z",
  "aliases" : [ ],
  "summary" : "Path Traversal in restify-swagger-jsdoc",
  "details" : "Versions of `restify-swagger-jsdoc` prior to 3.2.1 are vulnerable to Path Traversal.  The package fails to properly sanitize URLs, which may allow attackers to access server files outside the `swagger-ui` folder by using relative paths.  \n\n\n\n## Recommendation\n\nUpgrade to version 3.2.1 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "restify-swagger-jsdoc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1037"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:44:58Z",
    "nvd_published_at" : null
  }
}