CVE-2021-29485: Ratpack core Remote Code Execution Vulnerability
CRITICALCVE-2021-29485 is a CRITICAL (CVSS 9.9) remote code execution vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Ratpack core libraries in the Maven ecosystem. The issue involves remote code execution vulnerability in session storage. Remediation is available by upgrading affected packages to version 1.9.0.
CVE-2021-29485 at a Glance
Security Impact
CVSS: 9.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2021-29485
To remediate this vulnerability, upgrade all affected Ratpack core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>io.ratpack</groupId>
<artifactId>ratpack-core</artifactId>
<version>1.9.0</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=io.ratpack
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-29485, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=io.ratpack
Analyze the terminal output to locate any version of Ratpack core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.9.0), your application is affected.
Note: The mvn dependency:tree -Dincludes=io.ratpack command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Ratpack core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-29485 Affected Ratpack core Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
io.ratpack:ratpack-core
|
Maven |
< 1.9.0
|
1.9.0
|
References
Frequently Asked Questions
What is CVE-2021-29485?
Which Ratpack core versions are affected?
What version fixes CVE-2021-29485?
Is ratpack-core affected?
What is the CVSS score of CVE-2021-29485?
What CWE is associated with CVE-2021-29485?
How can I check Maven dependencies for CVE-2021-29485?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hc33-32vw-rpp9",
"modified" : "2021-10-21T14:14:24Z",
"published" : "2021-07-01T17:01:16Z",
"aliases" : [ "CVE-2021-29485" ],
"summary" : "Remote Code Execution Vulnerability in Session Storage",
"details" : "### Impact\n\nA malicious attacker can achieve Remote Code Execution (RCE) via a maliciously crafted Java deserialization gadget chain leveraged against the Ratpack session store.\n\nIf your application does not use Ratpack's session mechanism, it is not vulnerable.\n\n### Details\n\nAttackers with the ability to write to session data, can potentially craft payloads that deserialize unsafe objects, leading to the ability to remotely execute arbitrary code. \nThis is known as an “[insecure deserialization](https://portswigger.net/web-security/deserialization)” vulnerability, or “gadget vulnerability”.\n\nRatpack allows session data to be stored server side in an external system such as a relational database, or client side via user cookies.\nWhen using server side storage, the attacker would need to obtain the ability to write to the session data store.\nWhen using client side storage, the attacker would need to obtain the secrets used to encrypt and/or sign the session data stored in user cookies.\n\nRatpack's session mechanism allows storing serialized objects, of arbitrary types. \nThe type must be specified when writing the data and when reading, with data only deserialized when there is an exact type match.\nHowever, in the process of deserializing an object of a known/trusted/deserialization-safe type, it may attempt to deserialize unsafe types.\n\nBy default Ratpack uses Java's built-in serialization mechanism, though other serialization providers can be used.\nThe exact types of payloads required to enable an exploit depend on the exact serialization mechanism used.\n\nTo mitigate this vulnerability, Ratpack now employs a “strict allow-list” when deserializing (and serializing) objects to session data. \nAll concrete types of objects serialized must be explicitly declared as safe.\nSome standard well known JDK types are registered by default.\n\nSerialization is provided by implementations of [`SessionSerializer`](https://ratpack.io/manual/1.9.0/api/ratpack/session/SessionSerializer.html).\nIts existing methods have been deprecated, and replaced with a [new methods](https://ratpack.io/manual/1.9.0/api/ratpack/session/SessionSerializer.html#deserialize(java.lang.Class,java.io.InputStream,ratpack.session.SessionTypeFilter)) that accept a [`SessionTypeFilter`](https://ratpack.io/manual/1.9.0/api/ratpack/session/SessionTypeFilter.html) that can be used to assert whether a type is allowed when serializing and deserializing.\n\nThe default serializer implementation has been updated to use this mechanism.\nAny proprietary implementations should also be updated to consult the type filter _before_ serializing or deserializing data.\nWarnings will be logged any time an implementation that does not implement the new methods is used.\n\nUpon upgrading to Ratpack 1.9, users of the built-in serialization mechanism will need to change their application to declare all types currently being serialized as being safe. This can be done using the new [`SessionModule.allowTypes()`](https://ratpack.io/manual/1.9.0/api/ratpack/session/SessionModule.html#allowTypes(com.google.inject.Binder,java.lang.Class...)) method. Please see its documentation for details...))\n\n### Patches\n\nRatpack 1.9.0 introduces a strict allow-list mechanism that mitigates this vulnerability when used.\n\n### Workarounds\n\nThe simplest mitigation for users of earlier versions is to reduce the likelihood of attackers being able to write to the session data store. \n\nAlternatively or additionally, the allow-list mechanism could be manually back ported by providing an alternative implementation of `SessionSerializer` that uses an allow-list.\n\n### References\n\n - https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/\n - https://owasp.org/www-community/vulnerabilities/Deserialization_of_untrusted_data\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "io.ratpack:ratpack-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.9.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ratpack/ratpack/security/advisories/GHSA-hc33-32vw-rpp9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29485"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ratpack/ratpack"
}, {
"type" : "WEB",
"url" : "https://mvnrepository.com/artifact/io.ratpack/ratpack-core"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-502" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-06-30T17:46:45Z",
"nvd_published_at" : "2021-06-29T19:15:00Z"
}
}