php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49693 preg_match() full path disclosure
Submitted: 2009-09-27 22:08 UTC Modified: 2009-09-27 22:58 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: david at majorsecurity dot info Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.3.0 OS: Unix
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: david at majorsecurity dot info
New email:
PHP Version: OS:

 

 [2009-09-27 22:08 UTC] david at majorsecurity dot info
Description:
------------
There is a full path disclosure vulnerability concerning the preg_match() php function which allow attackers to
gather the real path of the server side script.
The preg_match() PHP function takes strings as parameters and will raise warnings when values that are passed are arrays rather then strings. I would NOT recommend to just react by "security through obscurity" and turn off the error messages, error reporting etc.
This is not a solution because there are a lot of users that are having a shared hosting server where they aren't able to manipulate
the "php.ini" configuration file - even ini_set() is forbidden on some shared hoster servers. 
So they still would have the full path disclosure there. As general workaround I would recommend to meticulously go through the code forcing PHP to cast the data to the desired type, in this case the (string) casts to eliminate the Notice or Warning messages. 

Reproduce code:
---------------
Proof of concept:
http://localhost/cms/modules/system/admin.php?fct=users&op[]=


Expected result:
----------------
Warning: preg_match() expects parameter 2 to be string, array given in /htdocs/cms/include/common.php on line 105



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-27 22:58 UTC] pajoye@php.net
Thanks for this report, it made my evening :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC