-
-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport Magento security Update 2.3.5-p2 from 20200728 APSB20-47 #1138
Conversation
* Update _validateSecretKey in Mage_Adminhtml_Controller_Action to avoid time attacks related to CVE-2020-9690 * It is important to provide the user-supplied string as the second parameter, rather than the first. Signed-off-by: Frank Rochlitzer <[email protected]>
Thank you a lot for checking this and contributing. When you contact us over the recommended way (noted in https://github.com/OpenMage/magento-lts/blob/1.9.4.x/SECURITY.md ) we can handle this in private and better coordinate the release of security relevant information and releases. Regarding the Patch, we use hash_equals() already on other places direct, so we do not need the fallback. |
@Flyingmana Should the PR to be closed now? |
No Problem, its also for us the first time to go through this process as a whole :) |
I implemented this locally: protected function _validateSecretKey(): bool
{
if (in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
return true;
}
$secretKey = (string) $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null);
$adminSecretKey = (string) $this->getAdminUrlModel()->getSecretKey();
return $secretKey && hash_equals($adminSecretKey, $secretKey);
}
protected function getAdminUrlModel(): Mage_Adminhtml_Model_Url
{
return Mage::getSingleton('adminhtml/url');
} |
I definitely like @joshua-bn solution better, far less code. hash-equals is supported since PHP 5.6 so no reason to have a helper and a library to replace one simple function. |
lol, as you said that I realized I made a mistake when I was cleaning it up. edited it again because I use return type hints locally with PHP 7.4. |
This was resolved as part of the latest release (see security advisory and mentioned CVE in changelog) |
Fun fact, we already have a polyfill in our code for the hash_equals function, for the old php versions |
Thanks @Flyingmana https://github.com/OpenMage/magento-lts/blob/20.0/app/code/core/Mage/Adminhtml/Controller/Action.php#L397 (for anyone else interested) |
Description (*)
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)