# CVE-2024-8698: Keycloak-saml-core: improper verification of saml responses leading to privilege escalation in keycloak

> Attackers can bypass SAML signature validation to escalate privileges or impersonate users in Keycloak deployments.

- **Severity:** High 7.7 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 19 Sep 2024
- **Updated:** 4 Aug 2026
- **Also known as:** GHSA-xgfv-xpx8-qhcr

## What is CVE-2024-8698?

CVE-2024-8698 is a high-severity authentication bypass vulnerability in Red Hat RHEL-8 based Middleware Containers, published on 19 Sep 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

A flaw exists in the SAML signature validation method within the Keycloak XMLSignatureUtil class. The method incorrectly determines whether a SAML signature is for the full document or only for specific assertions based on the position of the signature in the XML document, rather than the Reference element used to specify the signed element. This flaw allows attackers to create crafted responses that can bypass the validation, potentially leading to privilege escalation or impersonation attacks.

Weakness: CWE-347 (Improper Verification of Cryptographic Signature)

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

6 open source packages ship an affected version, including org.keycloak:keycloak-saml-core.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.keycloak:keycloak-saml-core` | Maven | All versions | 22.0.13 |
| `org.keycloak:keycloak-saml-core` | Maven | All versions | 22.0.13 |
| `org.keycloak:keycloak-saml-core` | Maven | From 23.0.0 | 24.0.8 |
| `org.keycloak:keycloak-saml-core` | Maven | From 23.0.0 | 24.0.8 |
| `org.keycloak:keycloak-saml-core` | Maven | From 25.0.0 | 25.0.6 |
| `org.keycloak:keycloak-saml-core` | Maven | From 25.0.0 | 25.0.6 |

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

Upgrade org.keycloak:keycloak-saml-core to a fixed version for your release line: 22.0.13, 24.0.8 or 25.0.6.

## Is CVE-2024-8698 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-8698 exists.

Public exploit code:

- i'm noob with saml and keycloak . J4f (github_poc): https://github.com/huydoppaz/CVE-2024-8698-POC
- Keycloak - SAML Core Package Signature Validation Flaw (nuclei): http/cves/2024/CVE-2024-8698.yaml

## Fix prompt for AI coding agents

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

What it is: CVE-2024-8698 is a high-severity authentication bypass vulnerability in Red Hat RHEL-8 based Middleware Containers, published on 19 Sep 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-8698 exists.

Affected packages and fixed versions:
- org.keycloak:keycloak-saml-core (Maven): affected all versions; fixed in 22.0.13
- org.keycloak:keycloak-saml-core (Maven): affected all versions; fixed in 22.0.13
- org.keycloak:keycloak-saml-core (Maven): affected from 23.0.0; fixed in 24.0.8
- org.keycloak:keycloak-saml-core (Maven): affected from 23.0.0; fixed in 24.0.8
- org.keycloak:keycloak-saml-core (Maven): affected from 25.0.0; fixed in 25.0.6
- org.keycloak:keycloak-saml-core (Maven): affected from 25.0.0; fixed in 25.0.6

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-8698/ (Markdown: https://insights.sbomify.com/CVE-2024-8698/index.md)
```

## Sources

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

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