# CVE-2022-36045: Account takeover via cryptographically weak PRNG in NodeBB Forum

> Attackers can take over any account by predicting password reset codes due to insecure random number generation in NodeBB.

- **Severity:** Critical 9.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 31 Aug 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-p4cc-w597-6cpm

## What is CVE-2022-36045?

CVE-2022-36045 is a critical vulnerability in NodeBB, published on 31 Aug 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

NodeBB Forum Software is powered by Node.js and supports either Redis, MongoDB, or a PostgreSQL database. It utilizes web sockets for instant interactions and real-time notifications. `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. This 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. The vulnerability has been patched in version 2.x and 1.19.x. There is no known workaround, but the patch sets listed above will fully patch the vulnerability.

Weakness: CWE-338 (Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)), CWE-330 (Use of Insufficiently Random Values)

## Which versions are affected by CVE-2022-36045?

4 open source packages ship an affected version, including nodebb. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `nodebb` | npm | All versions | 1.19.8 |
| `nodebb` | npm | All versions | 1.19.8 |
| `nodebb` | npm | From 2.0.0 | 2.0.1 |
| `nodebb` | npm | From 2.0.0 | 2.0.1 |

Products: Nodebb Nodebb.

## How do I fix CVE-2022-36045?

Upgrade nodebb to a fixed version for your release line: 1.19.8 or 2.0.1.

## Is CVE-2022-36045 being exploited?

There is no known exploitation of CVE-2022-36045 in the wild and no public exploit code.

## Other vulnerabilities in NodeBB

- [CVE-2023-26045](https://insights.sbomify.com/CVE-2023-26045/): NodeBB vulnerable to path traversal and code execution via prototype vulnerability (critical 10.0)
- [CVE-2020-15149](https://insights.sbomify.com/CVE-2020-15149/): Account takeover in NodeBB (critical 9.9)
- [CVE-2023-43187](https://insights.sbomify.com/CVE-2023-43187/): Code injection in n/a (critical 9.8)
- [CVE-2021-43786](https://insights.sbomify.com/CVE-2021-43786/): API token verification can be bypassed (critical 9.8)
- [CVE-2022-46164](https://insights.sbomify.com/CVE-2022-46164/): Account takeover via prototype vulnerability (critical 9.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-36045 and fix it if it is affected.

What it is: CVE-2022-36045 is a critical vulnerability in NodeBB, published on 31 Aug 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-36045 in the wild and no public exploit code.

Affected packages and fixed versions:
- nodebb (npm): affected all versions; fixed in 1.19.8
- nodebb (npm): affected all versions; fixed in 1.19.8
- nodebb (npm): affected from 2.0.0; fixed in 2.0.1
- nodebb (npm): affected from 2.0.0; fixed in 2.0.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-36045/ (Markdown: https://insights.sbomify.com/CVE-2022-36045/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-36045
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-36045
- OSV: https://osv.dev/vulnerability/CVE-2022-36045

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-36045/
Summaries are generated and may contain mistakes; the official description above is the record.
