CVE-2021-4229: Ua parser js Embedded Malware Vulnerability
HIGHCVE-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
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).
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.
npm install ua-parser-js@0.7.30
npm install ua-parser-js@0.8.1
npm install ua-parser-js@1.0.1
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
CVE-2021-4229 Affected Ua parser js Versions
3 component(s)| 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?
Which Ua parser js versions are affected?
What version fixes CVE-2021-4229?
Is ua-parser-js affected?
What is the CVSS score of CVE-2021-4229?
What CWE is associated with CVE-2021-4229?
How can I check npm dependencies for CVE-2021-4229?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}