CVE-2024-22258: Spring Framework Improper Authentication Vulnerability

MODERATE
Advisory Identifier: GHSA-x637-x8p3-5p22
CVSS 6.1
CWE-470 CWE-287
Published
Advisory Summary

CVE-2024-22258 is a MODERATE (CVSS 6.1) improper authentication vulnerability (CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')) affecting Spring Framework libraries in the Maven ecosystem. The issue involves improper authentication in spring authorization server. Remediation is available by upgrading affected packages to version 1.1.6, 1.2.3.

CVE-2024-22258 at a Glance

CVE Identifier CVE-2024-22258
GHSA Identifier GHSA-x637-x8p3-5p22
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
Affected Product Spring Framework
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 6.1

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:R/S:C/C:L/I:L/A:N).

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

How to Fix CVE-2024-22258

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-oauth2-authorization-server fixed: 1.1.6
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-authorization-server</artifactId>
    <version>1.1.6</version>
</dependency>
org.springframework.security:spring-security-oauth2-authorization-server fixed: 1.2.3
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-authorization-server</artifactId>
    <version>1.2.3</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-2024-22258, 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 1.1.6), 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-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection'), where the product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code. 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 Authorization Server versions 1.0.0 - 1.0.5, 1.1.0 - 1.1.5, 1.2.0 - 1.2.2 and older unsupported versions are susceptible to a PKCE Downgrade Attack for Confidential Clients. Specifically, an application is vulnerable when a Confidential Client uses PKCE for the Authorization Code Grant. An application is not vulnerable when a Public Client uses PKCE for the Authorization Code Grant.

CVE-2024-22258 Affected Spring Framework Versions

2 component(s)
Fixed Versions:
1.1.61.2.3
Product / Package Ecosystem Affected Versions Fixed Version
org.springframework.security:spring-security-oauth2-authorization-server
Maven
< 1.1.6
1.1.6
org.springframework.security:spring-security-oauth2-authorization-server
Maven
≥ 1.2.0
< 1.2.3
1.2.3

References

Frequently Asked Questions

What is CVE-2024-22258?
CVE-2024-22258 is a security vulnerability in Spring Framework involving Improper Authentication in Spring Authorization Server under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection').
Which Spring Framework versions are affected?
Affected versions include releases prior to 1.1.6, 1.2.3 across affected packages: org.springframework.security:spring-security-oauth2-authorization-server.
What version fixes CVE-2024-22258?
Upgrading to 1.1.6, 1.2.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is spring-security-oauth2-authorization-server affected?
Yes, org.springframework.security:spring-security-oauth2-authorization-server is affected in releases prior to 1.1.6, 1.2.3. Upgrade your dependency to 1.1.6, 1.2.3 or later.
What is the CVSS score of CVE-2024-22258?
CVE-2024-22258 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2024-22258?
CVE-2024-22258 is classified under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') (The product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code.).
How can I check Maven dependencies for CVE-2024-22258?
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-x637-x8p3-5p22",
  "modified" : "2024-12-05T22:17:59Z",
  "published" : "2024-03-20T15:32:28Z",
  "aliases" : [ "CVE-2024-22258" ],
  "summary" : "Improper Authentication in Spring Authorization Server",
  "details" : "Spring Authorization Server versions 1.0.0 - 1.0.5, 1.1.0 - 1.1.5, 1.2.0 - 1.2.2 and older unsupported versions are susceptible to a PKCE Downgrade Attack for Confidential Clients.\n\nSpecifically, an application is vulnerable when a Confidential Client uses PKCE for the Authorization Code Grant.\n\nAn application is not vulnerable when a Public Client uses PKCE for the Authorization Code Grant.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-oauth2-authorization-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework.security:spring-security-oauth2-authorization-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.2.0"
      }, {
        "fixed" : "1.2.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22258"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spring-projects/spring-authorization-server/commit/a7035d22bd2de6c24e7125623d38fb83d8f659a9"
  }, {
    "type" : "WEB",
    "url" : "https://spring.io/security/cve-2024-22258"
  }, {
    "type" : "PACKAGE",
    "url" : "github.com/spring-projects/spring-authorization-server"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287", "CWE-470" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-20T17:09:02Z",
    "nvd_published_at" : "2024-03-20T04:15:08Z"
  }
}