# CVE-2024-22258: CVE-2024-22258: PKCE Downgrade in Spring Authorization Server

> Attackers can bypass PKCE protection for confidential clients using the Authorization Code Grant, potentially compromising authentication security.

- **Severity:** Medium 6.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 20 Mar 2024
- **Updated:** 5 Dec 2024
- **Also known as:** CLSA-2026-1768522124, GHSA-x637-x8p3-5p22, ROOT-APP-MAVEN-CVE-2024-22258, UBUNTU-CVE-2024-22258

## What is CVE-2024-22258?

CVE-2024-22258 is a medium-severity vulnerability in Spring, published on 20 Mar 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

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.

Weakness: CWE-470 (Use of Externally-Controlled Input to Select Classes or Code)

## Which versions are affected by CVE-2024-22258?

4 open source packages ship an affected version, including org.springframework.security:spring-security-oauth2-authorization-server.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.springframework.security:spring-security-oauth2-authorization-server` | Maven | All versions | 1.1.6 |
| `org.springframework.security:spring-security-oauth2-authorization-server` | Maven | All versions | 1.1.6 |
| `org.springframework.security:spring-security-oauth2-authorization-server` | Maven | From 1.2.0 | 1.2.3 |
| `org.springframework.security:spring-security-oauth2-authorization-server` | Maven | From 1.2.0 | 1.2.3 |

## How do I fix CVE-2024-22258?

Upgrade org.springframework.security:spring-security-oauth2-authorization-server to a fixed version for your release line: 1.1.6 or 1.2.3.

## Is CVE-2024-22258 being exploited?

There is no known exploitation of CVE-2024-22258 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-22258 and fix it if it is affected.

What it is: CVE-2024-22258 is a medium-severity vulnerability in Spring, published on 20 Mar 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-22258 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.springframework.security:spring-security-oauth2-authorization-server (Maven): affected all versions; fixed in 1.1.6
- org.springframework.security:spring-security-oauth2-authorization-server (Maven): affected all versions; fixed in 1.1.6
- org.springframework.security:spring-security-oauth2-authorization-server (Maven): affected from 1.2.0; fixed in 1.2.3
- org.springframework.security:spring-security-oauth2-authorization-server (Maven): affected from 1.2.0; fixed in 1.2.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-22258/ (Markdown: https://insights.sbomify.com/CVE-2024-22258/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-22258
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-22258
- OSV: https://osv.dev/vulnerability/CVE-2024-22258

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-22258/
Summaries are generated and may contain mistakes; the official description above is the record.
