CVE-2021-22119: Spring Framework Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-w9jg-gvgr-354m
CVSS 7.5
CWE-400 CWE-863
Published
Advisory Summary

CVE-2021-22119 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Spring Framework libraries in the Maven ecosystem. The issue involves resource exhaustion in spring security. Remediation is available by upgrading affected packages to version 5.5.1, 5.4.7, 5.3.10, 5.2.11.

CVE-2021-22119 at a Glance

CVE Identifier CVE-2021-22119
GHSA Identifier GHSA-w9jg-gvgr-354m
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Spring Framework
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-2021-22119

To remediate this vulnerability, upgrade all affected Spring Framework 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.springframework.security:spring-security-core fixed: 5.5.1
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>5.5.1</version>
</dependency>
org.springframework.security:spring-security-core fixed: 5.4.7
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>5.4.7</version>
</dependency>
org.springframework.security:spring-security-core fixed: 5.3.10
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>5.3.10</version>
</dependency>
org.springframework.security:spring-security-core fixed: 5.2.11
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>5.2.11</version>
</dependency>
org.springframework.security:spring-security-oauth2-client fixed: 5.5.1
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-client</artifactId>
    <version>5.5.1</version>
</dependency>
org.springframework.security:spring-security-oauth2-client fixed: 5.4.7
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-client</artifactId>
    <version>5.4.7</version>
</dependency>
org.springframework.security:spring-security-oauth2-client fixed: 5.3.10
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-client</artifactId>
    <version>5.3.10</version>
</dependency>
org.springframework.security:spring-security-oauth2-client fixed: 5.2.11
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-client</artifactId>
    <version>5.2.11</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.springframework.security

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.springframework.security

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

Note: The mvn dependency:tree -Dincludes=org.springframework.security 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Spring Framework, 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

Spring Security versions 5.5.x prior to 5.5.1, 5.4.x prior to 5.4.7, 5.3.x prior to 5.3.10 and 5.2.x prior to 5.2.11 are susceptible to a Denial-of-Service (DoS) attack via the initiation of the Authorization Request in an OAuth 2.0 Client Web and WebFlux application. A malicious user or attacker can send multiple requests initiating the Authorization Request for the Authorization Code Grant, which has the potential of exhausting system resources using a single session or multiple sessions.

CVE-2021-22119 Affected Spring Framework Versions

8 component(s)
Fixed Versions:
5.5.15.4.75.3.105.2.11
Product / Package Ecosystem Affected Versions Fixed Version
org.springframework.security:spring-security-core
Maven
≥ 5.5.0
< 5.5.1
5.5.1
org.springframework.security:spring-security-core
Maven
≥ 5.4.0
< 5.4.7
5.4.7
org.springframework.security:spring-security-core
Maven
≥ 5.3.0
< 5.3.10
5.3.10
org.springframework.security:spring-security-core
Maven
≥ 5.2.0
< 5.2.11
5.2.11
org.springframework.security:spring-security-oauth2-client
Maven
≥ 5.5.0
< 5.5.1
5.5.1
org.springframework.security:spring-security-oauth2-client
Maven
≥ 5.4.0
< 5.4.7
5.4.7
org.springframework.security:spring-security-oauth2-client
Maven
≥ 5.3.0
< 5.3.10
5.3.10
org.springframework.security:spring-security-oauth2-client
Maven
≥ 5.2.0
< 5.2.11
5.2.11

References

NVD — CVE-2021-22119 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-22119
Spring Framework Source Repository REPOSITORY
https://github.com/spring-projects/spring-security/pull/9513
Spring Framework Source Repository REPOSITORY
https://github.com/spring-projects/spring-security
lists.apache.org/thread.html/r08a449... WEB
https://lists.apache.org/thread.html/r08a449010786e0bcffa4b5781b04fcb55d6eafa62cb79b8347680aad@%3Cissues.nifi.apache.org%3E
lists.apache.org/thread.html/r163b3e... WEB
https://lists.apache.org/thread.html/r163b3e4e39803882f5be05ee8606b2b9812920e196daa2a82997ce14@%3Cpluto-dev.portals.apache.org%3E
lists.apache.org/thread.html/r386820... WEB
https://lists.apache.org/thread.html/r3868207b967f926819fe3aa8d33f1666429be589bb4a62104a49f4e3@%3Cpluto-dev.portals.apache.org%3E
lists.apache.org/thread.html/r390783... WEB
https://lists.apache.org/thread.html/r390783b3b1c59b978131ac08390bf77fbb3863270cbde59d5b0f5fde@%3Cpluto-dev.portals.apache.org%3E
lists.apache.org/thread.html/r89aa1b... WEB
https://lists.apache.org/thread.html/r89aa1b48a827f5641310305214547f1d6b2101971a49b624737c497f@%3Cpluto-dev.portals.apache.org%3E
lists.apache.org/thread.html/ra53677... WEB
https://lists.apache.org/thread.html/ra53677224fe4f04c2599abc88032076faa18dc84b329cdeba85d4cfc@%3Cpluto-scm.portals.apache.org%3E
Spring Framework Security Information SECURITY
https://tanzu.vmware.com/security/cve-2021-22119
Spring Framework Security Information SECURITY
https://www.oracle.com/security-alerts/cpujan2022.html
Spring Framework Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html

Frequently Asked Questions

What is CVE-2021-22119?
CVE-2021-22119 is a security vulnerability in Spring Framework involving Resource Exhaustion in Spring Security under CWE-400: Uncontrolled Resource Consumption.
Which Spring Framework versions are affected?
Affected versions include releases prior to 5.5.1, 5.4.7, 5.3.10, 5.2.11 across affected packages: org.springframework.security:spring-security-core, org.springframework.security:spring-security-oauth2-client.
What version fixes CVE-2021-22119?
Upgrading to 5.5.1, 5.4.7, 5.3.10, 5.2.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is spring-security-core affected?
Yes, org.springframework.security:spring-security-core is affected in releases prior to 5.5.1, 5.4.7, 5.3.10, 5.2.11. Upgrade your dependency to 5.5.1, 5.4.7, 5.3.10, 5.2.11 or later.
Is spring-security-oauth2-client affected?
Yes, org.springframework.security:spring-security-oauth2-client is affected in releases prior to 5.5.1, 5.4.7, 5.3.10, 5.2.11. Upgrade your dependency to 5.5.1, 5.4.7, 5.3.10, 5.2.11 or later.
What is the CVSS score of CVE-2021-22119?
CVE-2021-22119 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-2021-22119?
CVE-2021-22119 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Maven dependencies for CVE-2021-22119?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.springframework.security'. 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-w9jg-gvgr-354m",
  "modified" : "2022-03-30T21:15:14Z",
  "published" : "2021-07-02T18:33:34Z",
  "aliases" : [ "CVE-2021-22119" ],
  "summary" : "Resource Exhaustion in Spring Security",
  "details" : "Spring Security versions 5.5.x prior to 5.5.1, 5.4.x prior to 5.4.7, 5.3.x prior to 5.3.10 and 5.2.x prior to 5.2.11 are susceptible to a Denial-of-Service (DoS) attack via the initiation of the Authorization Request in an OAuth 2.0 Client Web and WebFlux application. A malicious user or attacker can send multiple requests initiating the Authorization Request for the Authorization Code Grant, which has the potential of exhausting system resources using a single session or multiple sessions.",
  "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.springframework.security:spring-security-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.5.0"
      }, {
        "fixed" : "5.5.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.4.0"
      }, {
        "fixed" : "5.4.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.3.0"
      }, {
        "fixed" : "5.3.10"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.3.9"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.2.0"
      }, {
        "fixed" : "5.2.11"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.10"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-oauth2-client"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.5.0"
      }, {
        "fixed" : "5.5.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-oauth2-client"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.4.0"
      }, {
        "fixed" : "5.4.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-oauth2-client"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.3.0"
      }, {
        "fixed" : "5.3.10"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.3.9"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-oauth2-client"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.2.0"
      }, {
        "fixed" : "5.2.11"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.10"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-22119"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spring-projects/spring-security/pull/9513"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/spring-projects/spring-security"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r08a449010786e0bcffa4b5781b04fcb55d6eafa62cb79b8347680aad@%3Cissues.nifi.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r163b3e4e39803882f5be05ee8606b2b9812920e196daa2a82997ce14@%3Cpluto-dev.portals.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r3868207b967f926819fe3aa8d33f1666429be589bb4a62104a49f4e3@%3Cpluto-dev.portals.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r390783b3b1c59b978131ac08390bf77fbb3863270cbde59d5b0f5fde@%3Cpluto-dev.portals.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r89aa1b48a827f5641310305214547f1d6b2101971a49b624737c497f@%3Cpluto-dev.portals.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/ra53677224fe4f04c2599abc88032076faa18dc84b329cdeba85d4cfc@%3Cpluto-scm.portals.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://tanzu.vmware.com/security/cve-2021-22119"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-863" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-30T17:30:10Z",
    "nvd_published_at" : "2021-06-29T17:15:00Z"
  }
}