CVE-2021-27884: Yapi vendor Weak JSON Web Token Vulnerability
MODERATECVE-2021-27884 is a MODERATE (CVSS 5.1) weak json web token vulnerability (CWE-330: Use of Insufficiently Random Values) affecting Yapi vendor libraries in the npm ecosystem. The issue involves weak json web token in yapi-vendor. Remediation is available by upgrading affected packages to version 1.9.3.
CVE-2021-27884 at a Glance
Security Impact
CVSS: 5.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N).
How to Fix CVE-2021-27884
To remediate this vulnerability, upgrade all affected Yapi vendor 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 yapi-vendor@1.9.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls yapi-vendor
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-27884, inspect your project dependencies using npm:
npm ls yapi-vendor
Analyze the terminal output to locate any version of Yapi vendor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.9.3), your application is affected.
Note: The npm ls yapi-vendor 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-330: Use of Insufficiently Random Values, where the product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. In Yapi vendor, 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-27884 Affected Yapi vendor Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
yapi-vendor
|
npm |
< 1.9.3
|
1.9.3
|
References
Frequently Asked Questions
What is CVE-2021-27884?
Which Yapi vendor versions are affected?
What version fixes CVE-2021-27884?
Is yapi-vendor affected?
What is the CVSS score of CVE-2021-27884?
What CWE is associated with CVE-2021-27884?
How can I check npm dependencies for CVE-2021-27884?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2h3h-vw8r-82rp",
"modified" : "2021-07-22T15:58:18Z",
"published" : "2021-03-26T16:49:26Z",
"aliases" : [ "CVE-2021-27884" ],
"summary" : "Weak JSON Web Token in yapi-vendor",
"details" : "Weak JSON Web Token (JWT) signing secret generation in YMFE YApi through 1.9.2 allows recreation of other users' JWT tokens. This occurs because Math.random in Node.js is used as a source of randomness in jwt signing. Math.random does not provide cryptographically secure random numbers. This has been patched in version 1.9.3.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "yapi-vendor"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.9.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.9.2"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-27884"
}, {
"type" : "WEB",
"url" : "https://github.com/YMFE/yapi/issues/2117"
}, {
"type" : "WEB",
"url" : "https://github.com/YMFE/yapi/issues/2263"
}, {
"type" : "ADVISORY",
"url" : "https://securitylab.github.com/advisories/GHSL-2020-228-YMFE-yapi"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-330" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-03-26T16:48:44Z",
"nvd_published_at" : "2021-03-01T23:15:00Z"
}
}