在./libraries/phpseclib/Crypt/Base.php#967中出现警告



今天我已经升级了我的phpMyAdmin 4.4.09到4.4.14,在我的红帽企业Linux服务器发布6.7(圣地亚哥)与PHP版本5.3.3。我的数据库服务器是MariaDB 5.5.44。我已经将以前安装的config.inc.php文件复制到新解压缩的文件中。当我登录时,我收到以下警告消息:

Warning in ./libraries/phpseclib/Crypt/Base.php#967
 openssl_encrypt(): Using an empty Initialization Vector (iv) is potentially insecure and not recommended
Backtrace
./libraries/phpseclib/Crypt/Base.php#967: openssl_encrypt(
string ' g8��)@�� �8��',
string 'aes-256-ecb',
string '52627967f3d249d378f33d2b9b1681e7',
boolean true,
)
./libraries/plugins/auth/AuthenticationCookie.class.php#810: phpseclibCryptBase->decrypt(string 'w(�  �9P���(��')
./libraries/plugins/auth/AuthenticationCookie.class.php#458: AuthenticationCookie->cookieDecrypt(
string 'GncowgnLOVDc0h3HKLkC4g==',
string '52627967f3d249d378f33d2b9b1681e7',
)
./libraries/common.inc.php#869: AuthenticationCookie->authCheck()
./index.php#12: require_once(./libraries/common.inc.php

Warning in ./libraries/phpseclib/Crypt/Base.php#967
 openssl_encrypt(): Using an empty Initialization Vector (iv) is potentially insecure and not recommended
Backtrace
./libraries/phpseclib/Crypt/Base.php#967: openssl_encrypt(
string '�만�"Na#���` �~',
string 'aes-256-ecb',
string '2}�)6�k4�yK�вQq1jՁ1��o<6H<�>���N��Lj9�i�$�B'���c�;kc�C���'�S�΁��� %yخ�3�s ��c?5�� ��{ϓ~�2��j,��Ϗr�BxF�]���\�[��#���H�IR\/cA:W�,E��6U    -���Y�oz�   ��@���;5F�8��9]�ݧ��2]�B����Dy��4Nv]5>���3��Su5}���4 󋄡���<3�]}_՗���,� `hG',
boolean true,
)
./libraries/plugins/auth/AuthenticationCookie.class.php#810: phpseclibCryptBase->decrypt(string '�����2^q3���p�n')
./libraries/plugins/auth/AuthenticationCookie.class.php#492: AuthenticationCookie->cookieDecrypt(
string 'n/u3nKcyXnEzof2TcBmqbg==',
string '2}�)6�k4�yK�вQq1jՁ1��o<6H<�>���N��Lj9�i�$�B'���c�;kc�C���'�S�΁��� %yخ�3�s ��c?5�� ��{ϓ~�2��j,��Ϗr�BxF�]���\�[��#���H�IR\/cA:W�,E��6U    -���Y�oz�   ��@���;5F�8��9]�ݧ��2]�B����Dy��4Nv]5>���3��Su5}���4 󋄡���<3�]}_՗���,� `hG',
)
./libraries/common.inc.php#869: AuthenticationCookie->authCheck()
./index.php#12: require_once(./libraries/common.inc.php)

Warning in ./libraries/Response.class.php#370
 json_encode(): Invalid UTF-8 sequence in argument
Backtrace
./libraries/Response.class.php#370: json_encode(array)
./libraries/Response.class.php#388: PMA_Response->_ajaxResponse()
PMA_Response::response()

你能帮我吗?由于

这是一个PHP 5.3.3的错误。

我能够在PHP 5.3.3上重现这个问题,这样做:

openssl_encrypt(str_repeat('.', 16), 'aes-256-ecb', str_repeat('a', 32), true);

结果是" Warning: openssl_encrypt(): Using an empty Initialization Vector (iv) is potentially insecure and not recommended "

有趣的是ECB模式不使用IV。无论如何,我试图添加一个,因此:

openssl_encrypt(str_repeat('.', 16), 'aes-256-ecb', str_repeat('a', 32), true, str_repeat('.', 16));

这给了我一个"Warning: openssl_encrypt(): IV passed is 16 bytes long which is longer than the 0 expected by selected cipher, truncating"。

所以无论你做什么,你得到一个错误时使用ECB模式在PHP 5.3.3。我甚至尝试将最后一个参数设置为'',并得到了关于使用空IV的第一个错误。

在PHP 5.3.27中没有这个问题。

我不打算强行使用PHP 5.3的每个版本。看看这个是什么时候修复的,但是…我的猜测是它在5.3.7中被修复了,在这个更新日志条目中:

"openssl_encrypt()/openssl_decrypt()将可变长度的密钥截断为该算法的OpenSSL默认值。(斯科特)"

说的是键而不是iv,但这仍然是我能在他们5.3版本的更新日志中找到的最接近的条目。*系列。

我的建议:在phpseclib中做一个查找替换。找到所有openssl_encrypt行并将其替换为@openssl_encrypt

真的,你应该只需要为ECB模式做这件事,但我给你的说明更容易。可能还需要为openssl_decrypt做同样的事情。也许phpseclib也应该这样做,但我认为我…错误抑制操作符通常是不受欢迎的,实际上是PHP 5.3.3。

前面已经部分提到:这是PHP 5.3.3中的一个错误(RHEL 6中附带的)。

这个错误本身已经在上游修复了,但是这个修复需要在RHEL 6中反向移植到PHP 5.3.3。已经在https://bugzilla.redhat.com/show_bug.cgi?id=1260315上提交了一个错误报告-但是为了正确地确定优先级,受影响的Red Hat客户应该在https://access.redhat.com上创建一个支持单,参考前面提到的Red Hat错误报告-并说明需要此修复(以及受影响的系统数量)。

对于任何来到此页面寻找错误解决方案并使用aes128的人将其切换到aes-256-ecb作为neubert上面的例子解决了我的错误问题。

最新更新