Review main Merged Breaking

91815[!!!][TASK] Use stronger cryptographic algorithm for HMAC

Oliver Hader CR +2 V +2 Hard +687 −282 updated 11/23/25, 11:01

Commit message

This change focusses on using a stronger cryptographic algorithm
when used for HMAC and explicitly uses SHA3-256 now where previously
MD5 or SHA1 has been used. This change only focusses on components
for the time being that would be considered a breaking change.

There are still some occurrences, that might be changed later.

These are the components that are considered breaking:
+ cHash, used HMAC(MD5) before
+ backend password recovery, used HMAC(SHA1) before
+ frontend password recovery, used HMAC(SHA1) before
+ file dump controller, used HMAC(SHA1) before
+ show image controller, used HMAC(SHA1) before
+ backend form protection, used HMAC(SHA1) before
+ ext:extbase form request attributes, used HMAC(SHA1) before
+ ext:form form request attributes, used HMAC(SHA1) before
+ database & redis session backends, used HMAC(SHA256) before

SHA3-256 hashes take 64 characters in hex representation. Albeit
the existing database field lengths were sufficient, they have been
extended to even support SHA3-512 (128 characters) in the future:
+ be_users.password_reset_token, 128 chars nows
+ fe_users.felogin_forgotHash, 160 chars now (timestamps + hash)

$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['fallbackToLegacyHash']
(which is enabled per default) still allows using the legacy MD5-based
cache-hash values to avoid SEO degradation on indexed URLs.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Lina Wolf +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Lina Wolf +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 65

Show 45 more files

Review log 2634

Show 59 earlier messages
  1. Oliver Hader uploaded patch set 1 11/22/25, 13:21

  2. core-ci voted on patch set 1 V -1 11/22/25, 13:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90637

  3. Oliver Hader uploaded patch set 2 V -1 11/22/25, 14:11

  4. core-ci voted on patch set 2 V -1 11/22/25, 14:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90643

  5. Oliver Hader uploaded patch set 3 V -1 11/22/25, 15:09

  6. core-ci voted on patch set 3 V -1 11/22/25, 15:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90650

  7. Oliver Hader uploaded patch set 4 V -1 11/22/25, 16:16

  8. core-ci voted on patch set 4 V -1 11/22/25, 16:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90659

  9. Torben Hansen commented on patch set 4 11/22/25, 17:54

    Breaking-106307-UseStrongerCryptographicAlgorithmForHMAC.rst:90

    Additionally `fe_user.felogin_forgotHash` field will be extended to 160 characters.
  1. Oliver Hader uploaded patch set 5 V -1 11/22/25, 19:40

  2. Oliver Hader commented on patch set 5 11/22/25, 19:41

    Breaking-106307-UseStrongerCryptographicAlgorithmForHMAC.rst:90 Reply

    Thanks. I still need to overwork the RST file again... I got distracted by the failing tests...
  3. core-ci voted on patch set 5 V +1 11/22/25, 19:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90687

  4. Oliver Hader uploaded patch set 6 V +1 11/22/25, 21:09

  5. Oliver Hader commented on patch set 6 11/22/25, 21:10

    Breaking-106307-UseStrongerCryptographicAlgorithmForHMAC.rst:90 Reply

    Done
  6. Oliver Hader commented on patch set 6 11/22/25, 21:20

    This change is ready for review.
  7. core-ci voted on patch set 6 V +1 11/22/25, 21:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90694

  8. Christian Kuhn commented on patch set 6 11/22/25, 21:41

    HashService.php:35

    what's the future strategy here? we'll later change the default and/or skip the argument entirely? this will happen in v15?

    RedisSessionBackendTest.php:66

    nit: the easy and simple solution in functional (not unit) tests is $subject = $this->get(SubjectClass::class) - to let DI handle by framework. similar i other files.

    CacheHashCalculator.php:28

    yay. readonly. and singletonInterface can be skipped (but keep the public: true, then).

    SiteRequestTest.php:38

    nit: we try to keep this in the properties directly - it's more obvious.
  9. Oliver Hader uploaded patch set 7 V +1 11/22/25, 22:10

  10. Oliver Hader commented on patch set 6 11/22/25, 22:10

    HashService.php:35 Reply

    My plan would be to use the `HashAlgo` enum to identify where hashes are used in the TYPO3 core. In a next step, the usages are separated by use-case (e.g. "canonical" for generating a unique identifier, without having crypto demands, "http-signature" like in cHash, "payload-signature" for arbitrary data like forms). Each of these use-cases might(!) become the possibility to configure the corresponding default `HashAlgo`. Thus, for the occurrences in `HashService` the `$algo` parameter will probably change in the future.

    RedisSessionBackendTest.php:66 Reply

    Done

    CacheHashCalculator.php:28 Reply

    Dropping `SingletonInterface` is fine. Introducing `readonly` conflicts with having `setConfiguration()` (which would be another breaking change in case we drop it) → okay in general, but in another patch-set

    CacheHashConfiguration.php:103

    Not required anymore...

    SiteRequestTest.php:38 Reply

    Since the class extends `\TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase` all existing settings would have to be duplicated. Personally I'd prefer to keep it the way it is.
  11. core-ci voted on patch set 7 V -1 11/22/25, 22:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90699

  12. Oliver Hader uploaded patch set 8 V -1 11/22/25, 22:33

  13. Oliver Hader commented on patch set 8 11/22/25, 22:33

    RedisSessionBackendTest.php:66 Reply

    Install Tools currently fails due to the lack of DI. I guess, I'll revert that particular change and won't inject `HashService` into the session backends.
  14. Oliver Hader commented on patch set 8 11/22/25, 22:37

    SessionManagerTest.php:30

    Both methods were moved to the corresponding functional test.
  15. core-ci voted on patch set 8 V +1 11/22/25, 22:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90704

  16. Oliver Hader commented on patch set 8 11/22/25, 23:06

    HashService.php:35 Reply

    In case you dislike the additional parameter `$algo` it also would be possible to add a new `HashServiceFactory`. The call might look like this then: ``` $hmac = $hashServiceFactory ->create(HashAlgo::SHA3_256) ->hmac('input', 'my-additional-secret'); ```
  17. Christian Kuhn commented on patch set 8 11/22/25, 23:11

    HashService.php:35 Reply

    i see. thx!

    DatabaseSessionBackend.php:36

    risky with this class being stateful. might be better to shared:false it. or makeInstance() for now to additionally resolve the install tool DI issue: alternative is to hard code DI in serviceProvider.php, which would imho be fine for such central classes, but maybe makeInstance is for now just a bit more easy.

    RedisSessionBackendTest.php:66 Reply

    fine to use makeInstance for now - the session backends are also stateful, we would probably want to resolve this as well for DI.

    CacheHashCalculator.php:28 Reply

    ah setConfiguration. yes. that should be removed as breaking change quickly: its used in tests only and it shouldn't be an issue to drop it. i can prepare a change if you want me to.

    SiteRequestTest.php:38 Reply

    is see. ok.
  18. Oliver Hader commented on patch set 8 11/22/25, 23:15

    DatabaseSessionBackend.php:36 Reply

    I already rolled back the previous change, no DI or auto-config is used in both classes implementing `SessionBackendInterface`

    CacheHashCalculator.php:28 Reply

    In case you have time, sure, please go ahead and "get rid" or `setConfiguration()` :)
  19. Christian Kuhn commented on patch set 8 11/22/25, 23:22

    CacheHashCalculator.php:28 Reply

    scratch that. this is more borked since CachHashConfiguration is a data object and should vanish from __construct entirely. didn't realize this is yet another stateful singleton with data :/
  20. Christian Kuhn voted on patch set 8 CR +1 V +1 11/22/25, 23:29

  21. Lina Wolf commented on patch set 8 CR +1 V +1 11/23/25, 06:16

    I tried out this change locally and found no ill effect, I tried to look at the code, didnt find anything obvious but dont understand it in detail so take my vote with a grain of salt.
  22. Georg Ringer voted on patch set 8 CR +2 V +2 11/23/25, 06:27

  23. Georg Ringer merged patch set 9 11/23/25, 06:27

  24. Oliver Hader commented on patch set 9 11/23/25, 09:30

    Sorry, admonitions are incorrect here as well...
  25. Lina Wolf commented on patch set 9 11/23/25, 11:01

    Reply

    Don't worry, I currently review changelogs in https://review.typo3.org/c/Packages/TYPO3.CMS/+/91436