mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-26 13:27:22 +08:00
ajax.php ACE security patch
This commit is contained in:
@@ -6,6 +6,29 @@ loggedinorreturn();
|
|||||||
$action = $_POST['action'] ?? 'noAction';
|
$action = $_POST['action'] ?? 'noAction';
|
||||||
$params = $_POST['params'] ?? [];
|
$params = $_POST['params'] ?? [];
|
||||||
|
|
||||||
|
const ALLOWED_ACTION = [
|
||||||
|
'toggleUserMedalStatus',
|
||||||
|
'attendanceRetroactive',
|
||||||
|
'getPtGen',
|
||||||
|
'addClaim',
|
||||||
|
'removeClaim',
|
||||||
|
'removeUserLeechWarn',
|
||||||
|
'getOffer',
|
||||||
|
'approvalModal',
|
||||||
|
'approval',
|
||||||
|
'addSeedBoxRecord',
|
||||||
|
'removeSeedBoxRecord',
|
||||||
|
'removeHitAndRun',
|
||||||
|
'consumeBenefit',
|
||||||
|
'clearShoutBox',
|
||||||
|
'buyMedal',
|
||||||
|
'giftMedal',
|
||||||
|
'saveUserMedal',
|
||||||
|
];
|
||||||
|
if(!in_array($action,ALLOWED_ACTION)){
|
||||||
|
do_log('hack attempt '.print_r($CURUSER,true),'error');
|
||||||
|
$action = 'noAction';
|
||||||
|
}
|
||||||
function noAction()
|
function noAction()
|
||||||
{
|
{
|
||||||
throw new \RuntimeException("no Action");
|
throw new \RuntimeException("no Action");
|
||||||
@@ -13,6 +36,7 @@ function noAction()
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if(!isset($CURUSER))throw new \RuntimeException('Permission Denied');
|
||||||
$result = call_user_func($action, $params);
|
$result = call_user_func($action, $params);
|
||||||
exit(json_encode(success($result)));
|
exit(json_encode(success($result)));
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
|
|||||||
Reference in New Issue
Block a user