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

Medium 4.8 Published Updated

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.

PackageAffectedFixed in
org.keycloak:keycloak-core MavenAll versions24.0.7
org.keycloak:keycloak-core MavenAll versions24.0.7
org.keycloak:keycloak-core MavenFrom 25.0.025.0.4
org.keycloak:keycloak-core MavenFrom 25.0.025.0.4
keycloak BitnamiFrom 22.0.024.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.

All Redhat Build of Keycloak vulnerabilities

Sources

Also known as BIT-keycloak-2024-7318, GHSA-xmmm-jw76-q7vg.

Is CVE-2024-7318 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free