Skip to content
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

2-Factor Authentication not Working After Upgrade to 4.9.3 #15724

Closed
stresbiz opened this issue Dec 30, 2019 · 21 comments
Closed

2-Factor Authentication not Working After Upgrade to 4.9.3 #15724

stresbiz opened this issue Dec 30, 2019 · 21 comments
Assignees
Labels
Bug A problem or regression with an existing feature
Projects
Milestone

Comments

@stresbiz
Copy link

After upgrading phpmyadmin to version 4.9.3, we are no longer prompted for Google's 2-factor authentication, after logging in. We've disabled, and re-enabled the 2FA multiple times. Cleared cache and tried a number of things, but we can't seem to get back the 2FA prompt. We haven't had this issue before, when upgrading to other versions.

@williamdes
Copy link
Member

williamdes commented Dec 30, 2019

Thank you for the report @stresbiz
Can you send the php version ?

@stresbiz
Copy link
Author

PHP 7.3.11 (cli)

@williamdes
Copy link
Member

williamdes commented Dec 30, 2019

@stresbiz how did you install phpMyAdmin ?

@stresbiz
Copy link
Author

We typically replace all phpMyAdmin files directly through FTP, and then copy our config.inc.php settings.

@williamdes
Copy link
Member

Okay, thank you
I will try to reproduce this issue ASAP

@stresbiz
Copy link
Author

Thank William!

@williamdes williamdes added the Bug A problem or regression with an existing feature label Dec 30, 2019
@williamdes williamdes added this to Needs triage in issues via automation Dec 30, 2019
@williamdes williamdes added this to the 5.0.1 milestone Dec 30, 2019
@williamdes williamdes moved this from Needs triage to Not reproduced in issues Dec 30, 2019
@williamdes
Copy link
Member

@stresbiz Can you try to install 5.0.0 version ?

@stresbiz
Copy link
Author

I was just going to say - we tried with the latest 5.0.0 too - same issue. And we've tried both versions (4.9.3 and 5.0.0) on multiple servers.

@williamdes
Copy link
Member

@stresbiz Interesting, thank you
If I can reproduce the issue I will fix it on 5.0.1 since 4.9.x are now only for security updates

Can you send php -m output ?

@stresbiz
Copy link
Author

stresbiz commented Dec 30, 2019

php -m

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
ssh2
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

@stresbiz
Copy link
Author

Please let me know if you can reproduce the issue and what it is. Thanks!

@seattledeveloper
Copy link

Hello ... I noticed when upgrading, first to 5.0.0, then downgrading to 4.9.3, that no custom settings were being read in, and the main settings screen says "You have no saved settings!", even though we do have saved settings.

So, neither two-factor auth, or other custom settings are being read in. I only have a few custom saved settings, so I can't vouch for all custom settings, but the few that I have are not being read in. This is occurring in both 4.9.3 and 5.0.0.

Hope this is helpful.

@seattledeveloper
Copy link

A bit more information, it seems that two-factor auth is actually removed from the configuration, because once I downgraded back to 4.9.2, it was no longer there.

And, FYI, I sftp the tar.gz file to the server, copy over the config file from a previous version, and just update a symlink. So I can easily move between versions.

@stresbiz
Copy link
Author

Thank you for your input seattledeveloper! Hopefully they can fix the issue ASAP.

@raimund-schluessler
Copy link

I see the same issue on 5.0.0.

@williamdes williamdes self-assigned this Dec 30, 2019
@ghost
Copy link

ghost commented Dec 31, 2019

I confirm the same issue. 2fa worked on 4.9.2 but not on 4.9.3 and 5.0.0.

@williamdes
Copy link
Member

git bisect said it was introduced by 542ba30

@williamdes
Copy link
Member

Hi everyone I found a fix

diff --git a/libraries/classes/TwoFactor.php b/libraries/classes/TwoFactor.php
index 9ac4ee20b5..efdf89b4ce 100644
--- a/libraries/classes/TwoFactor.php
+++ b/libraries/classes/TwoFactor.php
@@ -51,6 +51,10 @@ class TwoFactor
      */
     public function __construct($user)
     {
+        /** @var DatabaseInterface $dbi */
+        global $dbi;
+        $dbi->postConnectControl();
+
         $this->userPreferences = new UserPreferences();
         $this->user = $user;
         $this->_available = $this->getAvailable();

Can you test it ?

williamdes added a commit to williamdes/phpmyadmintest that referenced this issue Jan 2, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
@seattledeveloper
Copy link

I edited the TwoFactor.php file on the server in the 5.0.0 tree, adding the 3 new lines of code. 2FA is now working again, as verified by 2 different users, and logging in more than once (just to ensure that the configuration didn't go away between the first and second logins).

And, IMHO, it seems that this fix should be added to the 4.9.x tree as well, since this broke a feature that really is security related.

Thanks for taking care of this so quickly!

@williamdes
Copy link
Member

@seattledeveloper Thank your for the feedback, the final fix is in #15724
I crafted a short version so you could test it

@thg2k Can you please apply (PR #15724) and let us know if the fix does not break the tree like it did in #15608 ?

For everyone, the fix will go into next 4.9 version (#15724)

williamdes added a commit that referenced this issue Jan 6, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes modified the milestones: 5.0.1, 4.9.4 Jan 6, 2020
issues automation moved this from Not reproduced to Closed Jan 6, 2020
@williamdes
Copy link
Member

williamdes commented Jan 6, 2020

Will be part of 4.9.4+ and 5.0.1+

tabraiz961 pushed a commit to tabraiz961/phpmyadmin that referenced this issue Jan 11, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
Signed-off-by: Tabraiz Malik <tabraizmalik96@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature
Projects
issues
  
Closed
Development

No branches or pull requests

4 participants