Implement additional CSRF checks

This commit is contained in:
Fedor A. Fetisov 2013-10-29 02:27:32 +04:00
parent 7b5caf0e8d
commit a4449482e3
12 changed files with 14 additions and 3 deletions

View File

@ -22,6 +22,7 @@ require_once(dirname(dirname(__FILE__)).'/libs/pagination.php');
require_once(dirname(dirname(__FILE__)).'/libs/classes/thread.php'); require_once(dirname(dirname(__FILE__)).'/libs/classes/thread.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken();
$page = array('banId' => ''); $page = array('banId' => '');
$page['saved'] = false; $page['saved'] = false;
$page['thread'] = ''; $page['thread'] = '';

View File

@ -21,6 +21,8 @@ require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
require_once(dirname(dirname(__FILE__)).'/libs/pagination.php'); require_once(dirname(dirname(__FILE__)).'/libs/pagination.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken();
$page = array(); $page = array();
$errors = array(); $errors = array();

View File

@ -20,6 +20,7 @@ require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
require_once(dirname(dirname(__FILE__)).'/libs/groups.php'); require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken();
$page = array('grid' => ''); $page = array('grid' => '');
$errors = array(); $errors = array();

View File

@ -20,6 +20,7 @@ require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
require_once(dirname(dirname(__FILE__)).'/libs/groups.php'); require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken();
function get_group_members($groupid) function get_group_members($groupid)
{ {

View File

@ -19,6 +19,7 @@ require_once(dirname(dirname(__FILE__)).'/libs/init.php');
require_once(dirname(dirname(__FILE__)).'/libs/operator.php'); require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken();
if (isset($_GET['act']) && $_GET['act'] == 'del') { if (isset($_GET['act']) && $_GET['act'] == 'del') {

View File

@ -20,6 +20,7 @@ require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
require_once(dirname(dirname(__FILE__)).'/libs/operator_settings.php'); require_once(dirname(dirname(__FILE__)).'/libs/operator_settings.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken();
function update_operator_groups($operatorid, $newvalue) function update_operator_groups($operatorid, $newvalue)
{ {

View File

@ -31,7 +31,7 @@ function tpl_content() { global $page, $mibewroot, $errors;
<?php echo getlocal("page_ban.intro") ?> <?php echo getlocal("page_ban.intro") ?>
<br/> <br/>
<br/> <br/>
<?php <?php
require_once(dirname(__FILE__).'/inc_errors.php'); require_once(dirname(__FILE__).'/inc_errors.php');
?> ?>
@ -42,6 +42,7 @@ require_once(dirname(__FILE__).'/inc_errors.php');
<?php } ?> <?php } ?>
<form name="banForm" method="post" action="<?php echo $mibewroot ?>/operator/ban.php"> <form name="banForm" method="post" action="<?php echo $mibewroot ?>/operator/ban.php">
<?php print_csrf_token_input() ?>
<input type="hidden" name="banId" value="<?php echo $page['banId'] ?>"/> <input type="hidden" name="banId" value="<?php echo $page['banId'] ?>"/>
<?php if( $page['threadid'] ) { ?> <?php if( $page['threadid'] ) { ?>
<input type="hidden" name="threadid" value="<?php echo $page['threadid'] ?>"/> <input type="hidden" name="threadid" value="<?php echo $page['threadid'] ?>"/>

View File

@ -82,7 +82,7 @@ if( $page['pagination.items'] ) {
?> ?>
</td> </td>
<td> <td>
<a class="removelink" id="i<?php echo $b['banid'] ?>" href="<?php echo $mibewroot ?>/operator/blocked.php?act=del&amp;id=<?php echo $b['banid'] ?>"> <a class="removelink" id="i<?php echo $b['banid'] ?>" href="<?php echo $mibewroot ?>/operator/blocked.php?act=del&amp;id=<?php echo $b['banid'] ?><?php print_csrf_token_in_url() ?>">
<?php echo getlocal("remove.item") ?></a>, <?php echo getlocal("remove.item") ?></a>,
<a href="<?php echo $mibewroot ?>/operator/ban.php?id=<?php echo $b['banid'] ?>"> <a href="<?php echo $mibewroot ?>/operator/ban.php?id=<?php echo $b['banid'] ?>">
<?php echo getlocal("edit.item") ?></a> <?php echo getlocal("edit.item") ?></a>

View File

@ -63,6 +63,7 @@ require_once(dirname(__FILE__).'/inc_errors.php');
<?php } ?> <?php } ?>
<form name="groupForm" method="post" action="<?php echo $mibewroot ?>/operator/group.php"> <form name="groupForm" method="post" action="<?php echo $mibewroot ?>/operator/group.php">
<?php print_csrf_token_input() ?>
<input type="hidden" name="gid" value="<?php echo $page['grid'] ?>"/> <input type="hidden" name="gid" value="<?php echo $page['grid'] ?>"/>
<div> <div>
<?php print_tabbar(); ?> <?php print_tabbar(); ?>

View File

@ -35,6 +35,7 @@ require_once(dirname(__FILE__).'/inc_errors.php');
<?php } ?> <?php } ?>
<form name="membersForm" method="post" action="<?php echo $mibewroot ?>/operator/groupmembers.php"> <form name="membersForm" method="post" action="<?php echo $mibewroot ?>/operator/groupmembers.php">
<?php print_csrf_token_input() ?>
<input type="hidden" name="gid" value="<?php echo $page['groupid'] ?>"/> <input type="hidden" name="gid" value="<?php echo $page['groupid'] ?>"/>
<div> <div>
<?php print_tabbar(); ?> <?php print_tabbar(); ?>

View File

@ -122,7 +122,7 @@ if(count($page['groups']) > 0) {
</td> </td>
<?php if($page['canmodify']) { ?> <?php if($page['canmodify']) { ?>
<td> <td>
<a href="<?php echo $mibewroot ?>/operator/groups.php?act=del&amp;gid=<?php echo $grp['groupid'] ?>" id="i<?php echo $grp['groupid'] ?>" class="removelink"> <a href="<?php echo $mibewroot ?>/operator/groups.php?act=del&amp;gid=<?php echo $grp['groupid'] ?><?php print_csrf_token_in_url() ?>" id="i<?php echo $grp['groupid'] ?>" class="removelink">
<?php echo getlocal("remove.item") ?> <?php echo getlocal("remove.item") ?>
</a> </a>
</td> </td>

View File

@ -35,6 +35,7 @@ require_once(dirname(__FILE__).'/inc_errors.php');
<?php } ?> <?php } ?>
<form name="opgroupsForm" method="post" action="<?php echo $mibewroot ?>/operator/opgroups.php"> <form name="opgroupsForm" method="post" action="<?php echo $mibewroot ?>/operator/opgroups.php">
<?php print_csrf_token_input() ?>
<input type="hidden" name="op" value="<?php echo $page['opid'] ?>"/> <input type="hidden" name="op" value="<?php echo $page['opid'] ?>"/>
<div> <div>
<?php print_tabbar(); ?> <?php print_tabbar(); ?>