安全研究

安全漏洞
Coppermine Photo Gallery多个跨站脚本及SQL注入漏洞

发布日期:2008-01-29
更新日期:2008-01-31

受影响系统:
Coppermine Photo Gallery 1.4.14
不受影响系统:
Coppermine Photo Gallery 1.4.15
描述:
BUGTRAQ  ID: 27511,27509
CVE(CAN) ID: CVE-2008-0504,CVE-2008-0505,CVE-2008-0506

Coppermine是用PHP编写的多用途集成web图形库脚本。

Coppermine实现上存在输入验证漏洞,远程攻击者可能利用此漏洞在用户浏览器中执行恶意代码。

Coppermine的util.php和reviewcom.php文件没有正确地验证某些参数输入,允许远程攻击者通过注入任意SQL命令控制SQL查询:

--------------------------------------------------
function update_thumbs()
{
        global $CONFIG, $lang_util_php;

        $albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;
        $albstr = ($albumid) ? "WHERE aid = $albumid" : '';

        $updatetype = $_POST['updatetype'];
        $numpics = $_POST['numpics'];
        $startpic = (isset($_POST['startpic'])) ? $_POST['startpic'] : 0;

        echo "<h2>{$lang_util_php['thumbs_wait']}</h2>";

        $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']}
$albstr LIMIT $startpic, $numpics");
        $count = mysql_num_rows($result);
--------------------------------------------------

未经任何过滤便在SQL查询中使用了$_POST['albumid']、$_POST['startpic']和$_POST['numpics']。

--------------------------------------------------
if (isset($_POST['cid_array'])) {
    $cid_array = $_POST['cid_array'];
    $cid_set = '';
    foreach ($cid_array as $cid)
    $cid_set .= ($cid_set == '') ? '(' . $cid : ', ' . $cid;
    $cid_set .= ')';

    cpg_db_query("DELETE FROM {$CONFIG['TABLE_COMMENTS']}
WHERE msg_id IN $cid_set");
    $nb_com_del = mysql_affected_rows();
}
--------------------------------------------------

在DELETE查询中使用了来自$_POST['cid_array']的未经过滤数据。

docs/showdoc.php文件没有正确地验证h和t参数输入便返回给了用户,这可能导致在用户浏览器会话中执行任意HTML和脚本代码。

<*来源:Janek Vind (come2waraxe@yahoo.com
  
  链接:http://secunia.com/advisories/28682/
        http://coppermine-gallery.net/forum/index.php?PHPSESSID=103feaebc400347873cbaecf8474835d&action=printpage;topic=50103.0
        http://marc.info/?l=bugtraq&m=120179246501874&w=2
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

http://localhost/coppermine.1.4.14/docs/showdoc.php?h=waraxe&t=<script>alert(123);</script>
http://localhost/coppermine.1.4.14/docs/showdoc.php?h=</title><script>alert(123);</script>&t=waraxe
http://localhost/coppermine.1.4.14/include/slideshow.inc.php

建议:
厂商补丁:

Coppermine
----------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://downloads.sourceforge.net/coppermine/cpg1.4.15.zip

浏览次数:2646
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障