forum.coppermine-gallery.net

Support => Italian (Italiano) => Closed boards => Language Specific Support => cpg1.4.x Italian (Italiano) => Topic started by: Davide Renda on March 05, 2009, 02:12:44 pm

Title: █ █ Aggiornamento Coppermine 1.4.21 █ █
Post by: Davide Renda on March 05, 2009, 02:12:44 pm
Il gruppo di sviluppo Coppermine ha rilasciato un aggiornamento di sicurezza per colmare una vulnerabilità recentemente scoperta. È importante che chiunque utilizzi una versione 1.4.20 (o, peggio, precedente) aggiorni al più presto all'ultima versione.

Come aggiornare:
Gli utenti delle versioni precedenti alla 1.4.21 devono aggiornare immediatamente scaricando (http://downloads.sourceforge.net/coppermine/cpg1.4.21.zip) l'ultima versione dalla pagina download (http://sourceforge.net/project/showfiles.php?group_id=89658) e seguendo le istruzioni dalla documentazione (http://coppermine.svn.sourceforge.net/viewvc/coppermine/trunk/cpg1.4.x/docs/index.htm#upgrade).  Chi lo desiderasse potrà invece applicare la patch manualmente seguendo le istruzioni nel messaggio seguente.

Supporto:
Se incontrate problemi con questo aggiornamento, aprite liberamente una discussione in questa sezione in Italiano.

Perché del rilascio della versione 1.4.21
Questa versione colma una vulnerabilità recentemente scoperta che permetterebbe ad un utente di lanciare un attacco CSRF (definizione (http://en.wikipedia.org/wiki/Cross-site_request_forgery)) contro il vostro sito (milw0rm exploit 8114 (http://www.milw0rm.com/exploits/8114) e 8115 (http://www.milw0rm.com/exploits/8115)). La possibile vulnerabilità è dovuto al processo dei tags bbcode [ i m g ] and [ u r l ]. L'attacco può essere lanciato attraverso questi tags e raggiungere l'intero sito; tutti gli amministratori di gallerie Coppermine devono agire immediatamente.
Dato che CPG 1.4.x è una versione stabile del pacchetto, il dev-team non può risolvere questa vulnerabilità senza dover pesantemente metter mano al codice, quindi la soluzione è stata di rimuovere il processo dei due tags bbcode [ i m g ] and [ u r l ]
Questa non sarà la soluzione finale, ma è necessaria per colmare la vulnerabilità. Il dev-team Coppermine sta attualmente lavorando su come risolvere il problema a fondo e presto i risultati saranno disponibili. Chi vuole potrà avere ulteriori informazioni su come vengano processati i tags e/o come trovare la propria soluzione nella sezione bbcode della documentazione (http://coppermine.svn.sourceforge.net/viewvc/coppermine/trunk/cpg1.4.x/docs/index.htm#bbcode).

In aggiunta alla patch, la versione 1.4.21 include anche altri fix che non hanno a che vedere con la sicurezza. Il file whatsnew disponibile nel pacchetto.
Grazie a StAkeR alla milw0rm che ha scoperto la possibile vulnerabilità.

Coppermine Team
Title: Re: █ █ Aggiornamento Coppermine 1.4.21 █ █
Post by: Davide Renda on March 05, 2009, 02:15:45 pm
Chi lo desidera (e qui penso agli utenti del Modpack di Stramm) potrà applicare il patch alla vulnerabilità direttamente. Questo risolverà solamente il problema serio di sicurezza, ma non aggiornerà la galleria all'ultima versione.

Rimpiazzate la funzione bb_decode nel file include/functions.inc.php col seguente codice:
Code: [Select]
// Allow the use of a limited set of phpBB bb codes in albums and image descriptions
// Based on phpBB code

/**
 * bb_decode()
 *
 * @param $text
 * @return
 **/

function bb_decode($text)
{
    $text = nl2br($text);

    static $bbcode_tpl = array();
    static $patterns = array();
    static $replacements = array();

    // First: If there isn't a "[" and a "]" in the message, don't bother.
    if ((strpos($text, "[") === false || strpos($text, "]") === false)) {
        return $text;
    }

    // [b] and [/b] for bolding text.
    $text = str_replace("[b]", '<b>', $text);
    $text = str_replace("[/b]", '</b>', $text);

    // [u] and [/u] for underlining text.
    $text = str_replace("[u]", '<u>', $text);
    $text = str_replace("[/u]", '</u>', $text);

    // [i] and [/i] for italicizing text.
    $text = str_replace("[i]", '<i>', $text);
    $text = str_replace("[/i]", '</i>', $text);

    // colors
    $text = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\]/", '<span style="color:$1">', $text);
    $text = str_replace("[/color]", '</span>', $text);

    // [i] and [/i] for italicizing text.
    //$text = str_replace("[i:$uid]", $bbcode_tpl['i_open'], $text);
    //$text = str_replace("[/i:$uid]", $bbcode_tpl['i_close'], $text);

    if (!count($bbcode_tpl)) {
        // We do URLs in several different ways..
       
        // **** WARNING *******************************************************
        // The [url] tag can be used for a serious attack against your website.
        // So [url] tags are no longer processed to show links.
        // This simple action here is not an ideal solution but is necessary.
        // Now, [url] tags are processed as follows:
        // [url=link]text[/url] shows 'text' with a dummy image for the link.
        // [url]link[/url] shows 'link' as plain text with a dummy image.
        // The following line is the original line that processed [url]:
        // $bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" rel="external">{DESCRIPTION}</a></span>';
        // ********************************************************************
        // See this thread on the Coppermine forum for more information:
        // http://forum.coppermine-gallery.net/index.php/topic,58309.0.html
        // Please read this thread carefully before deciding to process [url].
        // ********************************************************************
        $url_removed = '{URL}';  // put the image URL in the tooltip/mouse-over
        $bbcode_tpl['url']   = '{DESCRIPTION}<img src="images/descending.gif" alt="" title="' . $url_removed . '" />';
        $bbcode_tpl['email'] = '<span class="bblink"><a href="mailto:{EMAIL}">{EMAIL}</a></span>';

        $bbcode_tpl['url1'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['url']);
        $bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\\1\\2', $bbcode_tpl['url1']);

        $bbcode_tpl['url2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
        $bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']);

        $bbcode_tpl['url3'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['url']);
        $bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url3']);

        $bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
        $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url4']);

        $bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);

        // [url]xxxx://www.phpbb.com[/url] code..
        $patterns[1] = "#\[url\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si";
        $replacements[1] = $bbcode_tpl['url1'];

        // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
        $patterns[2] = "#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si";
        $replacements[2] = $bbcode_tpl['url2'];

        // [url=xxxx://www.phpbb.com]phpBB[/url] code..
        $patterns[3] = "#\[url=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si";
        $replacements[3] = $bbcode_tpl['url3'];

        // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
        $patterns[4] = "#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si";
        $replacements[4] = $bbcode_tpl['url4'];

        // [email]user@domain.tld[/email] code..
        $patterns[5] = "#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
        $replacements[5] = $bbcode_tpl['email'];

        // [img]xxxx://www.phpbb.com[/img] code..
        // **** WARNING *******************************************************
        // The [img] tag can be used for a serious attack against your website.
        // So [img] tags are no longer processed to show the specified images.
        // This simple action here is not an ideal solution but is necessary.
        // Now [img] tags will show a dummy image instead as a placeholder.
        // ********************************************************************
        // The following line is the original line that processed [img]:
        // $bbcode_tpl['img'] = '<img src="{URL}" alt="" />';
        // ********************************************************************
        // See this thread on the Coppermine forum for more information:
        // http://forum.coppermine-gallery.net/index.php/topic,58309.0.html
        // Please read this thread carefully before deciding to process [img].
        // ********************************************************************
        $img_removed = '{URL}';  // put the image URL in the tooltip/mouse-over
        $bbcode_tpl['img'] = '<img src="images/thumbnails.gif" alt="" title="' . $img_removed . '" />';
        $bbcode_tpl['img'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['img']);
        $patterns[6] = "#\[img\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/img\]#si";
        $replacements[6] = $bbcode_tpl['img'];
    }
    $text = preg_replace($patterns, $replacements, $text);
    return $text;
}
Title: Re: █ █ Aggiornamento Coppermine 1.4.21 █ █
Post by: Davide Renda on March 05, 2009, 02:25:06 pm
Joachim Müller, inoltre, ci tiene a specificare i seguenti punti:
Title: Re: █ █ Aggiornamento Coppermine 1.4.21 █ █
Post by: Davide Renda on March 10, 2009, 09:46:12 am
Anche il Modpack è disponibile per l'aggiornamento alla 1.4.21.
Download da Stramm's Sandbox (http://stramm.st.funpic.org/displayimage.php?pos=-696)
Download dal mirror Sourceforge (http://downloads.sourceforge.net/coppermine/cpg1.4.21_modpack_stramm_1_bridge.zip)