eduMFA Token Reusage Vulnerability due to Incorrect InnoDB Snapshot Isolation
eduMFA versions prior to 2.9.1 are vulnerable to token reusage due to incorrect InnoDB snapshot isolation in MySQL and MariaDB versions prior to 11.6.2 (or newer with innodb_snapshot_isolation=off), affecting token types such as TOTP, HOTP, and likely WebAuthN, where tokens are intended for single use, requiring racing the transaction for exploitation.
A vulnerability exists in eduMFA versions prior to 2.9.1 related to the handling of transaction isolation within the database layer. Specifically, when eduMFA is deployed with MySQL or MariaDB versions prior to 11.6.2 (or newer versions with innodb_snapshot_isolation explicitly set to OFF), it is possible for attackers to reuse token values due to faulty transaction isolation. This is because the database might not properly serialize token usage, allowing multiple requests to validate the same token before it is invalidated. The affected token types include TOTP, HOTP, and potentially WebAuthN, all of which rely on single-use tokens. Exploitation requires racing conditions. The vulnerability was addressed in eduMFA version 2.9.1.
Attack Chain
- User initiates a multi-factor authentication process.
- eduMFA generates a time-based or counter-based one-time password (TOTP or HOTP).
- The token and associated user data are written to the database.
- Attacker initiates multiple authentication requests using the same token value in rapid succession.
- Due to incorrect InnoDB snapshot isolation, multiple authentication requests may read the same uncommitted token value from the database before it is invalidated by the first successful authentication.
- The database validates the token for each of the attacker’s requests, as the isolation level does not prevent concurrent reads before write.
- If the race succeeds, multiple authentication sessions are established using the same token.
- The attacker gains unauthorized access to the user’s account.
Impact
Successful exploitation of this vulnerability allows an attacker to bypass multi-factor authentication and gain unauthorized access to user accounts. This could lead to data breaches, account compromise, and other malicious activities. The number of potentially affected users depends on the deployment size of eduMFA and the number of users relying on TOTP, HOTP or WebAuthN for authentication. Sectors that rely on eduMFA for authentication are potentially at risk.
Recommendation
- Upgrade eduMFA to version 2.9.1 to apply the fix that locks rows prior to write with SELECT FOR UPDATE.
- If upgrading is not immediately feasible, set
innodb_snapshot_isolationto ON in MariaDB configurations (default in MariaDB >= 11.6.2) as a workaround.
Detection coverage 2
Detect MariaDB Configuration with innodb_snapshot_isolation OFF
mediumDetects MariaDB instances with innodb_snapshot_isolation explicitly set to OFF, indicating a potential vulnerability to token reusage in multi-factor authentication systems.
Detect eduMFA Request for token validation with multiple requests in short time
highDetects requests attempting to validate the same eduMFA token from the same IP address within a short time period, which may indicate token reusage attempts
Detection queries are available on the platform. Get full rules →