Vulnerabilities in pkg:npm/gun

PACKAGE
Advisory Summary

GHSA-886v-mm6p-4m66 is a HIGH high severity vulnerability that affects vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Gun libraries in the npm ecosystem. The issue involves high severity vulnerability that affects gun. Remediation is available by upgrading affected packages to version 0.2019.416.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/gun

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/gun. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-886v-mm6p-4m66 - HIGH High severity vulnerability that affects gun

GHSA-886v-mm6p-4m66 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-886v-mm6p-4m66
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 Gun
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-886v-mm6p-4m66

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

gun fixed: 0.2019.416
npm install gun@0.2019.416
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 gun

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-886v-mm6p-4m66, inspect your project dependencies using npm:

npm ls gun

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

Note: The npm ls gun 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 Gun, 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

## Urgent Upgrade The static file server module included with GUN had a **serious vulnerability**: - Using `curl --path-as-is` allowed reads on any parent directory or files. This did not work via the browser or via curl without as-is option. ### Fixed This has been fixed since version `0.2019.416` and higher. ### Who Was Effected? Most NodeJS users who use the default setup, such as: - `npm start` - `node examples/http.js` - `Heroku` 1-click-deploy - `Docker` - `Now` If you have a custom NodeJS code then you are probably safe *unless* you have something like `require('http').createServer(Gun.serve(__dirname))` in it. If you have not upgraded, it is **mandatory** or else it is highly likely your environment variables and AWS (or other) keys could be leaked. ### Credit It was reported and fixed by [JK0N](https://github.com/amark/gun/pull/527), but I did not understand the `--path-as-is` condition. Joonas Loppi from [function61](http://function61.com) rediscovered it and explained the urgency to me to fix it.

GHSA-886v-mm6p-4m66 Affected Gun Versions

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

References

Frequently Asked Questions

What is GHSA-886v-mm6p-4m66?
GHSA-886v-mm6p-4m66 is a security vulnerability in Gun involving High severity vulnerability that affects gun under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Gun versions are affected?
Affected versions include releases prior to 0.2019.416 across affected packages: gun.
What version fixes GHSA-886v-mm6p-4m66?
Upgrading to 0.2019.416 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gun affected?
Yes, gun is affected in releases prior to 0.2019.416. Upgrade your dependency to 0.2019.416 or later.
What CWE is associated with GHSA-886v-mm6p-4m66?
GHSA-886v-mm6p-4m66 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-886v-mm6p-4m66?
Run the dependency tree command: 'npm ls gun'. 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-886v-mm6p-4m66",
  "modified" : "2021-09-07T15:24:35Z",
  "published" : "2019-06-05T09:48:02Z",
  "aliases" : [ ],
  "summary" : "High severity vulnerability that affects gun",
  "details" : "## Urgent Upgrade\n\nThe static file server module included with GUN had a **serious vulnerability**:\n\n - Using `curl --path-as-is` allowed reads on any parent directory or files.\n\nThis did not work via the browser or via curl without as-is option.\n\n ### Fixed\n\nThis has been fixed since version `0.2019.416` and higher.\n\n ### Who Was Effected?\n\nMost NodeJS users who use the default setup, such as:\n\n - `npm start`\n - `node examples/http.js`\n - `Heroku` 1-click-deploy\n - `Docker`\n - `Now`\n\nIf you have a custom NodeJS code then you are probably safe *unless* you have something like `require('http').createServer(Gun.serve(__dirname))` in it.\n\nIf you have not upgraded, it is **mandatory** or else it is highly likely your environment variables and AWS (or other) keys could be leaked.\n\n ### Credit\n\nIt was reported and fixed by [JK0N](https://github.com/amark/gun/pull/527), but I did not understand the `--path-as-is` condition.\n\nJoonas Loppi from [function61](http://function61.com) rediscovered it and explained the urgency to me to fix it.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "gun"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2019.416"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/amark/gun/security/advisories/GHSA-886v-mm6p-4m66"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-886v-mm6p-4m66"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/amark/gun"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:24:52Z",
    "nvd_published_at" : null
  }
}