Skip to content

Commit

Permalink
[SECURITY] Avoid ambiguous HMAC results
Browse files Browse the repository at this point in the history
Cryptographic hashes being calculated from and for query
parameters must only be used for a specific use-case or
scope in order to avoid resulting hashes being ambiguous.

Resolves: #91689
Releases: master, 10.4, 9.5
Change-Id: I59ca16fe71e27195b98a822607aab564425d248d
Security-Bulletin: TYPO3-CORE-SA-2020-008
Security-References: CVE-2020-15098
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65123
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
  • Loading branch information
ohader committed Jul 28, 2020
1 parent 6cd384b commit d2842eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -120,7 +120,7 @@ protected function areFieldChangeFunctionsValid($handleFlexformSections = false)
}
unset($value);
}
$result = hash_equals(GeneralUtility::hmac(serialize($fieldChangeFunctions)), $this->parameters['fieldChangeFuncHash']);
$result = hash_equals(GeneralUtility::hmac(serialize($fieldChangeFunctions), 'backend-link-browser'), $this->parameters['fieldChangeFuncHash']);
}
return $result;
}
Expand All @@ -135,7 +135,7 @@ protected function getBodyTagAttributes()
$parameters = parent::getBodyTagAttributes();

$formEngineParameters['fieldChangeFunc'] = $this->parameters['fieldChangeFunc'];
$formEngineParameters['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($this->parameters['fieldChangeFunc']));
$formEngineParameters['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($this->parameters['fieldChangeFunc']), 'backend-link-browser');

$parameters['data-add-on-params'] .= HttpUtility::buildQueryString(['P' => $formEngineParameters], '&');

Expand Down
Expand Up @@ -74,7 +74,7 @@ public function render()
'flexFormDataStructurePath' => $flexFormDataStructurePath,
'hmac' => GeneralUtility::hmac('editform' . $itemName, 'wizard_js'),
'fieldChangeFunc' => $parameterArray['fieldChangeFunc'],
'fieldChangeFuncHash' => GeneralUtility::hmac(serialize($parameterArray['fieldChangeFunc'])),
'fieldChangeFuncHash' => GeneralUtility::hmac(serialize($parameterArray['fieldChangeFunc']), 'backend-link-browser'),
],
];
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
Expand Down
Expand Up @@ -60,7 +60,7 @@ public function render(): array
'itemName' => $itemName,
'hmac' => GeneralUtility::hmac('editform' . $itemName, 'wizard_js'),
'fieldChangeFunc' => $parameterArray['fieldChangeFunc'],
'fieldChangeFuncHash' => GeneralUtility::hmac(serialize($parameterArray['fieldChangeFunc'])),
'fieldChangeFuncHash' => GeneralUtility::hmac(serialize($parameterArray['fieldChangeFunc']), 'backend-link-browser'),
],
];
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
Expand Down

0 comments on commit d2842eb

Please sign in to comment.