BUG 13436 ProcessMaker 2.x Authenticated PHP Code Execution SOLVED
- The function sent in the variable $_REQUEST['action'] was always executed - A new method was implemented to validate if is a user custom function or a system function (G::isUserFunction)
This commit is contained in:
@@ -5222,6 +5222,14 @@ class G
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function isUserFunction($functionName) {
|
||||
$allFunctions = get_defined_functions();
|
||||
if (!isset($allFunctions['user'])) {
|
||||
$allFunctions['user'] = array();
|
||||
}
|
||||
return in_array(strtolower($functionName), $allFunctions['user']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ if (! isset ($_REQUEST ['action'])) {
|
||||
print G::json_encode ($res);
|
||||
die ();
|
||||
}
|
||||
if (! function_exists ($_REQUEST ['action'])) {
|
||||
if (! function_exists ($_REQUEST['action']) || !G::isUserFunction($_REQUEST['action'])) {
|
||||
$res ['success'] = false;
|
||||
$res ['message'] = 'The requested action does not exist';
|
||||
print G::json_encode ($res);
|
||||
|
||||
@@ -5,7 +5,7 @@ if (! isset( $_REQUEST['action'] )) {
|
||||
print G::json_encode( $res );
|
||||
die();
|
||||
}
|
||||
if (! function_exists( $_REQUEST['action'] )) {
|
||||
if (! function_exists( $_REQUEST['action'] ) || !G::isUserFunction($_REQUEST['action'])) {
|
||||
$res['success'] = 'failure';
|
||||
$res['message'] = 'The requested action does not exist';
|
||||
header( "Content-Type: application/json" );
|
||||
|
||||
@@ -13,7 +13,7 @@ if (! isset( $_REQUEST['action'] )) {
|
||||
print G::json_encode( $res );
|
||||
die();
|
||||
}
|
||||
if (! function_exists( $_REQUEST['action'] )) {
|
||||
if (! function_exists( $_REQUEST['action'] ) || !G::isUserFunction($_REQUEST['action'])) {
|
||||
$res['success'] = 'failure';
|
||||
$res['message'] = G::LoadTranslation( 'ID_REQUEST_ACTION_NOT_EXIST' );
|
||||
print G::json_encode( $res );
|
||||
|
||||
@@ -6,7 +6,7 @@ if (! isset( $_REQUEST['action'] )) {
|
||||
print G::json_encode( $return );
|
||||
die();
|
||||
}
|
||||
if (! function_exists( $_REQUEST['action'] )) {
|
||||
if (! function_exists( $_REQUEST['action'] ) || !G::isUserFunction($_REQUEST['action'])) {
|
||||
$return['success'] = 'failure';
|
||||
$return['message'] = 'The requested action doesn\'t exists';
|
||||
print G::json_encode( $return );
|
||||
|
||||
Reference in New Issue
Block a user