Osclass <= 3.4.2 (ajax.php) Local File Inclusion Vulnerability

• Software Link:

http://osclass.org/

• Affected Versions:

Version 3.4.2 and probably prior versions.

• Vulnerability Description:

The vulnerable code is located in the /oc-includes/osclass/controller/ajax.php script:

                case 'custom': // Execute via AJAX custom file
                    if(Params::existParam('route')) {
                        $routes = Rewrite::newInstance()->getRoutes();
                        $rid = Params::getParam('route');
                        $file = '../';
                        if(isset($routes[$rid]) && isset($routes[$rid]['file'])) {
                            $file = $routes[$rid]['file'];
                        }
                    } else {
                        // DEPRECATED: Disclosed path in URL is deprecated, use routes instead
                        // This will be REMOVED in 3.4
                        $file = Params::getParam('ajaxfile');
                    }

                    if($file == '') {
                        echo json_encode(array('error' => 'no action defined'));
                        break;
                    }

                    // valid file?
                    if( stripos($file, '../') !== false  || stripos($file, '/admin/') !== false ) { //If the file is inside an "admin" folder, it should NOT be opened in frontend
                        echo json_encode(array('error' => 'no valid ajaxFile'));
                        break;
                    }

                    if( !file_exists(osc_plugins_path() . $file) ) {
                        echo json_encode(array('error' => "ajaxFile doesn't exist"));
                        break;
                    }

                    require_once osc_plugins_path() . $file;

User input passed through the “ajaxfile” request parameter when handling a “custom” action within the AJAX interface is not properly sanitized being used in a call to the “require_once()” function at line 255. This can be exploited to include arbitrary local files and execute arbitrary PHP code when the application is running on Windows.

• Solution:

Update to version 3.4.3 or later.

• Disclosure Timeline:

[29/09/2014] – Vendor notified
[29/09/2014] – Vendor response
[09/10/2014] – Version 3.4.3 released: http://blog.osclass.org/2014/10/09/osclass-3-4-3
[09/10/2014] – CVE number requested
[11/10/2014] – CVE number assigned
[31/12/2014] – Public disclosure

• CVE Reference:

The Common Vulnerabilities and Exposures project (cve.mitre.org)
has assigned the name CVE-2014-8084 to this vulnerability.

• Credits:

Vulnerability discovered by Egidio Romano.