CVE-2021-22095 is a medium-severity (CVSS 6.5) Deserialization of Untrusted Data vulnerability in org.springframework.amqp:spring-amqp. A fix is available for org.springframework.amqp:spring-amqp — see the affected versions and patch details below.
Deserialization of Untrusted Data in Spring AMQP
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
org.springframework.amqp:spring-amqp☕org.springframework.amqp:spring-amqpReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Maven packages — download data is not available via public APIs for these ecosystems.
Description
In Spring AMQP versions 2.2.0 - 2.2.19 and 2.3.0 - 2.3.11, the Spring AMQP Message object, in its toString() method, will create a new String object from the message body, regardless of its size. This can cause an OOM Error with a large message
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| ☕Maven | org.springframework.amqp:spring-amqp | ≥ 2.2.0&&< 2.2.20 | 2.2.20org.springframework.amqp:spring-amqp:2.2.20 |
| ☕Maven | org.springframework.amqp:spring-amqp | ≥ 2.3.0&&< 2.3.11 | 2.3.11org.springframework.amqp:spring-amqp:2.3.11 |
Affected Products
spring advanced message queuing protocolvmwareDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for org.springframework.amqp:spring-amqp, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update org.springframework.amqp:spring-amqp to 2.2.20 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-22095 is resolved across your whole dependency graph.
Workarounds
Do not deserialise data from untrusted sources: where the format allows it, restrict deserialisation to an explicit allowlist of expected types, and prefer a data-only format (JSON, Protobuf) over one that can reconstruct arbitrary objects until you can upgrade.
Frequently Asked Questions
Is CVE-2021-22095 in your dependencies?
Find it across Maven, including transitive dependencies.