Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2024-7318: Use of a Key Past its Expiration Date

0
Medium
VulnerabilityCVE-2024-7318cvecve-2024-7318
Published: Mon Sep 09 2024 (09/09/2024, 18:50:36 UTC)
Source: CVE

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.

AI-Powered Analysis

AILast updated: 11/21/2025, 08:37:48 UTC

Technical Analysis

CVE-2024-7318 is a vulnerability identified in Keycloak, an open-source identity and access management solution widely used for securing applications and services. The issue arises from the handling of one-time passcodes (OTPs) generated by FreeOTP when the OTP token period is set to the default 30 seconds. Normally, OTPs expire after 30 seconds, ensuring a narrow window for authentication and reducing the risk of replay attacks. However, due to this vulnerability, expired OTPs remain valid for an additional 30 seconds, effectively doubling the token validity period to one minute. This means that at any given time, two OTPs are valid simultaneously, increasing the attack window and the likelihood that an attacker could reuse an OTP to gain unauthorized access. The vulnerability affects Keycloak versions up to and including 25.0.0. The CVSS 3.1 base score is 4.8 (medium severity), reflecting a network attack vector with high attack complexity, no privileges required, no user interaction, and limited impact on confidentiality and integrity but no impact on availability. The flaw does not currently have known exploits in the wild, but it represents a significant risk in environments where OTP-based two-factor authentication is critical for security. The root cause is improper enforcement of OTP expiration timing, which should strictly invalidate tokens after their designated period. This vulnerability increases the risk of replay attacks and unauthorized access, particularly in high-security environments relying on Keycloak and FreeOTP for authentication.

Potential Impact

For European organizations, the primary impact of CVE-2024-7318 is the increased risk of unauthorized access due to the extended validity of OTP tokens. Organizations using Keycloak with FreeOTP for two-factor authentication may experience a higher likelihood of successful replay attacks, potentially compromising user accounts and sensitive data. This can lead to breaches of confidentiality and integrity, especially in sectors such as finance, healthcare, government, and critical infrastructure where strong authentication is mandatory. The extended token validity also undermines compliance with strict regulatory frameworks like GDPR and NIS Directive, which require robust access controls. Although the vulnerability does not affect availability, the potential for account compromise can lead to lateral movement within networks and subsequent data exfiltration or service disruption. The medium CVSS score reflects that exploitation requires network access and has high complexity, but no privileges or user interaction, making it a realistic threat in exposed environments. Organizations with large user bases or those integrating Keycloak into cloud or hybrid environments should be particularly vigilant.

Mitigation Recommendations

To mitigate CVE-2024-7318, European organizations should first verify their Keycloak version and upgrade to a patched release once available, as no official patch links are currently provided but are expected. In the interim, administrators can reduce the OTP token period below 30 seconds if configurable, minimizing the window of token validity overlap. Alternatively, consider switching to a different OTP application or method that strictly enforces token expiration. Implement additional monitoring and alerting for suspicious authentication attempts, focusing on repeated or out-of-window OTP usage. Enforce multi-factor authentication policies that do not solely rely on OTPs, such as hardware tokens or biometric factors, to reduce reliance on vulnerable OTP mechanisms. Conduct regular security audits and penetration tests to identify potential exploitation attempts. Educate users about the importance of timely OTP usage and the risks of token reuse. Finally, restrict network access to Keycloak authentication endpoints to trusted IP ranges to limit exposure to remote attackers.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
redhat
Date Reserved
2024-07-31T03:04:15.355Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d9837c4522896dcbeb7de

Added to database: 5/21/2025, 9:09:11 AM

Last enriched: 11/21/2025, 8:37:48 AM

Last updated: 12/3/2025, 11:56:01 PM

Views: 66

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats