Issue Task Closed

#109758Remove unsafe md5() wrapping around StringUtility::getUniqueId()

TYPO3 GmbH TYPO3com 05/04/26, 16:25 updated 10/06/26, 15:58

Description

This PR addresses an insecure design pattern by removing the `md5()` function wrap around `StringUtility::getUniqueId()` across the codebase.

The `StringUtility::getUniqueId()` method already securely generates a unique 26-character hexadecimal string utilizing PHP’s cryptographically secure `random_bytes(13)` function. Wrapping this output in `md5()` provides zero additional entropy and unnecessarily invokes a deprecated, unsafe hashing algorithm.

This patch eliminates the unsafe library call, conforming to the proactive secure-by-design guidelines of the project.

**How the patch works:**
The patch scans the core, frontend, extbase, form, adminpanel, and workspaces extensions for the specific pattern `md5(StringUtility::getUniqueId())`. In all instances, the `md5()` wrapper has been stripped.
- Cases like `$keyword = md5(StringUtility::getUniqueId());` were simplified to `$keyword = StringUtility::getUniqueId();`.
- Cases using substrings like `substr(md5(StringUtility::getUniqueId()), 0, 13)` were simplified to `substr(StringUtility::getUniqueId(), 0, 13)`.
- Cases applying prefixes like `md5(StringUtility::getUniqueId())` were updated to use the prefix built into the utility itself, e.g., `StringUtility::getUniqueId(‘INT_SCRIPT.’)`.

**Security Impact:**
The security impact is a proactive cleanup of error-prone design patterns. `md5()` is flagged as an unsafe algorithm. By removing its usage entirely here, we ensure that random tokens, IDs, and substitution strings are generated strictly using high-entropy, cryptographically safe random bytes without falling back on insecure legacy hashing functions.

This issue was automatically created from https://github.com/TYPO3/typo3/pull/636

Reviews 1

History 12

  1. Georg Ringer commented and changed status Under Review Closed <span data-processor="relativetime" data-value="2026-10-06T15:58:19+00:00" > 10/06/26, 15:58 </span>

    Closing, as the premise does not hold: StringUtility::getUniqueId() is not based on random_bytes(), and the md5() calls only normalize the format of non-security-relevant identifiers, so removing them brings no benefit but changes the length and format of several values.