Issue Bug Closed

#99902"Login Form" -> "Display Password Recovery Link" does not respect "User Storage Page"

Timo Poppinga 02/09/23, 13:56 updated 09/29/23, 17:42

Description

I’m sorry, but the problem continues to occur, it could also be a security problem:

In the Action:

    public function recoveryAction(string $userIdentifier = null)
    {
        if (empty($userIdentifier)) {
            return $this->htmlResponse();
        }

        $email = $this->userRepository->findEmailByUsernameOrEmailOnPages(
            $userIdentifier,
            $this->getStorageFolders()
        );

        if ($email) {
            $this->recoveryService->sendRecoveryEmail($email);
        }

        if ($this->exposeNoneExistentUser($email)) {
            $this->addFlashMessage(
                $this->getTranslation('forgot_reset_message_error'),
                '',
                AbstractMessage::ERROR
            );
        } else {
            $this->addFlashMessage($this->getTranslation('forgot_reset_message_emailSent'));
        }

        $this->redirect('login', 'Login', 'felogin');
    }

the “User Storage Page” is respect well.

But then the e-mail is forwarded to TYPO3\CMS\FrontendLogin\Service\RecoveryService->sendRecoveryEmail

    public function sendRecoveryEmail(string $emailAddress): void
    {
        $hash = $this->recoveryConfiguration->getForgotHash();
        // @todo: This repository method call should be moved to PasswordRecoveryController, since its
        // @todo: unexpected that it happens here. Would also drop the dependency to FrontendUserRepository
        // @todo: in this sendRecoveryEmail() method and the class.
        $this->userRepository->updateForgotHashForUserByEmail($emailAddress, GeneralUtility::hmac($hash));
        $userInformation = $this->userRepository->fetchUserInformationByEmail($emailAddress);
        $receiver = new Address($emailAddress, $this->getReceiverName($userInformation));
        $email = $this->prepareMail($receiver, $hash);

        $event = new SendRecoveryEmailEvent($email, $userInformation);
        $this->eventDispatcher->dispatch($event);
        $this->mailer->send($event->getEmail());
    }

and this function just fetches the first record in the fe_users table with this mail

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 10

  1. Oliver Hader changed is private 02/09/23, 14:01

  2. Oliver Hader commented 02/09/23, 14:04

    I did not look into the details. However, in case it might be a security problem, please do not publish this on public issue trackers like this one.

    Either send the details to security@typo3.org or create a new report (“advisory draft”) at https://github.com/TYPO3/typo3/security/advisories/new
    It’s fine right now, I made this issue private.

  3. Oliver Hader commented 02/09/23, 14:09

    If I understood the report correctly, the recovery link is not limited to that particular user in given storage page IDs.

  4. Timo Poppinga commented 02/10/23, 08:14

    At Oliver, yes the TYPO3 resets the first user in the table fe_users with the given E-Mail Address.

  5. Oliver Hader changed project id category 07/05/23, 10:45

  6. Oliver Hader changed is private 07/05/23, 10:46

  7. Oliver Hader changed project id 07/05/23, 10:56

  8. Oliver Hader commented and changed category 07/05/23, 11:01

    We just discussed this topic concerning security aspects. When focussing on CIA (confidentiality, integrity, availability), we were not able to identify any security impact. Thus, this issue can be handled in public – basically it’s a regular bug, the storage-PID should be handed over to the recovery process as well + the recovery hash should contain the UID of the corresponding user-record.

  9. Torben Hansen commented and changed status New Closed 09/29/23, 17:42

    This problem has already been fixed in v12 with #95132. The change ensures, that the hash is only set to the user found for the given username/email in the configured storage page and that the link is then only sent to exactly this user. The function signature of sendRecoveryEmail() changed accordingly to require the array with user data (including the email address) and the updateForgotHashForUserByEmail() function has been renamed to updateForgotHashForUserByUid().

    Since this is a breaking change, it has not been backported to v11.

    I’ll close this ticket for now.

  10. Oliver Hader changed Related to #95132 10/06/23, 16:02