# CVE-2021-22097: Deserialization of Untrusted Data in Spring AMQP

> Attackers can cause 100% CPU usage and denial of service by triggering the toString method on malicious serialized messages in Spring AMQP.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/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:** 28 Oct 2021
- **Updated:** 3 Aug 2024
- **Also known as:** CLSA-2026-1789453747, GHSA-fx7f-rjqj-52pj

## What is CVE-2021-22097?

CVE-2021-22097 is a medium-severity denial of service vulnerability in Spring AMQP, published on 28 Oct 2021. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

In Spring AMQP versions 2.2.0 - 2.2.18 and 2.3.0 - 2.3.10, the Spring AMQP Message object, in its toString() method, will deserialize a body for a message with content type application/x-java-serialized-object. It is possible to construct a malicious java.util.Dictionary object that can cause 100% CPU usage in the application if the toString() method is called.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2021-22097?

4 open source packages ship an affected version, including org.springframework.amqp:spring-amqp. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.springframework.amqp:spring-amqp` | Maven | From 2.2.0 | 2.2.19 |
| `org.springframework.amqp:spring-amqp` | Maven | From 2.2.0 | 2.2.19 |
| `org.springframework.amqp:spring-amqp` | Maven | From 2.3.0 | 2.3.11 |
| `org.springframework.amqp:spring-amqp` | Maven | From 2.3.0 | 2.3.11 |

Products: Vmware Spring Advanced Message Queuing Protocol.

## How do I fix CVE-2021-22097?

Upgrade org.springframework.amqp:spring-amqp to a fixed version for your release line: 2.2.19 or 2.3.11.

## Is CVE-2021-22097 being exploited?

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

## Other vulnerabilities in Spring AMQP

- [CVE-2026-59272](https://insights.sbomify.com/CVE-2026-59272/): Log4j2 AmqpAppender disables TLS hostname verification by default (medium 6.8)
- [CVE-2026-59275](https://insights.sbomify.com/CVE-2026-59275/): Deserialization in Spring AMQP (medium 6.6)
- [CVE-2026-59320](https://insights.sbomify.com/CVE-2026-59320/): In Spring AMQP the link credit never replenished on listener exception path (medium 6.5)
- [CVE-2026-47860](https://insights.sbomify.com/CVE-2026-47860/): Unbounded decompression of attacker-supplied compressed message bodies (medium 6.5)
- [CVE-2021-22095](https://insights.sbomify.com/CVE-2021-22095/): Deserialization of Untrusted Data in Spring AMQP (medium 6.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-22097 and fix it if it is affected.

What it is: CVE-2021-22097 is a medium-severity denial of service vulnerability in Spring AMQP, published on 28 Oct 2021. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-22097 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.springframework.amqp:spring-amqp (Maven): affected from 2.2.0; fixed in 2.2.19
- org.springframework.amqp:spring-amqp (Maven): affected from 2.2.0; fixed in 2.2.19
- org.springframework.amqp:spring-amqp (Maven): affected from 2.3.0; fixed in 2.3.11
- org.springframework.amqp:spring-amqp (Maven): affected from 2.3.0; fixed in 2.3.11

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

## Sources

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

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