Issue Details (XML | Word | Printable)

Key: ZF-6625
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Stanislav Malyshev
Reporter: Guillermo Thiemann
Votes: 5
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Mayor security issue with Zend_Amf loading services via Zend_Loader

Created: 12/May/09 12:38 PM   Updated: 17/Jun/09 01:51 PM   Resolved: 17/Jun/09 01:51 PM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Amf, Zend_Loader
Affects Version/s: 1.8.0
Fix Version/s: 1.8.4

Time Tracking:
Not Specified


 Description  « Hide

Zend_Amf loads service-classes dynamically by using Zend_Loader in the following code:

— Zend/Amf/Server.php (169-179) ---------------------------------------

foreach ($this->_directories as $dir) { $classPath[] = $dir . $uriclasspath; }

require_once('Zend/Loader.php');
try { Zend_Loader::loadClass($className, $classPath, true); } catch (Exception $e) { require_once 'Zend/Amf/Server/Exception.php'; throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist'); }

-------------------------------------------

This is a mayor security issue as Zend_Loader tries to find the passed class($className) in all set include-paths if it is not found in the passed paths($classPath).
As a result it is possible to access each and every Class that implements a public method and can be loaded via zend-loader!!

I can think of two solutions:
1. Extend the interface of the loadClass function like so: public static function loadClass($class, $dirs = null, $ignoreIncludePaths = false)
2. Implement an independent service/class loading mechanism in Zend_Amf

The first solution seems to be better as this functionality could be advantageous in other components.

greetings, Guille



HT added a comment - 01/Jun/09 06:34 PM

This issue also allows an attacker to call any methods for classes included before the remoting class.
I agree with Guille, solution 1 is the simplest / elegant and requires minimum code change.

Any ideas when this will be implemented? as this is major security vulnerability affecting live sites

Cheers,
Horia


Wade Arnold added a comment - 16/Jun/09 02:52 PM

Stas, Can you check this out? I am not sure if you want to add something to Zend_Loader or make a modification inside of Zend_Amf_Server? How are the other Zend Server endpoints handling this?


Stanislav Malyshev added a comment - 17/Jun/09 01:51 PM

Thanks, fixed it - now it will load only files from specified directories.