Issue Feature Closed

#91554Refactor SHA1 dependent components

Tizian Schmidlin 06/02/20, 09:47 updated 10/03/26, 04:52

Description

Hello there,

as lined out in this article, SHA1 will soon be dropped from SSH since the standard is considered prone to collisions.

I think, since we are in an early phase of TYPO3 11 developments, it would be good to deprecate all methods and classes related to sha1 (or even md5 for that matter) that are still available in core.

Challenges:
  1. TYPO3 uses the sha1 built-in PHP function 32 times, mentions “sha1” 35 as separate string (either array hash, value or function argument) thoughout the core (that’s 10 more instances of sha1 being called and two instances less as a string mention than back in TYPO3 9.5)
  2. TYPO3 also still uses md5 functions around 169 times (!) in the core
  3. Cryptographically safer functions might create quite a strain on the servers running the new code (on my benchmarks, using hash('sha256' instead of sha1 was approximately 0.6% slower).
Chances:
  1. Ensure more cryptographically safe software
  2. Get rid of really old code
  3. (Bragging rights for being the first CMS to throw out all old and cryptographically unsafe functions from its core?)

Best Regards
Tizian

Reviews 0

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

History 6

  1. Oliver Hader commented <span data-processor="relativetime" data-value="2020-06-02T12:45:24+00:00" > 06/02/20, 12:45 </span>

    Thanks for bringing up this topic – in general I’d agree switching to more collision resistant cryptographic hashing algorithm.

    • of course for everything that is exposed/transported in public (e.g. signatures for HTTP actions, cache hash, …)
    • probably okay for internal identifiers (caching, file-names, etc. – storage requirements for e.g. database fields would have to be extended)
    • careful consider for functionality affecting multiple versions, e.g. export file from TYPO3 v8 (using md5) to be imported in TYPO3 v11 (new hash algo) – probably we have to use/introduce/raise some “API version” for those purposes
  2. Oliver Hader commented <span data-processor="relativetime" data-value="2020-06-02T12:51:39+00:00" > 06/02/20, 12:51 </span>

    Concerning digest signatures (currently HMAC based on SHA1) we might consider

    • either changing from encryptionKey to PKI signatures, e.g. based on ed25519
    • or switching to SHA3-512
  3. Georg Ringer commented and changed status New Closed <span data-processor="relativetime" data-value="2026-10-03T04:52:37+00:00" > 10/03/26, 04:52 </span>

    Here is the current state on main, as this issue has been open since 2020 and a lot has changed in the meantime.

    Already done

    With #106307 (commit “[!!!][TASK] Use stronger cryptographic algorithm for HMAC”), the enum HashAlgo was introduced and HashService got an $algo argument. All publicly exposed signatures that would be breaking to change have been switched to HMAC-SHA3-256 (or SHA3-384), among them:

    • cHash (was HMAC-MD5)
    • backend and frontend password recovery
    • FileDumpController and ShowImageController tokens
    • backend form protection, session backends, MFA setup checksums, sudo mode
    • Extbase trusted properties and referrer arguments, EXT:form session and state

    What is left

    • HashService::hmac(), appendHmac(), validateHmac() and validateAndStripHmac() still default to HashAlgo::SHA1. Around 45 calls in the Core rely on that default, mainly in FormEngine (inline/files/slug context, link and edit popups, image manipulation), CSP reporting, DenyListDeserializer, upload/delete resource pointers in Extbase and EXT:form, the EXT:form definition HMACs and the install tool cache busters. HMAC-SHA1 is not broken (collisions do not matter for HMAC), so this is hardening rather than an actual vulnerability. Changing it invalidates stored or transported HMACs and is therefore a breaking change.
    • The remaining sha1() and md5() calls (roughly 30 and 140 in Classes/) are used for cache identifiers, file names, log pseudonyms or configurationsha1. They have no security relevance; switching them would only change database columns and caches without real benefit.
    • SHA1 has to stay in two places: Totp, because RFC 6238 and the authenticator apps expect it, and PhpassPasswordHash, which only exists to verify legacy password hashes.

    A generic “replace all sha1/md5” issue cannot be reviewed or merged in a sensible way. therefore closing the issue