CVE-2021-28918: Netmask Improper Parsing Of Octal Bytes Vulnerability

CRITICAL
Advisory Identifier: GHSA-4c7m-wxvm-r7gc
CVSS 9.1
CWE-20
Published
Advisory Summary

CVE-2021-28918 is a CRITICAL (CVSS 9.1) improper parsing of octal bytes vulnerability (CWE-20: Improper Input Validation) affecting Netmask libraries in the npm ecosystem. The issue involves improper parsing of octal bytes in netmask. Remediation is available by upgrading affected packages to version 1.1.0.

CVE-2021-28918 at a Glance

CVE Identifier CVE-2021-28918
GHSA Identifier GHSA-4c7m-wxvm-r7gc
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-20: Improper Input Validation
Affected Product Netmask
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.1

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

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

How to Fix CVE-2021-28918

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

netmask fixed: 1.1.0
npm install netmask@1.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 netmask

How to Check if You Are Affected

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

npm ls netmask

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

Note: The npm ls netmask 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 Netmask, 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

Improper input validation of octal strings in netmask npm package v1.0.6 and below allows unauthenticated remote attackers to perform indeterminate SSRF, RFI, and LFI attacks on many of the dependent packages. A remote unauthenticated attacker can bypass packages relying on netmask to filter IPs and reach critical VPN or LAN hosts. :exclamation: NOTE: The fix for this issue was incomplete. A subsequent fix was made in version `2.0.1` which was assigned [CVE-2021-29418 / GHSA-pch5-whg9-qr2r](https://github.com/advisories/GHSA-pch5-whg9-qr2r). For complete protection from this vulnerability an upgrade to version 2.0.1 or later is recommended.

CVE-2021-28918 Affected Netmask Versions

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

References

Frequently Asked Questions

What is CVE-2021-28918?
CVE-2021-28918 is a security vulnerability in Netmask involving Improper parsing of octal bytes in netmask under CWE-20: Improper Input Validation.
Which Netmask versions are affected?
Affected versions include releases prior to 1.1.0 across affected packages: netmask.
What version fixes CVE-2021-28918?
Upgrading to 1.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is netmask affected?
Yes, netmask is affected in releases prior to 1.1.0. Upgrade your dependency to 1.1.0 or later.
What is the CVSS score of CVE-2021-28918?
CVE-2021-28918 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2021-28918?
CVE-2021-28918 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 CVE-2021-28918?
Run the dependency tree command: 'npm ls netmask'. 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-4c7m-wxvm-r7gc",
  "modified" : "2022-04-01T20:21:55Z",
  "published" : "2021-04-14T15:03:16Z",
  "aliases" : [ "CVE-2021-28918" ],
  "summary" : "Improper parsing of octal bytes in netmask",
  "details" : "Improper input validation of octal strings in netmask npm package v1.0.6 and below allows unauthenticated remote attackers to perform indeterminate SSRF, RFI, and LFI attacks on many of the dependent packages. A remote unauthenticated attacker can bypass packages relying on netmask to filter IPs and reach critical VPN or LAN hosts.\n\n:exclamation: NOTE: The fix for this issue was incomplete. A subsequent fix was made in version `2.0.1` which was assigned [CVE-2021-29418 / GHSA-pch5-whg9-qr2r](https://github.com/advisories/GHSA-pch5-whg9-qr2r). For complete protection from this vulnerability an upgrade to version 2.0.1 or later is recommended.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "netmask"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-28918"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-pch5-whg9-qr2r"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rs/node-netmask"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rs/node-netmask/blob/98294cb20695f2c6c36219a4fbcd4744fb8d0682/CHANGELOG.md#v110-mar-18-2021"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sickcodes/security/blob/master/advisories/SICK-2021-011.md"
  }, {
    "type" : "WEB",
    "url" : "https://rootdaemon.com/2021/03/29/vulnerability-in-netmask-npm-package-affects-280000-projects"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210528-0010"
  }, {
    "type" : "WEB",
    "url" : "https://www.bleepingcomputer.com/news/security/critical-netmask-networking-bug-impacts-thousands-of-applications"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/netmask"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-13T16:13:23Z",
    "nvd_published_at" : "2021-04-01T13:15:00Z"
  }
}