CVE-2021-4229: Ua parser js Embedded Malware Vulnerability

HIGH
Advisory Identifier: GHSA-pjwm-rvh2-c87w
CVSS 8.8
CWE-912 CWE-506
Published
Advisory Summary

CVE-2021-4229 is a HIGH (CVSS 8.8) embedded malware vulnerability (CWE-912: Hidden Functionality) affecting Ua parser js libraries in the npm ecosystem. The issue involves embedded malware in ua-parser-js. Remediation is available by upgrading affected packages to version 0.7.30, 0.8.1, 1.0.1.

CVE-2021-4229 at a Glance

CVE Identifier CVE-2021-4229
GHSA Identifier GHSA-pjwm-rvh2-c87w
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-912: Hidden Functionality
Affected Product Ua parser js
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:R/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2021-4229

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

ua-parser-js fixed: 0.7.30
npm install ua-parser-js@0.7.30
ua-parser-js fixed: 0.8.1
npm install ua-parser-js@0.8.1
ua-parser-js fixed: 1.0.1
npm install ua-parser-js@1.0.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 ua-parser-js

How to Check if You Are Affected

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

npm ls ua-parser-js

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

Note: The npm ls ua-parser-js 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-912: Hidden Functionality, where the product contains functionality that is not documented, not part of the specification, and not accessible through an interface or command sequence that is obvious to the product's users or administrators. In Ua parser js, 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

The npm package `ua-parser-js` had three versions published with malicious code. Users of affected versions (0.7.29, 0.8.0, 1.0.0) should upgrade as soon as possible and check their systems for suspicious activity. See [this issue](https://github.com/faisalman/ua-parser-js/issues/536) for details as they unfold. Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.

CVE-2021-4229 Affected Ua parser js Versions

3 component(s)
Fixed Versions:
0.7.300.8.11.0.1
Product / Package Ecosystem Affected Versions Fixed Version
ua-parser-js
npm
≥ 0.7.29
< 0.7.30
All 1 versions
0.7.29
0.7.30
ua-parser-js
npm
≥ 0.8.0
< 0.8.1
All 1 versions
0.8.0
0.8.1
ua-parser-js
npm
≥ 1.0.0
< 1.0.1
All 1 versions
1.0.0
1.0.1

References

Frequently Asked Questions

What is CVE-2021-4229?
CVE-2021-4229 is a security vulnerability in Ua parser js involving Embedded malware in ua-parser-js under CWE-912: Hidden Functionality.
Which Ua parser js versions are affected?
Affected versions include releases prior to 0.7.30, 0.8.1, 1.0.1 across affected packages: ua-parser-js.
What version fixes CVE-2021-4229?
Upgrading to 0.7.30, 0.8.1, 1.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ua-parser-js affected?
Yes, ua-parser-js is affected in releases prior to 0.7.30, 0.8.1, 1.0.1. Upgrade your dependency to 0.7.30, 0.8.1, 1.0.1 or later.
What is the CVSS score of CVE-2021-4229?
CVE-2021-4229 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-4229?
CVE-2021-4229 is classified under CWE-912: Hidden Functionality (The product contains functionality that is not documented, not part of the specification, and not accessible through an interface or command sequence that is obvious to the product's users or administrators.).
How can I check npm dependencies for CVE-2021-4229?
Run the dependency tree command: 'npm ls ua-parser-js'. 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-pjwm-rvh2-c87w",
  "modified" : "2026-02-17T21:57:43Z",
  "published" : "2021-10-22T20:38:14Z",
  "aliases" : [ "CVE-2021-4229" ],
  "summary" : "Embedded malware in ua-parser-js",
  "details" : "The npm package `ua-parser-js` had three versions published with malicious code. Users of affected versions (0.7.29, 0.8.0, 1.0.0) should upgrade as soon as possible and check their systems for suspicious activity. See [this issue](https://github.com/faisalman/ua-parser-js/issues/536) for details as they unfold.\n\nAny computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ua-parser-js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.7.29"
      }, {
        "fixed" : "0.7.30"
      } ]
    } ],
    "versions" : [ "0.7.29" ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ua-parser-js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.8.0"
      }, {
        "fixed" : "0.8.1"
      } ]
    } ],
    "versions" : [ "0.8.0" ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ua-parser-js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.0.1"
      } ]
    } ],
    "versions" : [ "1.0.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/faisalman/ua-parser-js/issues/536"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/faisalman/ua-parser-js/issues/536#issuecomment-949772496"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/faisalman/ua-parser-js"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/ua-parser-js"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-506", "CWE-912" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-22T20:37:42Z",
    "nvd_published_at" : null
  }
}