#101850Randomly getting exception "MFA setup is not necessary. Do not call this endpoint on your own."
Description
After setting [BE][requireMfa] = 1 (Require multi-factor authentication for all users) we are randomly seeing the Exception “MFA setup is not necessary. Do not call this endpoint on your own.” within the Typo3 Log.
It is logged multiple times when a useres logs in. The user does not experience any problems while the message is logged. The MFA login works as expected.
The were never logged when [BE][requireMfa] was set to 0.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 18
-
Peter Niederlag commented <span data-processor="relativetime" data-value="2024-08-12T07:05:46+00:00" > 08/12/24, 07:05 </span>
-
Moritz Kiehl commented <span data-processor="relativetime" data-value="2024-08-19T12:27:44+00:00" > 08/19/24, 12:27 </span>
I can also confirm the issue. Three separate accounts with MFA enabled, logged in and the error appeared in the Error-Log without the user seeing any of it.
-
Garvin Hicking commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2024-08-21T13:18:32+00:00" > 08/21/24, 13:18 </span>This points towards a TYPO3 sub-request getting triggered here. There are some AJAX backend calls (like for assets, JS, REST endpoints). If these trigger the MFA error log entry, you may not directly notice something broke (i.e. just an icon not getting displayed, in a layer you don’t even open).
To find out what is causing this, maybe you could help in debugging, because I was not yet able to trigger this behaviour.
The file https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Middleware/BackendUserAuthenticator.php#L152 contains this code:
if ($this->context->getAspect('backend.user')->isLoggedIn()) { $GLOBALS['BE_USER']->initializeBackendLogin($request); // Reset the limiter after successful login if ($rateLimiter) { $rateLimiter->reset(); } // In case the current request is not targeted to authenticate against MFA, the "mfa" // key is not yet set in session (indicating that MFA has already been passed) and it's // no "switch-user" mode, check whether the user is required to set up MFA and redirect // to the corresponding setup endpoint if not already on it. if (!$mfaRequested && !(bool)($GLOBALS['BE_USER']->getSessionData('mfa') ?? false) && !$GLOBALS['BE_USER']->getOriginalUserIdWhenInSwitchUserMode() && $GLOBALS['BE_USER']->isMfaSetupRequired() && $route->getOption('_identifier') !== 'setup_mfa' ) { return $this->redirectToMfaEndpoint('setup_mfa', $GLOBALS['BE_USER'], $request); } }so this would be the only place where “setup_mfa” could be triggered. The endpoint URL like https://typo3.ddev.site/typo3/setup/mfa can actually not be called without a valid backend token, so accidental browser URL requests cannot be the issue here.
Now if you could alter that code to the following:
if ($this->context->getAspect('backend.user')->isLoggedIn()) { $GLOBALS['BE_USER']->initializeBackendLogin(); // Reset the limiter after successful login if ($rateLimiter) { $rateLimiter->reset(); } // In case the current request is not targeted to authenticate against MFA, the "mfa" // key is not yet set in session (indicating that MFA has already been passed) and it's // no "switch-user" mode, check whether the user is required to set up MFA and redirect // to the corresponding setup endpoint if not already on it. if (!$mfaRequested && !(bool)($GLOBALS['BE_USER']->getSessionData('mfa') ?? false) && !$GLOBALS['BE_USER']->getOriginalUserIdWhenInSwitchUserMode() && $GLOBALS['BE_USER']->isMfaSetupRequired() && $route->getOption('_identifier') !== 'setup_mfa' ) { // DEBUG START $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 1 !$mfaRequested = ' . (!$mfaRequested ? 'TRUE' : 'FALSE'), [serialize($mfaRequested)], ); $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 2 !(bool)($GLOBALS[\'BE_USER\']->getSessionData(\'mfa\') ?? false) = ' . (!(bool)($GLOBALS['BE_USER']->getSessionData('mfa') ?? false) ? 'TRUE' : 'FALSE'), [serialize($GLOBALS['BE_USER']->getSessionData('mfa'))], ); $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 3 !$GLOBALS[\'BE_USER\']->getOriginalUserIdWhenInSwitchUserMode() = ' . (!$GLOBALS['BE_USER']->getOriginalUserIdWhenInSwitchUserMode() ? 'TRUE' : 'FALSE'), [serialize($GLOBALS['BE_USER']->getOriginalUserIdWhenInSwitchUserMode())], ); $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 4 $GLOBALS[\'BE_USER\']->isMfaSetupRequired() = ' . ($GLOBALS['BE_USER']->isMfaSetupRequired() ? 'TRUE' : 'FALSE'), [serialize($GLOBALS['BE_USER']->isMfaSetupRequired())], ); $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 5 $route->getOption(\'_identifier\') !== \'setup_mfa\' = ' . ($route->getOption('_identifier') !== 'setup_mfa' ? 'TRUE' : 'FALSE'), [$route->getOption('_identifier'), ($GLOBALS['BE_USER']->user['uid'] ?? 'UNKNOWN')], ); // DEBUG END return $this->redirectToMfaEndpoint('setup_mfa', $GLOBALS['BE_USER'], $request); } }then we should probably get additional error reporting in your `sys_log` database table just before the error would occur.
If you could provide results of that, this would help a lot.
Small note: This code was made to be tested in v11, if you test in v13/main, ensure that
initializeBackendLogin($request)is used, this parameter was added in v13. -
Garvin Hicking commented <span data-processor="relativetime" data-value="2024-08-21T13:20:09+00:00" > 08/21/24, 13:20 </span>
Another thing just came to my mind. Maybe there’s a chance a CLI request (with “faked” BE Users) or the Admin Toolbar in the Frontend might trigger this, missing the ‘mfa’ session data.
-
Garvin Hicking commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2024-12-22T22:37:46+00:00" > 12/22/24, 22:37 </span>I’m closing this due to lack of feedback. If you feel this is a mistake please follow up with more details. Thank you!
-
Filipe DA COSTA commented <span data-processor="relativetime" data-value="2025-03-20T15:10:49+00:00" > 03/20/25, 15:10 </span>
I’m having a similar issue on Typo3 v12. I randomly get:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1632154036: MFA setup is not necessary. Do not call this endpoint on your own. | InvalidArgumentException thrown in file /var/www/typo3/releases/20250305102805/vendor/typo3/cms-backend/Classes/Controller/MfaSetupController.php in line 82. Requested URL: https://domain.tdl/typo3/setup/mfa?token=--AnonymizedToken--I’ve added your debug code with small modifications to MfaSetupController.php
$GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 1 ($backendUser->getSessionData(\'mfa\') ?? false) = ' . (($backendUser->getSessionData('mfa') ?? false) ? 'TRUE' : 'FALSE'), [serialize($backendUser->getSessionData('mfa'))], ); $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 2 $backendUser->getOriginalUserIdWhenInSwitchUserMode() !== null = ' . (($backendUser->getOriginalUserIdWhenInSwitchUserMode() !== null) ? 'TRUE' : 'FALSE'), [serialize($backendUser->getOriginalUserIdWhenInSwitchUserMode())], ); $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 3 !$backendUser->isMfaSetupRequired() = ' . (!$backendUser->isMfaSetupRequired() ? 'TRUE' : 'FALSE'), [serialize($backendUser->isMfaSetupRequired())], ); $GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Condition 4 !$backendUser->isMfaSetupRequired() = ' . ($this->mfaProviderRegistry->hasActiveProviders($backendUser) ? 'TRUE' : 'FALSE'), [serialize($this->mfaProviderRegistry->hasActiveProviders($backendUser))], );I’ll update the ticket as soon as I get enough debug logs.
I’ve also noticed that for all the users that triggered the error, they did not enabled the Password Recovery provider. Other users have that provider enabled and they did not produce the error (yet?).
-
Garvin Hicking commented and changed status
ClosedNeeds Feedback <span data-processor="relativetime" data-value="2025-03-20T21:03:43+00:00" > 03/20/25, 21:03 </span>Thank you, Filipe. I’m re-opening this issue and looking forward for insights. Much appreciated!
-
Filipe DA COSTA commented and changed TYPO3 Version
1112 <span data-processor="relativetime" data-value="2025-03-21T15:13:09+00:00" > 03/21/25, 15:13 </span>Got the first entry into the logs:
15:40:15 Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1632154036: MFA setup is not necessary. Do not call this endpoint on your own. InvalidArgumentException thrown in file /var/www/typo3/releases/20250305102805/vendor/typo3/cms-backend/Classes/Controller/MfaSetupController.php in line 123. Requested URL: https://domain.tdl/typo3/setup/mfa?token=—AnonymizedToken— 15:40:15 MFA-SETUP: Condition 4 $this->mfaProviderRegistry->hasActiveProviders($backendUser) = TRUE 15:40:15 MFA-SETUP: Condition 3 !$backendUser->isMfaSetupRequired() = FALSE 15:40:15 MFA-SETUP: Condition 2 $backendUser->getOriginalUserIdWhenInSwitchUserMode() !== null = FALSE 15:40:15 MFA-SETUP: Condition 1 ($backendUser->getSessionData(‘mfa’) ?? false) = FALSE 15:35:14 Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1632154036: MFA setup is not necessary. Do not call this endpoint on your own. InvalidArgumentException thrown in file /var/www/typo3/releases/20250305102805/vendor/typo3/cms-backend/Classes/Controller/MfaSetupController.php in line 123. Requested URL: https://domain.tdl/typo3/setup/mfa?token=—AnonymizedToken— 15:35:14 MFA-SETUP: Condition 4 $this->mfaProviderRegistry->hasActiveProviders($backendUser) = TRUE 15:35:14 MFA-SETUP: Condition 3 !$backendUser->isMfaSetupRequired() = FALSE 15:35:14 MFA-SETUP: Condition 2 $backendUser->getOriginalUserIdWhenInSwitchUserMode() !== null = FALSE 15:35:14 MFA-SETUP: Condition 1 ($backendUser->getSessionData(‘mfa’) ?? false) = FALSE 15:30:22 User <user> logged in from x.x.x.x </user> As you can see, it did not happen directly on login but 5 minutes after and then 5 minutes latter it happens again.
I’ll now also add debug code to BackendUserAuthenticator.php to understand why it calls setup_mfa in the place.
-
Filipe DA COSTA commented <span data-processor="relativetime" data-value="2025-03-24T15:58:06+00:00" > 03/24/25, 15:58 </span>
@ghi I now have multiple (6x) entries, but for now, only for the same user.
MFA-SETUP: Condition 5 $route->getOption('_identifier') !== 'setup_mfa' = TRUE MFA-SETUP: Condition 4 $GLOBALS['BE_USER']->isMfaSetupRequired() = TRUE MFA-SETUP: Condition 3 !$GLOBALS['BE_USER']->getOriginalUserIdWhenInSwitchUserMode() = TRUE MFA-SETUP: Condition 2 !(bool)($GLOBALS['BE_USER']->getSessionData('mfa') ?? false) = TRUE MFA-SETUP: Condition 1 !$mfaRequested = TRUEAgain, the first error is 5 minutes after a successful login. (login
13:52:16 -> Error13:57:05 )After that I also have errors @ 14:12:20, 14:15:08, 14:15:09, 14:15:11 and 14:15:15.
I see no user activity in the logs from that user until 14:15:31 where she logs in again and start working on records without issue.
I’ve also logged the request URI that trigger the error and found the same URL each time: /typo3/logout/
After my finding, I called the customer and was told that she saw a 503 error screen and then when and logout/login again.
Could it be some auto-logout feature that throws the error?
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-03-24T17:40:15+00:00" > 03/24/25, 17:40 </span>
Hm, are you able to see what that 503 error was that the user got to need to relogin?
Do you use any third party or custom extensions that might affect auto-logout/relogin forcing or so?
Maybe when condition 5 hits you could also do a
$GLOBALS['BE_USER']->writelog( \TYPO3\CMS\Core\SysLog\Type::LOGIN, \TYPO3\CMS\Core\SysLog\Action\Login::ATTEMPT, \TYPO3\CMS\Core\SysLog\Error::SECURITY_NOTICE, 2, 'MFA-SETUP: Backtrace'), [json_encode(debug_backtrace)], );
so maybe with that full backtrace we could get further info (however I guess that the logout is triggered in a separate request, so when the backtrace is triggered, the other request alread “caused” the missing MFA setup).
It would be great if we somehow are able to reproduce this consistently, like by logging in, waiting 6 minutes, and then it always gets triggered or so? Then once you yourself could trigger this, I might be able, too :D
-
Webadmin no-lastname-given commented <span data-processor="relativetime" data-value="2025-03-25T07:41:39+00:00" > 03/25/25, 07:41 </span>
We are still running Typo3 11, but perhaps these observations can help to find the problem:
- The problem occurs completely randomly for all users. It occurs immediately upon login for one user and then disappears upon logout.
- It is impossible to predict which users will be affected. A user who experienced the behavior yesterday may not be affected again today. And vice versa.
- During the session, a line is written to the log exactly once per minute. (We have a small BE extension that sends an AJAX request every 60 seconds.)
- Of 50+ active users per day, approximately 1 to 3 are affected. So it happens quite rarely.
- In our case, it affects both BE user and BE admin accounts.
- The users themselves are unaware of it. They can work without any problems.
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-03-27T09:19:32+00:00" > 03/27/25, 09:19 </span>
Thanks for the additional feedback. Could you mention what your periodic AJAX request fully does? Depending on whether it accesses session data, and uses the TYPO3 framework (or not) that actually might have an impact here.
I guess it is not possible to temporarily disable the AJAX request to see if it is related at all?
-
Webadmin no-lastname-given commented <span data-processor="relativetime" data-value="2025-03-27T09:26:43+00:00" > 03/27/25, 09:26 </span>
It’s a really simple Ajax Route to an Extbase action which is displaying the current editor in chief.
return [ // CategoryController::createAction 'FfhOvdBackendToolbar::ajaxActualOvd' => [ 'path' => '/ovd/actual', 'target' => \RTFFH\FfhOvd\Backend\BackendToolbar::class . '::ajaxActualOvd' ] ];/** * @param \Psr\Http\Message\ServerRequestInterface $request * @return \TYPO3\CMS\Core\Http\Response */ public function ajaxActualOvd(\Psr\Http\Message\ServerRequestInterface $request) { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users'); $res = $queryBuilder->select('realName', 'tx_ffhovd_tel') ->from('be_users') ->where( $queryBuilder->expr()->eq('tx_ffhovd_is_ovd', 1) ) ->execute() ->fetchAll(); if(count($res) > 1) { // Do some stuff } $responseBody = new \TYPO3\CMS\Core\Http\Stream('php://temp', 'rw'); $responseBody->write(json_encode($ovd)); return new \TYPO3\CMS\Core\Http\Response($responseBody, 200, ['Content-Type' => 'application/json; charset=utf-8']); }We don’t even read something from the session…
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-03-29T16:26:43+00:00" > 03/29/25, 16:26 </span>
Do you perform any write actions or access any kind of beUser request attributes?
I wonder if due to the request maybe not doing regular aith, it could timeout something earlier than when the core would do actual BE requests.
Could you temporarily disable the AJAX request to see if it is related at all?
-
Webadmin no-lastname-given commented <span data-processor="relativetime" data-value="2025-04-02T08:55:45+00:00" > 04/02/25, 08:55 </span>
No, we do not perform any write actions to the BE User sessions. We are only fetching records from the be_user table, filtered by a custom column.
We disabled the AJAX requests, but the problem is still there. From araound 15 logged in users, one user got logged the message “MFA setup is not necessary….” into the error log. The disabled AJAX requests only foreced that the message was NOT repeated every minute in the log.
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-04-03T20:59:13+00:00" > 04/03/25, 20:59 </span>
Thanks for the info, that is a tough nut though. Really sounds like it is related to some kind of timeout on something session related. I’m honestly at a loss here.
-
Webadmin no-lastname-given commented <span data-processor="relativetime" data-value="2025-09-22T16:20:14+00:00" > 09/22/25, 16:20 </span>
After updating from version 11 to 13, we can confirm that this problem is gone within our setup.
As we skipped version 12 and also updated the extension ig_ldap_sso_auth, we don’t know where the root of the problem was located. All our ajax based backend addons are still the same.
-
Garvin Hicking changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2026-04-14T19:41:28+00:00" > 04/14/26, 19:41 </span>
I can confirm issues with this message being logged without users doing anything unexpected