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
 [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

Pull Requests

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: Mon Dec 30 14:01:28 2024 UTC