# CVE-2022-46175: Prototype Pollution in JSON5 via Parse Method

> Attackers can pollute object prototypes via crafted JSON5 input, potentially leading to code execution or privilege escalation in applications using the library.

- **Severity:** High 7.1 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:H`)
- **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:** 24 Dec 2022
- **Updated:** 3 Aug 2024
- **Also known as:** AZL-44886, CLSA-2026-1773015271, CLSA-2026-1773706636, CLSA-2026-1777077480, CLSA-2026-1780879895, CLSA-2026-1792779379, DEBIAN-CVE-2022-46175, DLA-3665-1, GHSA-9c47-m6qq-7p4h, MINI-7pg3-5jc7-c6f6, ROOT-APP-NPM-CVE-2022-46175, UBUNTU-CVE-2022-46175, USN-6758-1

## What is CVE-2022-46175?

CVE-2022-46175 is a high-severity unsafe deserialization vulnerability in Fedoraproject Fedora, published on 24 Dec 2022. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

JSON5 is an extension to the popular JSON file format that aims to be easier to write and maintain by hand (e.g. for config files). The `parse` method of the JSON5 library before and including versions 1.0.1 and 2.2.1 does not restrict parsing of keys named `__proto__`, allowing specially crafted strings to pollute the prototype of the resulting object. This vulnerability pollutes the prototype of the object returned by `JSON5.parse` and not the global Object prototype, which is the commonly understood definition of Prototype Pollution. However, polluting the prototype of a single object can have significant security impact for an application if the object is later used in trusted operations. This vulnerability could allow an attacker to set arbitrary and unexpected keys on the object returned from `JSON5.parse`. The actual impact will depend on how applications utilize the returned object and how they filter unwanted keys, but could include denial of service, cross-site scripting, elevation of privilege, and in extreme cases, remote code execution. `JSON5.parse` should restrict parsing of `__proto__` keys when parsing JSON strings to objects. As a point of reference, the `JSON.parse` method included in JavaScript ignores `__proto__` keys. Simply changing `JSON5.parse` to `JSON.parse` in the examples above mitigates this vulnerability. This vulnerability is patched in json5 versions 1.0.2, 2.2.2, and later.

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

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

4 open source packages ship an affected version, including json5. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `json5` | npm | All versions | 1.0.2 |
| `json5` | npm | All versions | 1.0.2 |
| `json5` | npm | From 2.0.0 | 2.2.2 |
| `json5` | npm | From 2.0.0 | 2.2.2 |

Products: Fedoraproject Fedora, Json5 Json5.

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

Upgrade json5 to a fixed version for your release line: 1.0.2 or 2.2.2.

## Is CVE-2022-46175 being exploited?

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

Public exploit code:

- Reproduction for CVE-2022-46175 (github_poc): https://github.com/giz-berlin/quasar-app-webpack-json5-vulnerability

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2024-4577](https://insights.sbomify.com/CVE-2024-4577/): PHP-CGI OS Command Injection (critical 9.8, exploited in the wild)
- [CVE-2021-39226](https://insights.sbomify.com/CVE-2021-39226/): Grafana Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2019-5544](https://insights.sbomify.com/CVE-2019-5544/): VMware ESXi and Horizon DaaS OpenSLP Heap-Based Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2024-4947](https://insights.sbomify.com/CVE-2024-4947/): Google Chromium V8 Type Confusion (critical 9.6, exploited in the wild)
- [CVE-2024-4671](https://insights.sbomify.com/CVE-2024-4671/): Google Chromium Visuals Use-After-Free (critical 9.6, exploited in the wild)

## Fix prompt for AI coding agents

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

What it is: CVE-2022-46175 is a high-severity unsafe deserialization vulnerability in Fedoraproject Fedora, published on 24 Dec 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-46175 in the wild and no public exploit code.

Affected packages and fixed versions:
- json5 (npm): affected all versions; fixed in 1.0.2
- json5 (npm): affected all versions; fixed in 1.0.2
- json5 (npm): affected from 2.0.0; fixed in 2.2.2
- json5 (npm): affected from 2.0.0; fixed in 2.2.2

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

## Sources

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

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