# CVE-2022-1471: Remote Code execution in SnakeYAML

> Attackers can achieve remote code execution by providing malicious YAML content to applications using SnakeYAML's unsafe Constructor class.

- **Severity:** High 8.3 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L`)
- **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 Dec 2022
- **Updated:** 18 Jun 2025
- **Also known as:** ALSA-2022:9058, CLEANSTART-2026-LU07367, CLEANSTART-2026-ND79703, CLEANSTART-2026-QU79402, CLSA-2024-1732492822, CLSA-2025-1751328253, CLSA-2025-1751328254, CLSA-2025-1751328256, CLSA-2026-1792422122, CLSA-2026-1792422186, DEBIAN-CVE-2022-1471, ECHO-200a-9a58-ad64, GHSA-mjmj-j48q-9wg2, MINI-3c7c-xx5v-hrx2, MINI-47mh-xmq2-g9jq, MINI-524x-fc7g-gw3g, MINI-92x5-x256-9qpv, MINI-hq42-g236-46v3, MINI-ph9p-pcqg-v6h3, MINI-q3hj-f9gr-3g2x, MINI-rw9f-2xr8-grff, MINI-v2pg-vj8j-m2g6, MINI-xhgv-7jjc-4f9j, RHLW-2026-db6cfa79167ec456, RHSA-2022:9058, RLSA-2022:9058, ROOT-APP-MAVEN-CVE-2022-1471, UBUNTU-CVE-2022-1471

## What is CVE-2022-1471?

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

### Official description

SnakeYaml's Constructor() class does not restrict types which can be instantiated during deserialization. Deserializing yaml content provided by an attacker can lead to remote code execution. We recommend using SnakeYaml's SafeConsturctor when parsing untrusted content to restrict deserialization. We recommend upgrading to version 2.0 and beyond.

Weakness: CWE-502 (Deserialization of Untrusted Data), CWE-20 (Improper Input Validation)

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

2 open source packages ship an affected version, including org.yaml:snakeyaml. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.yaml:snakeyaml` | Maven | All versions | 2.0 |
| `org.yaml:snakeyaml` | Maven | All versions | 2.0 |
| `prometheus-jmx-exporter` | AlmaLinux:8 | All versions | 0.12.0-9.el8_7 |
| `prometheus-jmx-exporter-openjdk11` | AlmaLinux:8 | All versions | 0.12.0-9.el8_7 |
| `prometheus-jmx-exporter-openjdk17` | AlmaLinux:8 | All versions | 0.12.0-9.el8_7 |
| `prometheus-jmx-exporter-openjdk8` | AlmaLinux:8 | All versions | 0.12.0-9.el8_7 |
| `prometheus-jmx-exporter` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.12.0-9.el8_7 |
| `prometheus-jmx-exporter-openjdk11` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.12.0-9.el8_7 |
| `prometheus-jmx-exporter-openjdk17` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.12.0-9.el8_7 |
| `prometheus-jmx-exporter-openjdk8` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.12.0-9.el8_7 |
| `prometheus-jmx-exporter` | Rocky Linux:8 | All versions | 0:0.12.0-9.el8_7 |

Products: Snakeyaml Project Snakeyaml.

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

Upgrade org.yaml:snakeyaml to 2.0 or later.

## Is CVE-2022-1471 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-1471 exists.

Public exploit code:

- Code for veracode blog (github_poc): https://github.com/1fabunicorn/SnakeYAML-CVE-2022-1471-POC
- SnakeYAML-CVE-2022-1471-POC (github_poc): https://github.com/falconkei/snakeyaml_cve_poc
- PyTorch Model Server Registration and Deserialization RCE (metasploit)
- SnakeYAML CVE-2022-1471 exploit payload for demo (github_poc): https://github.com/seal-sec-demo-2/yaml-payload
- attacker  (github_poc): https://github.com/jelee2555/CVE-2022-1471-attacker
- Sentinel demo: transitive snakeyaml CVE-2022-1471 via Spring Boot + exploitable code pattern (github_poc): https://github.com/anupamojha-eng/sentinel-transitive-cve-demo

## Other vulnerabilities in SnakeYAML

- [CVE-2022-38752](https://insights.sbomify.com/CVE-2022-38752/): DoS in SnakeYAML (medium 6.5)

## Fix prompt for AI coding agents

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

What it is: CVE-2022-1471 is a high-severity unsafe deserialization vulnerability in SnakeYAML, published on 1 Dec 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-1471 exists.

Affected packages and fixed versions:
- org.yaml:snakeyaml (Maven): affected all versions; fixed in 2.0
- org.yaml:snakeyaml (Maven): affected all versions; fixed in 2.0

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

## Sources

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

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