查看: 805|回复: 0
|
[2006-10-25] 紧急安全更新!!!!!重要!!!!For Discuz! 4.X , 5.x
[复制链接]
|
|
或浏览 DISCUZ 官方网站
请所有 使用 4.X , 5.x 论坛的用户立即修补您的论坛,避免遭受攻击。
修补方法:修改文件 include/global.func.php
查找下面这段代码(一般应当在global.func.php 文件的开头处)
- function authcode($string, $operation, $key = '') {
- $key = $key ? $key : $GLOBALS['discuz_auth_key'];
- $coded = '';
- $keylength = strlen($key);
- $string = $operation == 'DECODE' ? base64_decode($string) : $string;
- for($i = 0; $i < strlen($string); $i += $keylength) {
- $coded .= substr($string, $i, $keylength) ^ $key;
- }
- $coded = $operation == 'ENCODE' ? str_replace('=', '', base64_encode($coded)) : $coded;
- return $coded;
- }
复制代码
替换为
- function authcode ($string, $operation, $key = '') {
-
- $key = bin2hex($key ? $key : $GLOBALS['discuz_auth_key']);
- $key_length = strlen($key);
-
- $string = $operation == 'DECODE' ? base64_decode($string) : $string;
- $string_length = strlen($string);
-
- $rndkey = $box = array();
- $result = '';
-
- for ($i = 0; $i <= 255; $i++) {
- $rndkey[$i] = ord($key[$i % $key_length]);
- $box[$i] = $i;
- }
- for ($j = $i = 0; $i < 256; $i++) {
- $j = ($j + $box[$i] + $rndkey[$i]) % 256;
- $tmp = $box[$i];
- $box[$i] = $box[$j];
- $box[$j] = $tmp;
- }
-
- for ($a = $j = $i = 0; $i < $string_length; $i++) {
- $a = ($a + 1) % 256;
- $j = ($j + $box[$a]) % 256;
- $tmp = $box[$a];
- $box[$a] = $box[$j];
- $box[$j] = $tmp;
- $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
- }
- return ($operation == 'ENCODE' ? str_replace('=', '', base64_encode($result)) : $result);
- }
复制代码 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|