Vulnerabilities in pkg:npm/striptags

PACKAGE
Advisory Identifier: GHSA-qxg5-2qff-p49r
Advisory Summary

CVE-2021-32696 is a MODERATE (CVSS 3.7) passing vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Striptags libraries in the npm ecosystem. The issue involves passing in a non-string 'html' argument can lead to unsanitized output. Remediation is available by upgrading affected packages to version 3.2.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/striptags

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-qxg5-2qff-p49r CVE-2021-32696 MODERATE Passing in a non-string 'html' argument can lead to unsanitized output

CVE-2021-32696 at a Glance

CVE Identifier CVE-2021-32696
GHSA Identifier GHSA-qxg5-2qff-p49r
Severity MODERATE
CVSS v3.1 Base Score 3.7
CWE Classification CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
Affected Product Striptags
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 3.7

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

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

How to Fix CVE-2021-32696

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

striptags fixed: 3.2.0
npm install striptags@3.2.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 striptags

How to Check if You Are Affected

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

npm ls striptags

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

Note: The npm ls striptags 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-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. In Striptags, 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

A type-confusion vulnerability can cause `striptags` to concatenate unsanitized strings when an array-like object is passed in as the `html` parameter. This can be abused by an attacker who can control the shape of their input, e.g. if query parameters are passed directly into the function. ### Impact XSS ### Patches `3.2.0` ### Workarounds Ensure that the `html` parameter is a string before calling the function.

CVE-2021-32696 Affected Striptags Versions

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

References

Frequently Asked Questions

What is CVE-2021-32696?
CVE-2021-32696 is a security vulnerability in Striptags involving Passing in a non-string 'html' argument can lead to unsanitized output under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion').
Which Striptags versions are affected?
Affected versions include releases prior to 3.2.0 across affected packages: striptags.
What version fixes CVE-2021-32696?
Upgrading to 3.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is striptags affected?
Yes, striptags is affected in releases prior to 3.2.0. Upgrade your dependency to 3.2.0 or later.
What is the CVSS score of CVE-2021-32696?
CVE-2021-32696 has a CVSS v3.1 base score of 3.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2021-32696?
CVE-2021-32696 is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') (The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.).
How can I check npm dependencies for CVE-2021-32696?
Run the dependency tree command: 'npm ls striptags'. 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-qxg5-2qff-p49r",
  "modified" : "2021-06-18T19:31:21Z",
  "published" : "2021-06-18T19:31:35Z",
  "aliases" : [ "CVE-2021-32696" ],
  "summary" : "Passing in a non-string 'html' argument can lead to unsanitized output",
  "details" : "A type-confusion vulnerability can cause `striptags` to concatenate unsanitized strings when an array-like object is passed in as the `html` parameter. This can be abused by an attacker who can control the shape of their input, e.g. if query parameters are passed directly into the function.\n\n### Impact\n\nXSS\n\n### Patches\n\n`3.2.0`\n\n### Workarounds\n\nEnsure that the `html` parameter is a string before calling the function.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "striptags"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ericnorris/striptags/security/advisories/GHSA-qxg5-2qff-p49r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32696"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ericnorris/striptags/commit/f252a6b0819499cd65403707ebaf5cc925f2faca"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ericnorris/striptags/releases/tag/v3.2.0"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/striptags"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-241", "CWE-79", "CWE-843" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-18T19:31:21Z",
    "nvd_published_at" : "2021-06-18T20:15:00Z"
  }
}