# CVE-2022-25878: Prototype Pollution

> Attackers can pollute Object.prototype via untrusted input or .proto files, potentially leading to code execution or privilege escalation.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L/E:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 May 2022
- **Updated:** 17 Sep 2024
- **Also known as:** GHSA-g954-5hwp-pp24, ROOT-APP-NPM-CVE-2022-25878

## What is CVE-2022-25878?

CVE-2022-25878 is a high-severity vulnerability in protobufjs, published on 27 May 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The package protobufjs before 6.11.3 are vulnerable to Prototype Pollution which can allow an attacker to add/modify properties of the Object.prototype. This vulnerability can occur in multiple ways: 1. by providing untrusted user input to util.setProperty or to ReflectionObject.setParsedOption functions 2. by parsing/loading .proto files

Weakness: CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes)

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

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `protobufjs` | npm | From 6.10.0 | 6.10.3 |
| `protobufjs` | npm | From 6.10.0 | 6.10.3 |
| `protobufjs` | npm | From 6.11.0 | 6.11.3 |
| `protobufjs` | npm | From 6.11.0 | 6.11.3 |

Products: Protobufjs Project Protobufjs.

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

Upgrade protobufjs to a fixed version for your release line: 6.10.3 or 6.11.3.

## Is CVE-2022-25878 being exploited?

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

## Other vulnerabilities in protobufjs

- [CVE-2023-36665](https://insights.sbomify.com/CVE-2023-36665/): protobufjs Prototype Pollution vulnerability (critical 9.8)
- [CVE-2026-41242](https://insights.sbomify.com/CVE-2026-41242/): protobufjs has an arbitrary code execution issue (critical 9.4)
- [CVE-2026-44291](https://insights.sbomify.com/CVE-2026-44291/): protobufjs: Code generation gadget after prototype pollution (high 8.1)
- [CVE-2026-44293](https://insights.sbomify.com/CVE-2026-44293/): protobufjs: Code injection through bytes field defaults in generated toObject code (high 7.7)
- [CVE-2026-48712](https://insights.sbomify.com/CVE-2026-48712/): protobufjs: Denial of service through unbounded Any expansion during JSON conversion (high 7.5)

## Fix prompt for AI coding agents

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

What it is: CVE-2022-25878 is a high-severity vulnerability in protobufjs, published on 27 May 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-25878 in the wild and no public exploit code.

Affected packages and fixed versions:
- protobufjs (npm): affected from 6.10.0; fixed in 6.10.3
- protobufjs (npm): affected from 6.10.0; fixed in 6.10.3
- protobufjs (npm): affected from 6.11.0; fixed in 6.11.3
- protobufjs (npm): affected from 6.11.0; fixed in 6.11.3

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-25878/ (Markdown: https://insights.sbomify.com/CVE-2022-25878/index.md)
```

## Sources

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

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