Vulnerabilities in pkg:npm/dns-packet

PACKAGE
Advisory Identifier: GHSA-3wcq-x3mq-6r9p
Advisory Summary

CVE-2021-23386 is a HIGH (CVSS 7.7) potential memory exposure vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Dns packet libraries in the npm ecosystem. The issue involves potential memory exposure in dns-packet. Remediation is available by upgrading affected packages to version 5.2.2, 1.3.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/dns-packet

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-3wcq-x3mq-6r9p CVE-2021-23386 HIGH Potential memory exposure in dns-packet

CVE-2021-23386 at a Glance

CVE Identifier CVE-2021-23386
GHSA Identifier GHSA-3wcq-x3mq-6r9p
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Dns packet
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2021-23386

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

dns-packet fixed: 5.2.2
npm install dns-packet@5.2.2
dns-packet fixed: 1.3.2
npm install dns-packet@1.3.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 dns-packet

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-23386, inspect your project dependencies using npm:

npm ls dns-packet

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

Note: The npm ls dns-packet 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Dns packet, 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

This affects the package dns-packet before versions 1.3.2 and 5.2.2. It creates buffers with allocUnsafe and does not always fill them before forming network packets. This can expose internal application memory over unencrypted network when querying crafted invalid domain names.

CVE-2021-23386 Affected Dns packet Versions

2 component(s)
Fixed Versions:
5.2.21.3.2
Product / Package Ecosystem Affected Versions Fixed Version
dns-packet
npm
≥ 2.0.0
< 5.2.2
5.2.2
dns-packet
npm
< 1.3.2
1.3.2

References

Frequently Asked Questions

What is CVE-2021-23386?
CVE-2021-23386 is a security vulnerability in Dns packet involving Potential memory exposure in dns-packet under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Dns packet versions are affected?
Affected versions include releases prior to 5.2.2, 1.3.2 across affected packages: dns-packet.
What version fixes CVE-2021-23386?
Upgrading to 5.2.2, 1.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is dns-packet affected?
Yes, dns-packet is affected in releases prior to 5.2.2, 1.3.2. Upgrade your dependency to 5.2.2, 1.3.2 or later.
What is the CVSS score of CVE-2021-23386?
CVE-2021-23386 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:L.
What CWE is associated with CVE-2021-23386?
CVE-2021-23386 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for CVE-2021-23386?
Run the dependency tree command: 'npm ls dns-packet'. 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-3wcq-x3mq-6r9p",
  "modified" : "2021-05-26T20:11:00Z",
  "published" : "2021-05-24T19:51:04Z",
  "aliases" : [ "CVE-2021-23386" ],
  "summary" : "Potential memory exposure in dns-packet",
  "details" : "This affects the package dns-packet before versions 1.3.2 and 5.2.2. It creates buffers with allocUnsafe and does not always fill them before forming network packets. This can expose internal application memory over unencrypted network when querying crafted invalid domain names.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "dns-packet"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "5.2.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "dns-packet"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23386"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mafintosh/dns-packet/commit/0d0d593f8df4e2712c43957a6c62e95047f12b2d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mafintosh/dns-packet/commit/25f15dd0fedc53688b25fd053ebbdffe3d5c1c56"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/bugs?subject=user&amp%3Breport_id=968858"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1295719"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-DNSPACKET-1293563"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-908" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-21T18:07:04Z",
    "nvd_published_at" : "2021-05-20T17:15:00Z"
  }
}