Plugin Directory

Changeset 1486767


Ignore:
Timestamp:
08/30/2016 11:03:57 PM (10 years ago)
Author:
osexcel
Message:

6.5.8

  • Add administrator checking to improve AJAX security check function to enhance CSRF protection
Location:
ose-firewall/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ose-firewall/trunk/ose_firewall_badge.php

    r1486760 r1486767  
    44   Description: Plugin For Showing Centrora Security Badge
    55   Author: Centrora Security
    6    Version: 6.5.7
     6   Version: 6.5.8
    77*/ 
    88//include(dirname(__FILE__).'/includes/oseBadgeWidget.php');
  • ose-firewall/trunk/ose_wordpress_firewall.php

    r1486760 r1486767  
    55Description: Centrora Security (previously OSE Firewall) - A WordPress Security Firewall plugin created by Centrora. Protect your WordPress site by identify any malicious codes, spam, virus, SQL injection, and security vulnerabilities.
    66Author: Centrora (Previously ProWeb)
    7 Version: 6.5.7
     7Version: 6.5.8
    88Author URI: http://www.centrora.com/
    99*/
  • ose-firewall/trunk/readme.txt

    r1486760 r1486767  
    66Requires at least: 3.7
    77Tested up to: 4.5.2
    8 Stable tag: 6.5.7
     8Stable tag: 6.5.8
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    164164
    165165== Changelog ==
     166
     167= 6.5.8 =
     168* Add administrator checking to improve AJAX security check function to enhance CSRF protection
    166169
    167170= 6.5.7 =
  • ose-firewall/trunk/vendor/oseframework/ajax/oseAjax.php

    r1486760 r1486767  
    2626if (!defined('OSE_FRAMEWORK') && !defined('OSE_ADMINPATH') && !defined('_JEXEC'))
    2727{
    28     die('Direct Access Not Allowed');
     28    die('Direct Access Not Allowed');
    2929}
    3030
    3131class oseAjax
    3232{
    33     public static function runAction()
    34     {
    35         $centrora = oseFirewall::runApp();
    36         self::secureCheck();
     33    public static function runAction()
     34    {
     35        $centrora = oseFirewall::runApp();
     36        self::secureCheck();
    3737        $requst = $centrora->runController($_REQUEST['controller'] . 'Controller', $_REQUEST['task']);
    3838        $requst->execute();
    3939
    40     }
    41     private static function secureCheck()
    42     {
    43         if (!empty($_REQUEST['centnounceForm'])) {
    44             $centnounce = (isset($_REQUEST['centnounceForm'])) ? $_REQUEST['centnounceForm'] : '';
    45         }
    46         else {
    47             $centnounce = (isset($_REQUEST['centnounce'])) ? $_REQUEST['centnounce'] : '';
    48         }
    49         if (oseFirewall::isadmin()) {
     40    }
     41    private static function secureCheck()
     42    {
     43        if (!empty($_REQUEST['centnounceForm'])) {
     44            $centnounce = (isset($_REQUEST['centnounceForm'])) ? $_REQUEST['centnounceForm'] : '';
     45        }
     46        else {
     47            $centnounce = (isset($_REQUEST['centnounce'])) ? $_REQUEST['centnounce'] : '';
     48        }
     49        osefirewall::loadUsers();
     50        $user = new oseUsers ();
     51        if ($user->isadmin()) {
    5052            if (!self::verifyNounce($centnounce))
    5153            {
     
    5658            die('Sorry, this is for administrator only.');
    5759        }
    58     }
    59     private static function verifyNounce($centnounce)
    60     {
    61         if (OSE_CMS == 'joomla')
    62         {
    63             return true;
    64         }
    65         else
    66         {
    67             if (isset($_SESSION['centnounce']) && $_SESSION['centnounce'] == $centnounce) {
    68                 return true;
    69             } else {
    70                 return false;
    71             }
    72         }
    73     }
    74     public static function addActions($func)
    75     {
    76         if (class_exists('oseWordpress'))
    77         {
    78             add_action('wp_ajax_'.$func, 'oseAjax::runAction');
    79         }
    80         else
    81         {
    82             if (isset($_REQUEST['controller']) && isset($_REQUEST['task']))
    83             {
    84                 self::runAction();
    85             }
    86         }
    87     }
    88     public static function loadActions($actions)
    89     {
    90         foreach ($actions as $action)
    91         {
    92             self::addActions($action);
    93         }
    94     }
    95     public static function aJaxReturn($result, $status, $msg, $continue = false, $id = null, $qatest = false )
    96     {
    97         oseFramework::loadJSON();
    98         oseFramework::loadRequest();
    99         $return = array(
    100             'success' => (boolean) $result,
    101             'status' => $status,
    102             'result' => $msg,
    103             'cont' => (boolean) $continue,
    104             'id' => (int) $id
    105         );
    106         $tmp = oseJSON::encode($return);
    107         $callback = oRequest::getVar('callback', null);
    108         if ($qatest == true) {
    109             return $tmp;
    110         }
    111         else {
    112             if ($callback == null) {
    113                 print_r($tmp);
    114             } else {
    115                 header("Content-Type: text/javascript");
    116                 $return = $callback . '(' . $tmp . ');';
    117                 print_r($return);
    118             }
    119             exit;
    120         }
    121     }
    122     public static function returnJSON($var, $mobiledevice = false)
    123     {
    124         oseFramework::loadJSON();
    125         oseFramework::loadRequest();
    126         $callback = oRequest::getVar('callback', null);
    127         if ($callback == null)
    128         {
    129             print_r(oseJSON::encode($var));
    130         }
    131         else
    132         {
    133             header("Content-Type: text/javascript");
    134             $return = $callback.'('.oseJSON::encode($var).');';
    135             print_r($return);
    136         }
    137         exit;
    138     }
    139     public static function throwAjaxRecursive($result, $status, $msg, $continue, $step)
    140     {
    141         $return = array(
    142             'success' => (boolean) $result,
    143             'status' => $status,
    144             'result' => $msg,
    145             'cont' => (boolean) $continue,
    146             'step' => (int) $step,
    147         );
    148         $tmp = oseJSON::encode($return);
    149         print_r($tmp);
    150         exit;
    151     }
     60    }
     61    private static function verifyNounce($centnounce)
     62    {
     63        if (OSE_CMS == 'joomla')
     64        {
     65            return true;
     66        }
     67        else
     68        {
     69            if (isset($_SESSION['centnounce']) && $_SESSION['centnounce'] == $centnounce) {
     70                return true;
     71            } else {
     72                return false;
     73            }
     74        }
     75    }
     76    public static function addActions($func)
     77    {
     78        if (class_exists('oseWordpress'))
     79        {
     80            add_action('wp_ajax_'.$func, 'oseAjax::runAction');
     81        }
     82        else
     83        {
     84            if (isset($_REQUEST['controller']) && isset($_REQUEST['task']))
     85            {
     86                self::runAction();
     87            }
     88        }
     89    }
     90    public static function loadActions($actions)
     91    {
     92        foreach ($actions as $action)
     93        {
     94            self::addActions($action);
     95        }
     96    }
     97    public static function aJaxReturn($result, $status, $msg, $continue = false, $id = null, $qatest = false )
     98    {
     99        oseFramework::loadJSON();
     100        oseFramework::loadRequest();
     101        $return = array(
     102            'success' => (boolean) $result,
     103            'status' => $status,
     104            'result' => $msg,
     105            'cont' => (boolean) $continue,
     106            'id' => (int) $id
     107        );
     108        $tmp = oseJSON::encode($return);
     109        $callback = oRequest::getVar('callback', null);
     110        if ($qatest == true) {
     111            return $tmp;
     112        }
     113        else {
     114            if ($callback == null) {
     115                print_r($tmp);
     116            } else {
     117                header("Content-Type: text/javascript");
     118                $return = $callback . '(' . $tmp . ');';
     119                print_r($return);
     120            }
     121            exit;
     122        }
     123    }
     124    public static function returnJSON($var, $mobiledevice = false)
     125    {
     126        oseFramework::loadJSON();
     127        oseFramework::loadRequest();
     128        $callback = oRequest::getVar('callback', null);
     129        if ($callback == null)
     130        {
     131            print_r(oseJSON::encode($var));
     132        }
     133        else
     134        {
     135            header("Content-Type: text/javascript");
     136            $return = $callback.'('.oseJSON::encode($var).');';
     137            print_r($return);
     138        }
     139        exit;
     140    }
     141    public static function throwAjaxRecursive($result, $status, $msg, $continue, $step)
     142    {
     143        $return = array(
     144            'success' => (boolean) $result,
     145            'status' => $status,
     146            'result' => $msg,
     147            'cont' => (boolean) $continue,
     148            'step' => (int) $step,
     149        );
     150        $tmp = oseJSON::encode($return);
     151        print_r($tmp);
     152        exit;
     153    }
    152154}
Note: See TracChangeset for help on using the changeset viewer.