php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Sec Bug #79309 possible information leak of PID on MySQL connection failure
Submitted: 2020-02-26 19:01 UTC Modified: 2020-02-26 19:39 UTC
From: php at darkain dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 7.4.3 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at darkain dot com
New email:
PHP Version: OS:

 

 [2020-02-26 19:01 UTC] php at darkain dot com
Description:
------------
The line of code can be found here:

https://github.com/php/php-src/blob/master/ext/mysqlnd/mysqlnd_commands.c#L633

An example output can be found here:

https://travis-ci.org/darkain/pudl/jobs/655476237#L504

In my particular example, it is a unit test suite, so warnings/errors are visible. In a normal production environment, this information SHOULDNT be visible, but many application and frameworks will display database connectivity errors straight to the client/user. PID knowledge can be used in conjunction with other potential exploits in an attack on a system.

This bug has always been there from the looks of it (going back to 2015 code), but it appears that in PHP 7.4, mysqlnd is used instead of mysqli, so this code path is now being hit. Also, mysqlnd isn't an option in the database functions list here on the bug tracker.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-02-26 19:24 UTC] stas@php.net
-Status: Open +Status: Not a bug
 [2020-02-26 19:24 UTC] stas@php.net
> but many application and frameworks will display database connectivity errors straight to the client/user

They shouldn't. Application displaying debug information to the client is not a bug in PHP.
 [2020-02-26 19:39 UTC] php at darkain dot com
Applications shouldnt display debug information, agreed.

Regardless of that, I still don't think PID information should be included within an error message, even without outputting to the client. This is leading to essentially a variable error message which is causing issues in an application in an unpredicted way. If nothing else, it should be noted as a change in the PHP 7.4 docs that the mysqli driver was changed.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 19 22:03:37 2021 UTC