CVE-2024-22871: Clojure Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-vr64-r9qj-h27f
CVSS 7.5
CWE-502
Published
Advisory Summary

CVE-2024-22871 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Clojure libraries in the Maven ecosystem. The issue involves reading specially crafted serializable objects from an untrusted source may cause an infinite loop and denial of service. Remediation is available by upgrading affected packages to version 1.11.2, 1.12.0-alpha9.

CVE-2024-22871 at a Glance

CVE Identifier CVE-2024-22871
GHSA Identifier GHSA-vr64-r9qj-h27f
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Clojure
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-22871

To remediate this vulnerability, upgrade all affected Clojure dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.clojure:clojure fixed: 1.11.2
<dependency>
    <groupId>org.clojure</groupId>
    <artifactId>clojure</artifactId>
    <version>1.11.2</version>
</dependency>
org.clojure:clojure fixed: 1.12.0-alpha9
<dependency>
    <groupId>org.clojure</groupId>
    <artifactId>clojure</artifactId>
    <version>1.12.0-alpha9</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.clojure

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2024-22871, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.clojure

Analyze the terminal output to locate any version of Clojure in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.11.2), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.clojure 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 Clojure, 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

Any program on the JVM may read serialized objects via [java.io.ObjectInputStream.readObject()](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectInputStream.html#readObject--). Reading serialized objects from an untrusted source is **inherently unsafe** (this affects any program running on any version of the JVM) and is a prerequisite for this vulnerability. Clojure classes that represent infinite seqs (Cycle, infinite Repeat, and Iterate) do not define hashCode() and use the parent ASeq.hashCode(), which walks the seq to compute the hash, yielding an infinite loop. Classes like java.util.HashMap call hashCode() on keys during deserialization of a serialized map. The exploit requires: 1. Crafting a serialized HashMap object with an infinite seq object as a key. 2. Sending that to a program that reads serialized objects via ObjectInputStream.readObject(). This will cause the program to enter an infinite loop on the reading thread and thus a denial of service (DoS). The affected Clojure classes (Cycle, Repeat, Iterate) exist in Clojure 1.7.0-1.11.1, 1.12.0-alpha1-1.12.0-alpha8.

CVE-2024-22871 Affected Clojure Versions

2 component(s)
Fixed Versions:
1.11.21.12.0-alpha9
Product / Package Ecosystem Affected Versions Fixed Version
org.clojure:clojure
Maven
≥ 1.7.0
< 1.11.2
1.11.2
org.clojure:clojure
Maven
≥ 1.12.0-alpha1
< 1.12.0-alpha9
1.12.0-alpha9

References

Frequently Asked Questions

What is CVE-2024-22871?
CVE-2024-22871 is a security vulnerability in Clojure involving Reading specially crafted serializable objects from an untrusted source may cause an infinite loop and denial of service under CWE-502: Deserialization of Untrusted Data.
Which Clojure versions are affected?
Affected versions include releases prior to 1.11.2, 1.12.0-alpha9 across affected packages: org.clojure:clojure.
What version fixes CVE-2024-22871?
Upgrading to 1.11.2, 1.12.0-alpha9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is clojure affected?
Yes, org.clojure:clojure is affected in releases prior to 1.11.2, 1.12.0-alpha9. Upgrade your dependency to 1.11.2, 1.12.0-alpha9 or later.
What is the CVSS score of CVE-2024-22871?
CVE-2024-22871 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-22871?
CVE-2024-22871 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check Maven dependencies for CVE-2024-22871?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.clojure'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vr64-r9qj-h27f",
  "modified" : "2025-11-05T00:31:17Z",
  "published" : "2024-02-29T03:33:18Z",
  "aliases" : [ "CVE-2024-22871" ],
  "summary" : "Reading specially crafted serializable objects from an untrusted source may cause an infinite loop and denial of service",
  "details" : "Any program on the JVM may read serialized objects via [java.io.ObjectInputStream.readObject()](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectInputStream.html#readObject--). Reading serialized objects from an untrusted source is **inherently unsafe** (this affects any program running on any version of the JVM) and is a prerequisite for this vulnerability.\n\nClojure classes that represent infinite seqs (Cycle, infinite Repeat, and Iterate) do not define hashCode() and use the parent ASeq.hashCode(), which walks the seq to compute the hash, yielding an infinite loop. Classes like java.util.HashMap call hashCode() on keys during deserialization of a serialized map. \n\nThe exploit requires:\n\n1. Crafting a serialized HashMap object with an infinite seq object as a key.\n2. Sending that to a program that reads serialized objects via ObjectInputStream.readObject().\n\nThis will cause the program to enter an infinite loop on the reading thread and thus a denial of service (DoS). \n\nThe affected Clojure classes (Cycle, Repeat, Iterate) exist in Clojure 1.7.0-1.11.1, 1.12.0-alpha1-1.12.0-alpha8.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.clojure:clojure"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.7.0"
      }, {
        "fixed" : "1.11.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.clojure:clojure"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.12.0-alpha1"
      }, {
        "fixed" : "1.12.0-alpha9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22871"
  }, {
    "type" : "WEB",
    "url" : "https://clojure.atlassian.net/browse/CLJ-2839"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/clojure/clojure"
  }, {
    "type" : "WEB",
    "url" : "https://hackmd.io/%40fe1w0/rymmJGida"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/25FKUOYXQZGGJMFUM5HJABWMIX2TILRV"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SWWK2SO2MH4SXPO6L444MM6LHVLVFULV"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YFPGUDXMW6OXKIDGCOZFEAXO74VQIB2T"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/25FKUOYXQZGGJMFUM5HJABWMIX2TILRV"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SWWK2SO2MH4SXPO6L444MM6LHVLVFULV"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YFPGUDXMW6OXKIDGCOZFEAXO74VQIB2T"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-01T16:56:52Z",
    "nvd_published_at" : "2024-02-29T02:15:09Z"
  }
}