CVE-2024-7318 Keycloak-core: one time passcode (otp) is valid longer than expiration timeseverity
Expired OTP codes remain valid for an extended period, allowing attackers to bypass two-factor authentication and compromise user accounts.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-7318?
CVE-2024-7318 is a medium-severity vulnerability in Redhat Build of Keycloak, published on 9 Sep 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Weakness: CWE-324
Which versions are affected by CVE-2024-7318?
5 open source packages ship an affected version, including org.keycloak:keycloak-core and keycloak. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
org.keycloak:keycloak-core Maven | All versions | 24.0.7 |
org.keycloak:keycloak-core Maven | All versions | 24.0.7 |
org.keycloak:keycloak-core Maven | From 25.0.0 | 25.0.4 |
org.keycloak:keycloak-core Maven | From 25.0.0 | 25.0.4 |
keycloak Bitnami | From 22.0.0 | 24.0.7 |
Products include Redhat Build of Keycloak.
How do I fix CVE-2024-7318?
Upgrade org.keycloak:keycloak-core to a fixed version for your release line: 24.0.7 or 25.0.4.
Is CVE-2024-7318 being exploited?
There is no known exploitation of CVE-2024-7318 in the wild and no public exploit code.
Other vulnerabilities in Redhat Build of Keycloak
- CVE-2026-15572 Keycloak-services: keycloak-services: dcr protocol mapper type-swap policy bypass allows privilege escalation
- CVE-2026-3047 Keycloak SAML Broken has Authentication Bypass by Primary Weakness
- CVE-2026-15573 Keycloak-services: keycloak-services: authorization bypass via unnormalized uri matching in pathmatcher
- CVE-2026-16102 Keycloak-services: keycloak-services: default dcr policy allows role forgery via user property mappers
- CVE-2026-1609 Org.keycloak/keycloak-quarkus-server: keycloak: unauthorized access via jwt authorization grant with disabled users
Sources
Also known as BIT-keycloak-2024-7318, GHSA-xmmm-jw76-q7vg.