mirror of
https://github.com/VTECRM/vtenext.git
synced 2026-02-26 16:18:47 +00:00
TTTT228766 - Security Fix
This commit is contained in:
parent
0b7471e3df
commit
3faaec424d
@ -10,15 +10,38 @@
|
|||||||
* Contributing: http://www.plupload.com/contributing
|
* Contributing: http://www.plupload.com/contributing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Settings
|
//crmv@228766
|
||||||
$targetDir = 'storage/uploads_emails_'.$_REQUEST['dir']; //crmv@2963m
|
if(!isset($root_directory)){
|
||||||
|
require('../../../config.inc.php');
|
||||||
|
}
|
||||||
|
chdir($root_directory);
|
||||||
|
require_once('include/utils/utils.php');
|
||||||
|
VteSession::start();
|
||||||
|
if(!VteSession::hasKey('authenticated_user_id')) die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Not Authorized."}, "id" : "id"}');
|
||||||
|
// crmv@228766e
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
$targetDir = 'storage/uploads_emails_'.str_replace('../', '', $_REQUEST['dir']);//crmv@2963m crmv@228766
|
||||||
|
|
||||||
|
// crmv@228766
|
||||||
|
$tempRootDir = rtrim($root_directory, "/");
|
||||||
// Create target dir
|
// Create target dir
|
||||||
if (!file_exists($targetDir)){
|
if (!file_exists($targetDir)){
|
||||||
@mkdir($targetDir);
|
@mkdir($targetDir);
|
||||||
|
checkIfPathIsInStorage($targetDir, $tempRootDir);
|
||||||
|
|
||||||
@file_put_contents($targetDir."/index.html", "<html></html>\n"); // crmv@195947
|
@file_put_contents($targetDir."/index.html", "<html></html>\n"); // crmv@195947
|
||||||
|
} else {
|
||||||
|
checkIfPathIsInStorage($targetDir, $tempRootDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkIfPathIsInStorage($path, $rootPath){
|
||||||
|
if (strpos(dirname(realpath($path)), $rootPath.'/storage') !== 0){
|
||||||
|
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Bad dir."}, "id" : "id"}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// crmv@228766e
|
||||||
|
|
||||||
//crmv@81704
|
//crmv@81704
|
||||||
if ($_REQUEST['ckeditor'] == 'true'){
|
if ($_REQUEST['ckeditor'] == 'true'){
|
||||||
$response_arr = Array(
|
$response_arr = Array(
|
||||||
@ -85,6 +108,13 @@ $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
|||||||
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
||||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
|
|
||||||
|
// crmv@228766
|
||||||
|
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
|
||||||
|
if (is_array($upload_badext) && in_array($ext, $upload_badext)){
|
||||||
|
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "File type not supported."}, "id" : "id"}');
|
||||||
|
}
|
||||||
|
// crmv@228766e
|
||||||
|
|
||||||
// Clean the fileName for security reasons
|
// Clean the fileName for security reasons
|
||||||
$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
||||||
|
|
||||||
@ -204,4 +234,3 @@ if (strpos($contentType, "multipart") !== false) {
|
|||||||
// Return JSON-RPC response
|
// Return JSON-RPC response
|
||||||
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
|
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
|
||||||
//crmv@22123e
|
//crmv@22123e
|
||||||
?>
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user