佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 805|回复: 0

[2006-10-25] 紧急安全更新!!!!!重要!!!!For Discuz! 4.X , 5.x

[复制链接]
发表于 26-10-2006 01:59 AM | 显示全部楼层 |阅读模式
或浏览 DISCUZ 官方网站

请所有 使用 4.X , 5.x 论坛的用户立即修补您的论坛,避免遭受攻击。

修补方法:修改文件  include/global.func.php

查找下面这段代码(一般应当在global.func.php 文件的开头处)


  1. function authcode($string, $operation, $key = '') {
  2.         $key = $key ? $key : $GLOBALS['discuz_auth_key'];

  3.         $coded = '';
  4.         $keylength = strlen($key);
  5.         $string = $operation == 'DECODE' ? base64_decode($string) : $string;
  6.         for($i = 0; $i < strlen($string); $i += $keylength) {
  7.                 $coded .= substr($string, $i, $keylength) ^ $key;
  8.         }
  9.         $coded = $operation == 'ENCODE' ? str_replace('=', '', base64_encode($coded)) : $coded;
  10.         return $coded;
  11. }

复制代码



替换为


  1. function authcode ($string, $operation, $key = '') {
  2.         
  3.         $key = bin2hex($key ? $key : $GLOBALS['discuz_auth_key']);
  4.         $key_length = strlen($key);
  5.         
  6.         $string = $operation == 'DECODE' ? base64_decode($string) : $string;
  7.         $string_length = strlen($string);
  8.                
  9.         $rndkey = $box = array();
  10.         $result = '';
  11.         
  12.         for ($i = 0; $i <= 255; $i++) {
  13.                 $rndkey[$i] = ord($key[$i % $key_length]);
  14.                 $box[$i] = $i;
  15.         }

  16.         for ($j = $i = 0; $i < 256; $i++) {
  17.                 $j = ($j + $box[$i] + $rndkey[$i]) % 256;
  18.                 $tmp = $box[$i];
  19.                 $box[$i] = $box[$j];
  20.                 $box[$j] = $tmp;
  21.         }
  22.         
  23.         for ($a = $j = $i = 0; $i < $string_length; $i++) {
  24.                 $a = ($a + 1) % 256;
  25.                 $j = ($j + $box[$a]) % 256;
  26.                 $tmp = $box[$a];
  27.                 $box[$a] = $box[$j];
  28.                 $box[$j] = $tmp;
  29.                 $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
  30.         }
  31.         return ($operation == 'ENCODE' ? str_replace('=', '', base64_encode($result)) : $result);
  32. }
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 22-8-2025 05:28 PM , Processed in 0.123600 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表