To avoid false positives weak algorithms should not be used (see https://www.drupal.org/node/845876)
Affected code:
docroot/modules/contrib/tfa/src/Plugin/TfaBasePlugin.php 209
docroot/modules/contrib/tfa/src/Plugin/TfaBasePlugin.php 226
Solution:
use Drupal’s hashBase64 methods:
\Drupal\Component\Utility\Crypt::hashBase64($data)
\Drupal\Component\Utility\Crypt::hmacBase64($data, $key)
in those files affected (see description)
Create a patch for the files mentioned in the description, share in d.o and use the patch from d.o url.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | weak_algorithms-3069417-3.patch | 1.29 KB | sergiu stici |
Comments
Comment #2
gregglesThanks, @alexmoreno - could you perhaps provide a patch? Are there any considerations to keep in mind for a site that has TFA installed already and will be upgrading to this new hash?
Comment #3
sergiu stici commentedThe old hash will not change, but i don't know if it will affect something.
Comment #4
omkar06 commentedBefore Applying patch, TFA enabled and configured for the admin user.
Login was working perfectly after submitting Google Authenticator's code.
Patch applying patch, tested same user login. After submitting Google Authenticator's code, the user was able to log in without any issue.
As the patch is working fine, marking issue to RTBC.
Comment #5
alexmoreno commentedconfirming as well, thanks for the patch @Sergiu Stici
Comment #6
jcnventuraThis is fine.
There is a brief tine window where this code can result in a successful replay attack just after installing the new version of this module.
On the other hand, this is an alpha version of the module. There's no real guarantee of being secure.
Comment #8
jcnventura