CVE-2022-36045: Nodebb Cryptographically Weak PRNG Vulnerability
CRITICALCVE-2022-36045 is a CRITICAL (CVSS 9.8) cryptographically weak prng vulnerability (CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)) affecting Nodebb libraries in the npm ecosystem. The issue involves cryptographically weak prng in `utils.generateuuid`. Remediation is available by upgrading affected packages to version 1.19.8, 2.0.1.
CVE-2022-36045 at a Glance
Security Impact
CVSS: 9.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:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2022-36045
To remediate this vulnerability, upgrade all affected Nodebb 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 nodebb@1.19.8
npm install nodebb@2.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls nodebb
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-36045, inspect your project dependencies using npm:
npm ls nodebb
Analyze the terminal output to locate any version of Nodebb in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.19.8), your application is affected.
Note: The npm ls nodebb 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-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG), where the product uses a pseudo-random number generator (prng) in a security context, but the prng's algorithm is not cryptographically strong. In Nodebb, 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-2022-36045 Affected Nodebb Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nodebb
|
npm |
< 1.19.8
|
1.19.8
|
|
nodebb
|
npm |
≥ 2.0.0
< 2.0.1
All 1 versions
2.0.0
|
2.0.1
|
References
Frequently Asked Questions
What is CVE-2022-36045?
Which Nodebb versions are affected?
What version fixes CVE-2022-36045?
Is nodebb affected?
What is the CVSS score of CVE-2022-36045?
What CWE is associated with CVE-2022-36045?
How can I check npm dependencies for CVE-2022-36045?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p4cc-w597-6cpm",
"modified" : "2022-09-08T14:13:22Z",
"published" : "2022-08-30T20:38:10Z",
"aliases" : [ "CVE-2022-36045" ],
"summary" : "Cryptographically weak PRNG in `utils.generateUUID`",
"details" : "### In Brief\n`utils.generateUUID`, a helper function available in essentially all versions of NodeBB (as far back as v1.0.1 and potentially earlier) used a cryptographically insecure Pseudo-random number generator (`Math.random()`), which meant that a specially crafted script combined with multiple invocations of the password reset functionality could enable an attacker to correctly calculate the reset code for an account they do not have access to.\n\n### Impact\nThis vulnerability impacts all installations of NodeBB. The vulnerability allows for an attacker to take over any account without the involvement of the victim, and as such, the remediation should be applied immediately (either via NodeBB upgrade or cherry-pick of the specific changeset. Patches have been provided for both active branches of NodeBB (v2.x and v1.19.x)—please see below.\n\nIf you are already on v2.0.0 or v1.19.7, you can upgrade with no ill effects. The new version contains only the patch for this vulnerability.\n\nThe impact of this vulnerability is slightly lessened by the requirement that the target's email address must be known, **and** user emails are protected values in NodeBB. However, since NodeBB can be configured to display email addresses if the admin so wishes, and as email addresses can often by derived from other sources and/or guessed, the impact of this vulnerability is still fairly high.\n\n### Patches\n\n#### v2.x\nThe vulnerability has been patched in https://github.com/NodeBB/NodeBB/commit/e802fab87f94a13f397f04cfe6068f2f7ddf7888. You can cherry-pick this directly into your codebase.\n\n#### v1.19.x\nThe vulnerability has been patched in 81e3c1ba488d03371a5ce8d0ebb5c5803026e0f9. You can cherry-pick this directly into your codebase.\n\n### Workarounds\nThere is no known workaround, but the patch sets listed above will fully patch the vulnerability.\n\n### References\n* [CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)](http://cwe.mitre.org/data/definitions/338.html)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Discuss it on [our community forum](community.nodebb.org/)\n* Email us at [support@nodebb.org](mailto:support@nodebb.org)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "nodebb"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.19.8"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "nodebb"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.0.1"
} ]
} ],
"versions" : [ "2.0.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/NodeBB/NodeBB/security/advisories/GHSA-p4cc-w597-6cpm"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36045"
}, {
"type" : "WEB",
"url" : "https://github.com/NodeBB/NodeBB/commit/81e3c1ba488d03371a5ce8d0ebb5c5803026e0f9"
}, {
"type" : "WEB",
"url" : "https://github.com/NodeBB/NodeBB/commit/e802fab87f94a13f397f04cfe6068f2f7ddf7888"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/NodeBB/NodeBB"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-330", "CWE-338" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-08-30T20:38:10Z",
"nvd_published_at" : "2022-08-31T15:15:00Z"
}
}