Show
Ignore:
Timestamp:
07/11/2008 12:19:58 PM (5 months ago)
Author:
Shadowhand
Message:

Further fixes for #684. We now check to make sure the controller is within the path being searched, to prevent malicious URI segments with dot paths. Can we get any more secure?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Router.php

    r3073 r3075  
    9999                        $controller_path .= $segment; 
    100100 
    101  
    102101                        $found = FALSE; 
    103102                        foreach ($paths as $dir) 
     
    111110                                        $found = TRUE; 
    112111 
    113                                         if (is_file($dir.$controller_path.EXT)) 
     112                                        // The controller must be a file that exists with the search path 
     113                                        if ($c = str_replace('\\', '/', realpath($dir.$controller_path.EXT))  
     114                                            AND is_file($c) AND strpos($c, $dir) === 0) 
    114115                                        { 
    115116                                                // Set controller name 
     
    117118 
    118119                                                // Change controller path 
    119                                                 self::$controller_path = $dir.$controller_path.EXT; 
     120                                                self::$controller_path = $c; 
    120121 
    121122                                                // Set the method segment