Fix multiple CSRF vulnerabilities

This commit is contained in:
Fedor A. Fetisov 2013-09-06 14:32:25 +04:00 committed by webadmin
parent 9aef0fb2d4
commit 03265a1fb0
9 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,8 @@ require_once('../libs/operator.php');
require_once('../libs/pagination.php'); require_once('../libs/pagination.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('../libs/operator.php');
require_once('../libs/pagination.php'); require_once('../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('../libs/operator.php');
require_once('../libs/groups.php'); require_once('../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('../libs/common.php');
require_once('../libs/operator.php'); require_once('../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('../libs/operator.php');
require_once('../libs/operator_settings.php'); require_once('../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

@ -42,6 +42,7 @@ require_once('inc_errors.php');
<?php } ?> <?php } ?>
<form name="banForm" method="post" action="<?php echo $webimroot ?>/operator/ban.php"> <form name="banForm" method="post" action="<?php echo $webimroot ?>/operator/ban.php">
<?php print_csrf_token_input() ?>
<input type="hidden" name="banId" value="<?php echo htmlspecialchars($page['banId']) ?>"/> <input type="hidden" name="banId" value="<?php echo htmlspecialchars($page['banId']) ?>"/>
<?php if( $page['threadid'] ) { ?> <?php if( $page['threadid'] ) { ?>
<input type="hidden" name="threadid" value="<?php echo htmlspecialchars($page['threadid']) ?>"/> <input type="hidden" name="threadid" value="<?php echo htmlspecialchars($page['threadid']) ?>"/>

View File

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

View File

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

View File

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