From:             david at majorsecurity dot info
Operating system: Unix
PHP version:      5.3.0
PHP Bug Type:     Filter related
Bug description:  preg_match() full path disclosure

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



-- 
Edit bug report at http://bugs.php.net/?id=49693&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49693&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49693&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49693&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49693&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49693&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49693&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49693&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49693&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49693&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49693&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49693&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49693&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49693&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49693&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49693&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49693&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49693&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49693&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49693&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49693&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49693&r=mysqlcfg

Reply via email to