Bug #79011 [NEW]: MySQL caching_sha2_password Authentication inconsistency
| From: | bendix dot ohlhauser at gmail dot com | Date: | Sat, 21 Dec 2019 03:06:48 +0000 |
| Subject: | Bug #79011 [NEW]: MySQL caching_sha2_password Authentication inconsistency | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224455@lists.php.net to get a copy of this message | ||
From: bendix dot ohlhauser at gmail dot com
Operating system: Ubuntu 18 LTS
PHP version: 7.4.1
Package: MySQLi related
Bug Type: Bug
Bug description:MySQL caching_sha2_password Authentication inconsistency
Description:
------------
--- Potential security issue, not sure though ---
--- Potentially issue with MySQL, instead of PHP, not sure though ---
Disclaimer: This might look like user error, but most certainly is not.
See:
https://stackoverflow.com/questions/59432704/php-7-4-mysql-caching-sha2-password-randomly-denying-passwords
MySQL caching_sha2_password is supported by PHP7.4, but it handles the
passwords incorrectly.
The following password via PHP: l0QDEptp*L6tNo28ey^8
Results in Access Denied.
Logging in to the account via mysql shell and running it again fixed the
issue.
Also, removing a character fixed the issue.
Regarding php.ini: opcache is enabled.
Feel free to contact me for additional information.
Test script:
---------------
const DB_CHARSET = 'UTF8MB4';
const DB_HOST = '127.0.0.1';
const DB_USERNAME = 'test';
const DB_PASSWORD = '';
$mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);
Expected result:
----------------
Successful login
Actual result:
--------------
PHP Warning: mysqli::__construct(): (HY000/1045): Access denied for user
'test'@'localhost' (using password: YES) in /db.php on line 5
--
Edit bug report at https://bugs.php.net/bug.php?id=79011&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79011&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79011&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79011&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79011&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79011&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79011&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79011&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79011&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79011&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79011&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79011&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79011&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79011&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79011&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79011&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79011&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79011&r=mysqlcfg