# GHSA-r5xw-q988-826m: Remote Memory Exposure in mongoose

> Attackers can expose uninitialized memory by saving numbers to Buffer fields, potentially leaking sensitive data.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Sep 2020

## What is GHSA-r5xw-q988-826m?

GHSA-r5xw-q988-826m is a vulnerability in mongoose, published on 1 Sep 2020. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Versions of `mongoose` before 4.3.6, 3.8.39 are vulnerable to remote memory exposure.

Trying to save a number to a field of type Buffer on the affected mongoose versions allocates a chunk of uninitialized memory and stores it in the database.

## Recommendation

Update to version 4.3.6, 3.8.39 or later.

## Which versions are affected by GHSA-r5xw-q988-826m?

4 open source packages ship an affected version, including mongoose.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mongoose` | npm | From 3.5.5 | 3.8.39 |
| `mongoose` | npm | From 3.5.5 | 3.8.39 |
| `mongoose` | npm | From 4.0.0 | 4.3.6 |
| `mongoose` | npm | From 4.0.0 | 4.3.6 |

## How do I fix GHSA-r5xw-q988-826m?

Upgrade mongoose to a fixed version for your release line: 3.8.39 or 4.3.6.

## Is GHSA-r5xw-q988-826m being exploited?

There is no known exploitation of GHSA-r5xw-q988-826m in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-r5xw-q988-826m and fix it if it is affected.

What it is: GHSA-r5xw-q988-826m is a vulnerability in mongoose, published on 1 Sep 2020. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-r5xw-q988-826m in the wild and no public exploit code.

Affected packages and fixed versions:
- mongoose (npm): affected from 3.5.5; fixed in 3.8.39
- mongoose (npm): affected from 3.5.5; fixed in 3.8.39
- mongoose (npm): affected from 4.0.0; fixed in 4.3.6
- mongoose (npm): affected from 4.0.0; fixed in 4.3.6

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/GHSA-r5xw-q988-826m/ (Markdown: https://insights.sbomify.com/GHSA-r5xw-q988-826m/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-r5xw-q988-826m

---
From sbomify Insights: https://insights.sbomify.com/GHSA-r5xw-q988-826m/
Summaries are generated and may contain mistakes; the official description above is the record.
