Skip to content

Commit

Permalink
Merge pull request #164 from devryan/xss-patch
Browse files Browse the repository at this point in the history
Fix ajax XSS
  • Loading branch information
devryan committed Mar 16, 2017
2 parents a3b0ea3 + b88c92d commit 2f78f27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ajax/ajax.php
Expand Up @@ -26,7 +26,7 @@
if(isset($_GET['a'])) $this_request = $_GET['a'];
elseif(isset($_POST['a'])) $this_request = $_POST['a'];

if(!in_array($this_request, $allowed_reqs)) die('ERROR: Invalid ajax action "' . $this_request . '"!');
if(!in_array($this_request, $allowed_reqs)) die('ERROR: Invalid ajax action "' . strip_tags($this_request) . '"!');

// Check logged-in
if($this_request != 'login_actions' && !isset($_SESSION['gpx_userid'])) die('You must be logged-in to do that!');
Expand Down Expand Up @@ -75,9 +75,9 @@
{
$login_type = $_SESSION['gpx_type'];
$this_request = str_replace('main_','',$this_request);
if($login_type == 'admin') require(DOCROOT.'/admin/'.$this_request.'.php');
else require(DOCROOT.'/'.$this_request.'.php');

if($login_type == 'admin' && file_exists(DOCROOT.'/admin/'.$this_request.'.php')) require(DOCROOT.'/admin/'.$this_request.'.php');
elseif(file_exists(DOCROOT.'/'.$this_request.'.php')) require(DOCROOT.'/'.$this_request.'.php');
}
// All other pages in /ajax/
else
Expand Down

0 comments on commit 2f78f27

Please sign in to comment.